Saturday, December 24, 2011

My answer to "Updates to Facebook API"

This is my answer to a Question on Support site for LampCMS project


I have just pushed the new files to github. It includes the new API for Facebook, both for login with Facebook and for posting to Facebook Wall.

This updates also includes a rewrite of how User (Viewer) object is stored in session. The User object is no longer stored in session, only the userid and classname of user is stored in session and the actual object is recreated on page load.

Is this less efficient? I don't thinks so. The select of user array on primary key from Mongo collection takes about 1 millisecond. Creating a new object is not any slower that unserializing it.

The benefit of this change is that session becomes alot more reliable now. No more sudden user logout, no more unpredictable session behaviour.

I also rewrite some parts of the script that used to have the exit() statement, we no longer using exit(), instead using a special type of exception which propagates all the way to the end of the script, so script always exists the natural way. The exit() method is not bad way to terminate the script, except that in some servers, in certain server environments it causes problems. Since this is an open source project, it must work on as many different platforms as possible. I think the latest change makes alot of progress in making it alot more reliable.

Please download, install, test it. Report any problems if you encounter any.

Thank you.

1 comment:

  1. This is a great feature, particularly for re-logging in. Not everyone remembers their passwords.

    ReplyDelete