vBulletin 5.6.5 API

vB_Datastore
in package
Uses vB_Trait_NoSerialize

Class for fetching and initializing the vBulletin datastore from the database

Tags
version

$Revision: 106361 $

date

$Date: 2020-10-21 12:10:38 -0700 (Wed, 21 Oct 2020) $

Table of Contents

BITFIELDS_PREFIX  = 'bf_'
BITFIELDS_TITLE  = 'bitfields'
$checked_options  : bool
Whether we have verified that options were loaded correctly.
$config  : array<string|int, mixed>
Contains the config variables loaded from the config file
$db_assertor  : vB_dB_Assertor
Contains the assertor object
$defaultitems  : array<string|int, mixed>
Default items that are always loaded by fetch();
$noValues  : mixed
$pending  : mixed
$prefix  : string
Unique prefix for item's title, required for multiple forums on the same server using the same classes that read/write to memory
$registered  : array<string|int, mixed>
All of the entries that have already been fetched
$registeredBitfields  : mixed
__construct()  : mixed
__serialize()  : mixed
__sleep()  : mixed
__unserialize()  : mixed
__wakeup()  : mixed
build()  : mixed
This method replaces the legacy function build_datastore
build_options()  : array<string|int, mixed>
Reads settings from the settings then saves the values to the datastore
clearValues()  : mixed
This method is intended only for unit testing. Do NOT use it in other context.
delete()  : none
Delete a datastore entry
fetch()  : bool
Fetches the contents of the datastore from the database
get_value()  : mixed
getKeys()  : array<string|int, mixed>|(string)
Get the list of all datastore keys
getOption()  : mixed
getValue()  : mixed
init_registry()  : mixed
Temporary function to manage initializing the legacy registry from the datastore
preload()  : mixed
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.
registerCount()  : mixed
resetCache()  : mixed
Resets datastore cache
setOption()  : mixed
setValue()  : mixed
This method is intended only for unit testing. Do NOT use it in other context.
check_options()  : mixed
Checks that the options item has come out of the datastore correctly and sets the 'versionnumber' variable
check_pseudo_options()  : mixed
Checks that certain pseudo-options (versionnumber and facebookactive) are set correctly
do_db_fetch()  : bool
Performs the actual fetching of the datastore items for the database, child classes may use this
fastDSFetch()  : mixed
Tries to get values from fastDS, if available. Done this way to make interitance of fetch() easier.
prepare_itemarray()  : array<string|int, mixed>
Prepares a list of items for fetching.
prepare_itemlist()  : string
Prepares an array of items into a list.
register()  : bool
Sorts the data returned from the cache and places it into appropriate places
update_registry()  : mixed
validate_setting_value()  : mixed
Validates the provided value of a setting against its datatype.

Constants

BITFIELDS_PREFIX

public mixed BITFIELDS_PREFIX = 'bf_'

BITFIELDS_TITLE

public mixed BITFIELDS_TITLE = 'bitfields'

Properties

$checked_options

Whether we have verified that options were loaded correctly.

protected bool $checked_options

$config

Contains the config variables loaded from the config file

protected array<string|int, mixed> $config

$db_assertor

Contains the assertor object

protected vB_dB_Assertor $db_assertor

$defaultitems

Default items that are always loaded by fetch();

protected array<string|int, mixed> $defaultitems = array('bitfields', 'attachmentcache', 'usergroupcache', 'stylecache', 'languagecache', 'products', 'cron', 'profilefield', 'loadcache', 'miscoptions', 'noticecache', 'hooks', 'publicoptions', 'prefixcache', 'vBUgChannelPermissionsFrom', 'vBChannelTypes', 'locations')

$noValues

protected mixed $noValues = array()

$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 string $prefix = ''

$registered

All of the entries that have already been fetched

protected array<string|int, mixed> $registered = array()

$registeredBitfields

protected mixed $registeredBitfields = alse

Methods

__construct()

public __construct(mixed &$config, mixed &$db_assertor) : mixed
Parameters
$config : mixed
$db_assertor : mixed
Return values
mixed —

__serialize()

