The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How does the datastore system work?
There are some aspects of vb that are not obvious. The datastore looks interesting. Can someone familiar with the code provide an overview of how it works?
|
#2
|
||||
|
||||
Well ... datastore is nothing mysterious.
The table holds serialized content of variables (mostly arrays). If you want to read one of those you must include the key in $specialtemplates, init.php will then load the according rows from the table into $datastore To get your stuff use $myarray = unserialize($datastore['mykey']); To write your stuff call build_datastore('mykey', serialize($myarray)), this function is defined in functions_databuild.php. That's it. |
#3
|
||||
|
||||
Nice succinct answer, KirbyDE well done mate...
|
#4
|
||||
|
||||
Thanks. I wanted to keep bandwidth usage low ^.^
|
#5
|
||||
|
||||
If it still calls from the DB, what are the real advantages of it and what would be a good example of where to use / not use it? =p
|
#6
|
||||
|
||||
Well the advantage is that you don't need an additional query, as init.php will load all required rows with just 1 query.
So it is easy to store custom data without having to modify existing queries or introduce new ones. I'd suse this for data that needs to be read often/all the time, but is only being updated seldom (as you can see, datastore holds things like user record, smilies, bbcode, etc). |
#7
|
||||
|
||||
Thanks. What confused me is that I started by looking at the raw data. While it doesn't quite look encrypted, it has a:n or s:n but other times it just has numbers. I don't quite get what those a: or s: stand for?
|
#8
|
||||
|
||||
a = array
s = string and the numbers indicate how many characters are included to reconstruct the object ... |
#9
|
||||
|
||||
Quote:
Then how would you call it back? I tried PHP Code:
PHP Code:
PHP Code:
|
#10
|
||||
|
||||
After putting 'mytest' in specialtemplates before calling global.php,
$datastore['mytest'] worked. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|