Now i see what you're asking!
--
automerge sux!!! --
Looking through the code, init.php simply calls
PHP Code:
$vbulletin->datastore->fetch($specialtemplates);
The fetch() function of the 3 different datastore classes:
- DB: The fetch function builds a comma delimited list of titles to fetch from the database - the query modification I posted will deal with additional datastore retrieval needs, they will all be automatically registered, but not unserialized.
- MEMCACHED: Memcached stores all datastore items in its storage method once it has seen that item at least once - First time it gets seen, it has to be queried, I believe this is fair. $specialtemplates dictates what is automatically registered and unserialized. There should be no extra noticable overhead to call the fetch method for this class type. It will check memcached's store to see if it exists, and if it doesnt query the db, put it in memcached, and register it. An extra function call is necessary for this class type with the current code.
- FILE: It appears that only certain items determined by the $cachableitems array inside this class are able to be stored efficiently for this method. Any datastore items not mentioned in this array are pulled from the database regardless of it they exist in the datastore_cache.php file. This method seems to be a hybrid of the DB and complete filesystem based methods. Maybe this is an oversight, or by design. Changes need to be made to fetch() to allow function calls in products to fetch datastore items that are actually stored in the filesystem, instead of querying the database.
There is also a stress point using fetch, because this function is not necessary and will cause an extra query when using the default datastore method. Maybe another function is necessary to determin if we really need to call fetch() (user using default method? its already registered!!)
One small almost irrelevant point, it would be nice to be able to specify if the datastore item should be unserialized. In my opinion the best way to deal with that would be to have another parameter for fetch() or register() that the caller tells the function to unserialize, instead of relying on an internal $unserialize array.
Hope I made sense
I should also note that I do not write this as an intention to hack vBulletin - Im discussing this as an addition to vBulletin. Maybe not the best forum for it, but Im sure the devs are looking at this thread.