PDA

View Full Version : Store data in datastore


vsforums
01-02-2014, 03:01 PM
Hi Guys,

I want to store some data from my plugin in the datastore so i don't have to query the database all the time.

I tried to do this by:
build_datastore('mytest', "test", 0);

and this actually saves it in the datastore table.

However i cannot access it by either:
$vbulletin->mytest
or
$vbulletin->datastore->mytest

Both return NULL.

Any idea?

kh99
01-02-2014, 03:20 PM
You need to arrange for it to be loaded by adding your name to the $new_datastore_fetch array, using hook location init_startup. Unfortunately I believe this does add a query if no other plugin has added anything to $new_datastore_fetch, but at least any added will be combined in to one query. Since the plugin code itself is read from the datastore, of course it's not possible to specify in a plugin that something else be loaded in that same query (but you could do it by editing the vb files).