Elgg/Elgg — pull request #406 by Srokap (2012-10-11 18:52:28+00:00)
Title: Explicit guid casting to int wrapped with sanitise_guid function and add...

...ed elgg_get_guid_sql funciton to generate guid sql in customized installations.

This commit is a result of our work on optimizing Elgg DB storage for chosen entities. We had problems with easy introducing and using non-integer guids. As you can see, there's lots of places in the core there it's assumed, that guid must be integer value. In our usage, we wanted to use strings (number:number in particular), and casting to int caused bad things to happen.

This pull request is an attempt to give ability of tunning up elgg core even more by wrapping this int-specific logic into functions that can be easily altered.

Most of the changes were done with regular expressions, some of it had to be done manually. It's possible we still missed something, but I think this commit is a good start.

We introduce functions:
sanitise_guid - replacement of explicit cast to int
elgg_get_guid_sql - function deciding for example if we should wrap argument into colons or not, in this implementation it casts to string without adding anything.