class vB_Datastore

Class for fetching and initializing the vBulletin datastore from the database

Traits

Constants

BITFIELDS_TITLE

BITFIELDS_PREFIX

Properties

protected array $defaultitems Default items that are always loaded by fetch();
protected string $prefix Unique prefix for item's title, required for multiple forums on the same server using the same classes that read/write to memory
protected bool $checked_options Whether we have verified that options were loaded correctly.
protected array $config Contains the config variables loaded from the config file
protected vB_dB_Assertor $db_assertor Contains the assertor object
protected $pending
protected array $registered All of the entries that have already been fetched
protected $registeredBitfields
protected $noValues

Methods

__sleep()

No description

__wakeup()

No description

__construct($config, $db_assertor)

No description

resetCache()

Resets datastore cache

preload(array $titles)

Set an array of items that should be preloaded. These will not be loaded immediately but will be fetched on the first call to getValue.

get_value($title) deprecated

No description

registerCount()

No description

getValue($title)

No description

getOption($name)

No description

setOption($name, $value, $save = true)

No description

setValue(string $title, mixed $value)

This method is intended only for unit testing. Do NOT use it in other context.

clearValues()

This method is intended only for unit testing. Do NOT use it in other context.

build(string $title = '', string $data = '', int $unserialize = 0, bool $storelocal = true)

This method replaces the legacy function build_datastore

none
delete($title)

Delete a datastore entry

array(string)
getKeys()

Get the list of all datastore keys

init_registry() deprecated

Temporary function to manage initializing the legacy registry from the datastore

update_registry($title, $data)

No description

boolean
register(string $title, mixed $data, integer $unserialize_detect = 2)

Sorts the data returned from the cache and places it into appropriate places

array
prepare_itemarray(array $items)

Prepares a list of items for fetching.

string
prepare_itemlist(array $items, bool $prepare_items = false)

Prepares an array of items into a list.

boolean
fetch(array $items)

Fetches the contents of the datastore from the database

fastDSFetch($items)

Tries to get values from fastDS, if available. Done this way to make interitance of fetch() easier.

bool
do_db_fetch(string $itemlist)

Performs the actual fetching of the datastore items for the database, child classes may use this

check_options()

Checks that the options item has come out of the datastore correctly and sets the 'versionnumber' variable

check_pseudo_options()

Checks that certain pseudo-options (versionnumber and facebookactive) are set correctly

array
build_options()

Reads settings from the settings then saves the values to the datastore

mixed
validate_setting_value(mixed $value, string $datatype, boolean $bool_as_int = true, boolean $username_query = true)

Validates the provided value of a setting against its datatype.

buildUserGroupCache(array $usergroupinfo)

Gets usergroup data to save it in the datastore and update the related values.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 92
__construct($config, $db_assertor)

Parameters

$config
$db_assertor

at line 121
resetCache()

Resets datastore cache

at line 132
preload(array $titles)

Set an array of items that should be preloaded. These will not be loaded immediately but will be fetched on the first call to getValue.

Parameters

array $titles

at line 155
get_value($title) deprecated

deprecated

Parameters

$title

at line 160
registerCount()

at line 165
getValue($title)

Parameters

$title

at line 190
getOption($name)

Parameters

$name

at line 200
setOption($name, $value, $save = true)

Parameters

$name
$value
$save

at line 233
setValue(string $title, mixed $value)

This method is intended only for unit testing. Do NOT use it in other context.

Parameters

string $title
mixed $value value

at line 249
clearValues()

This method is intended only for unit testing. Do NOT use it in other context.

Clear all the cache class vars, useful to calculate every value again.

at line 273
build(string $title = '', string $data = '', int $unserialize = 0, bool $storelocal = true)

This method replaces the legacy function build_datastore

Parameters

string $title
string $data
int $unserialize
bool $storelocal -- if we should keep a local copy in memory as if this item had been loaded. This prevents the mass rebuilding of large datastore items from overloading the available memory.

at line 337
none delete($title)

Delete a datastore entry

Parameters

$title datastore entry to delete

Return Value

none

at line 354
array(string) getKeys()

Get the list of all datastore keys

Return Value

array(string) titles of the datastore keys stored.

at line 366
init_registry() deprecated

deprecated

Temporary function to manage initializing the legacy registry from the datastore

at line 375
protected update_registry($title, $data)

Parameters

$title
$data

at line 415
protected boolean register(string $title, mixed $data, integer $unserialize_detect = 2)

Sorts the data returned from the cache and places it into appropriate places

Parameters

string $title The name of the data item to be processed
mixed $data The data associated with the title
integer $unserialize_detect If the data needs to be unserialized, 0 = no, 1 = yes, 2 = auto detect

Return Value

boolean

at line 475
protected array prepare_itemarray(array $items)

Prepares a list of items for fetching.

Items that are already fetched are skipped.

Parameters

array $items string $items - Array of item titles that are required

Return Value

array string - An array of items that need to be fetched

at line 522
protected string prepare_itemlist(array $items, bool $prepare_items = false)

Prepares an array of items into a list.

The result is a comma delimited, db escaped, quoted list for use in SQL.

Parameters

array $items string $items - An array of item titles
bool $prepare_items
  • Wether to check the items first

Return Value

string
  • A sql safe comma delimited list

at line 544
boolean fetch(array $items)

Fetches the contents of the datastore from the database

Parameters

array $items Array of items to fetch from the datastore

Return Value

boolean

at line 569
protected fastDSFetch($items)

Tries to get values from fastDS, if available. Done this way to make interitance of fetch() easier.

Parameters

$items

at line 597
protected bool do_db_fetch(string $itemlist)

Performs the actual fetching of the datastore items for the database, child classes may use this

Parameters

string $itemlist title of the datastore item

Return Value

bool Valid Query?

at line 632
protected check_options()

Checks that the options item has come out of the datastore correctly and sets the 'versionnumber' variable

at line 658
protected check_pseudo_options()

Checks that certain pseudo-options (versionnumber and facebookactive) are set correctly

at line 698
array build_options()

Reads settings from the settings then saves the values to the datastore

After reading the contents of the setting table, the function will rebuild the $vbulletin->options array, then serialize the array and save that serialized array into the 'options' entry of the datastore in the database

Extracted from adminfunctions.php

Return Value

array The $vbulletin->options array

at line 762
protected mixed validate_setting_value(mixed $value, string $datatype, boolean $bool_as_int = true, boolean $username_query = true)

Validates the provided value of a setting against its datatype.

Extracted from adminfunctions_options

Parameters

mixed $value (ref) Setting value
string $datatype Setting datatype ('number', 'boolean' or other)
boolean $bool_as_int Represent boolean with 1/0 instead of true/false
boolean $username_query Query database for username type

Return Value

mixed Setting value

at line 875
buildUserGroupCache(array $usergroupinfo)

Gets usergroup data to save it in the datastore and update the related values.

This includes some validations to keep consistency in the datastore and db.

Parameters

array $usergroupinfo An array containing the usergroups information.

@param  array   The saved usergroup info