vBulletin 5.6.5 API

vB_Datastore_Filecache extends vB_Datastore
in package

Class for fetching and initializing the vBulletin datastore from files

Tags
version

$Revision: 99787 $

date

$Date: 2018-10-24 17:13:06 -0700 (Wed, 24 Oct 2018) $

Table of Contents

BITFIELDS_PREFIX  = 'bf_'
BITFIELDS_TITLE  = 'bitfields'
$cacheableitems  : array<string|int, mixed>
Default items that are always loaded by fetch() when using the file method;
$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
$datastoreLocation  : mixed
$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()  : void
Updates the appropriate cache file
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()  : void
Fetches the contents of the datastore from cache files
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.
atomic_move()  : bool
Perform an atomic move where a request may occur before a file is written
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.
fetch_build()  : mixed
Fetches the specified datastore item from the database and tries to update the file cache with it. Data is automatically unserialized.
lock()  : bool
Obtains a lock for the datastore. Attempt to get the lock multiple times before failing.
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
unlock()  : void
Releases the datastore lock
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

$cacheableitems

Default items that are always loaded by fetch() when using the file method;

protected array<string|int, mixed> $cacheableitems = array('options', 'bitfields', 'usergroupcache', 'stylecache', 'languagecache', 'products', 'hooks')

$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

$datastoreLocation

protected mixed $datastoreLocation

$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()

Updates the appropriate cache file

public build([mixed $title = '' ][, mixed $data = '' ], mixed $unserialize[, mixed $storelocal = true ]) : void
Parameters
$title : mixed = ''
$data : mixed = ''
$unserialize : mixed
$storelocal : mixed = 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
void

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 cache files

public fetch(mixed $items) : void
Parameters
$items : mixed
Return values
void

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

atomic_move()

Perform an atomic move where a request may occur before a file is written

protected atomic_move(mixed $sourcefile, mixed $destfile) : bool
Parameters
$sourcefile : mixed
$destfile : mixed
Return values
bool

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

fetch_build()

Fetches the specified datastore item from the database and tries to update the file cache with it. Data is automatically unserialized.

protected fetch_build(mixed $title) : mixed
Parameters
$title : mixed
Return values
mixed

Data from datastore (unserialized if fetched)

lock()

Obtains a lock for the datastore. Attempt to get the lock multiple times before failing.

protected lock([mixed $title = '' ]) : bool
Parameters
$title : mixed = ''
Return values
bool

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

unlock()

Releases the datastore lock

protected unlock([mixed $title = '' ]) : void
Parameters
$title : mixed = ''
Return values
void

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