public __serialize() : mixed
Return values
mixed —

__sleep()

public __sleep() : mixed
Return values
mixed —

__unserialize()

public __unserialize(mixed $serialized) : mixed
Parameters
$serialized : mixed
Return values
mixed —

__wakeup()

public __wakeup() : mixed
Return values
mixed —

build()

This method replaces the legacy function build_datastore

public build([string $title = '' ][, string $data = '' ], int $unserialize[, bool $storelocal = true ]) : mixed
Parameters
$title : string = ''
$data : string = ''
$unserialize : int
$storelocal : bool = true

-- 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.

Return values
mixed —

build_options()

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

public build_options() : array<string|int, mixed>

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 values
array<string|int, mixed> —

The $vbulletin->options array

clearValues()

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

public clearValues() : mixed

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

Return values
mixed —

delete()

Delete a datastore entry

public delete( $title) : none
Parameters
$title :

datastore entry to delete

Return values
none —

fetch()

Fetches the contents of the datastore from the database

public fetch(mixed $items) : bool
Parameters
$items : mixed
Return values
bool —

get_value()

public get_value(mixed $title) : mixed
Parameters
$title : mixed
Tags
deprecated
Return values
mixed —

getKeys()

Get the list of all datastore keys

public getKeys() : array<string|int, mixed>|(string)
Return values
array<string|int, mixed>|(string) —

titles of the datastore keys stored.

getOption()

public getOption(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed —

getValue()

public getValue(mixed $title) : mixed
Parameters
$title : mixed
Return values
mixed —

init_registry()

Temporary function to manage initializing the legacy registry from the datastore

public init_registry() : mixed
Tags
deprecated
Return values
mixed —

preload()

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.

public preload(array<string|int, mixed> $titles) : mixed
Parameters
$titles : array<string|int, mixed>
Return values
mixed —

registerCount()

public registerCount() : mixed
Return values
mixed —

resetCache()

Resets datastore cache

public resetCache() : mixed
Return values
mixed —

setOption()

public setOption(mixed $name, mixed $value[, mixed $save = true ]) : mixed
Parameters
$name : mixed
$value : mixed
$save : mixed = true
Return values
mixed —

setValue()

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

public setValue(string $title, mixed $value) : mixed
Parameters
$title : string
$value : mixed
Return values
mixed —

check_options()

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

protected check_options() : mixed
Return values
mixed —

check_pseudo_options()

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

protected check_pseudo_options() : mixed
Return values
mixed —

do_db_fetch()

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

protected do_db_fetch(mixed $itemlist) : bool
Parameters
$itemlist : mixed
Return values
bool —

Valid Query?

fastDSFetch()

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

protected fastDSFetch(mixed &$items) : mixed
Parameters
$items : mixed
Return values
mixed —

prepare_itemarray()

Prepares a list of items for fetching.

protected prepare_itemarray(mixed $items) : array<string|int, mixed>

Items that are already fetched are skipped.

Parameters
$items : mixed
Return values
array<string|int, mixed> —

string - An array of items that need to be fetched

prepare_itemlist()

Prepares an array of items into a list.

protected prepare_itemlist(mixed $items[, bool $prepare_items = false ]) : string

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

Parameters
$items : mixed
$prepare_items : bool = false
  • Wether to check the items first
Return values
string —
  • A sql safe comma delimited list

register()

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

protected register(mixed $title, mixed $data[, mixed $unserialize_detect = 2 ]) : bool
Parameters
$title : mixed
$data : mixed
$unserialize_detect : mixed = 2
Return values
bool —

update_registry()

protected update_registry(mixed $title, mixed $data) : mixed
Parameters
$title : mixed
$data : mixed
Return values
mixed —

validate_setting_value()

Validates the provided value of a setting against its datatype.

protected validate_setting_value(mixed &$value, mixed $datatype[, mixed $bool_as_int = true ][, mixed $username_query = true ]) : mixed

Extracted from adminfunctions_options

Parameters
$value : mixed
$datatype : mixed
$bool_as_int : mixed = true
$username_query : mixed = true
Return values
mixed —

Setting value

Search results