Best ever PM implementation!
Wednesday, 22. March 2006, 10:51:23
Ok, so we're off with the portal, but at launch moment it didn't have PMs (personal messeges) feature. So my colegue helped me and made an awsome PM implementation (it's still under dev, though).
Of course we could have made it with IMAP back-end, but because of our cut on hosting and servers we're doing it SQL back-ended.
So normally one would do two tables (for inbox and outbox) and stuff one message into both tables. But my colegue came up with very brilliant and unique idea! Make three tables (read on...):
The first table with all the messages holds message id, text, sender, time, etc. AND additional field which states where message should be shown (or for a user sight - deleted/kept). If message is indicated as hidden (read: deleted) in both (inbox and outbox) it is deleted from 'container' as well. But to keep our server load as low as possible - there's cron'ed script for deleting all 'hidden' messages at midnight as well with other needless data (users that deleted their account, etc.).
Isn't that awsome?!
Of course we could have made it with IMAP back-end, but because of our cut on hosting and servers we're doing it SQL back-ended.
So normally one would do two tables (for inbox and outbox) and stuff one message into both tables. But my colegue came up with very brilliant and unique idea! Make three tables (read on...):
- One for all the messages (the 'container');
- One for INBOX (with message ids from first table);
- One for OUTBOX (with message ids from first table);
The first table with all the messages holds message id, text, sender, time, etc. AND additional field which states where message should be shown (or for a user sight - deleted/kept). If message is indicated as hidden (read: deleted) in both (inbox and outbox) it is deleted from 'container' as well. But to keep our server load as low as possible - there's cron'ed script for deleting all 'hidden' messages at midnight as well with other needless data (users that deleted their account, etc.).
Isn't that awsome?!










