Sunday, September 25, 2011

Who's online module

My Question on Support site for LampCMS project

I am working on the "who's online" module. Finished writing the plugin
that updates the ONLINE records with the user data (user id, username, avatar, what url they are on, title of page and geo ip location)
This update is made after every page request. When you run the php in fastcgi mode controlled by php-fpm (you should, all the cool kids are doing it) this data is written after the page is served to the browser, so there is no noticeable performance hit.

The module is written as a plugin, it can be easily disabled from !config.ini by commenting out just one line.

Next step or steps would be to write a code to actually display a small block with 'who's online' and then we can include that block anywhere on the site.

I will also write the controller to show the list of all users online with links to pages that they are on right now.

It will be a while before all is ready but at least the logic to update the "ONLINE" collection is almost done. I just have to add additional config block to !config.ini to allow admin to also enable tracking "Guests" activity so non-logged in users will also be tracked with geo location and what pages they viewing currently. For performance reasons admin may want to disable guests online tracking.

I hope to have this finished by next weekend.

I am also working on exporting geo ip data into Mongo collections, so no more use of shmop extension will be required - it will be pure Mongo DB based ip to location lookup. I think I got it working even on 32 bit php now, using float as opposed to integer to store larger numbers. The whole GeoIP class will also become much cleaner and probably even more efficient.

I just have to test it more.

Click here to post your reply


Wednesday, September 21, 2011

My answer to "Customize look & feel"

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


Sure you can. Everything on the site is rendered from templates.
You can edit any of the html template in case you want to add css class to any element. You can then edit the css file.

Thursday, September 15, 2011

My answer to "Registering a user crashes LampCMS: shmop_open(): unable to attach or create shared memory segment"

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


It looks like this may be a problem for some users. This may very well be caused by Suhosin or by SELinux. I can't be sure, but just a quick search for this issue revealed that it's a common problem with many other projects.

I am now thinking of a couple of possible solutions:

Add config option to !config.inc ENABLE_SHARED_MEMORY and set it to true by default but if you notice problems with this function then setting to false will cause this GEOIP module to not use shared memory and use a slower file-based reads.

A Second possibility is to download the comma-separated GEOIP file from Maxmind.com and then write a script that imports it to MongoDB then just use MongoDB to lookup location by ip address. This will work for everyone. It's very easy to write that import script, but I have to think of how to do this most effeciently, not sure if I want to keep all data in one Mongo collection or use 2 or 3.
What I mean is that maybe store country/state in one location, city in another and ip to locationID in another one. OR can just follow the Mongo NO-Joins way and just store the data in one collection, keep its size fairly large but never have any joins during select. Basically it will require a little more RAM like 300MB but since the old way of storing binary DB in shared memory required at least 50MB, we can just say that the new way will require just 250MB more but will eliminate the need for shared memory and will eliminate the need to cache already resolved ip - to - location records in cache, which is currently stored in Mongo anyway.


I'm working on the solution. It will be done probably over the weekend.