Elgg  Version 2.3
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Elgg\Database\Datalist Class Reference

Public Member Functions

 __construct (Pool $cache, Database $db, Logger $logger, $table)
 Constructor. More...
 
 setCache (Pool $pool)
 Set cache. More...
 
 get ($name)
 Get the value of a datalist element. More...
 
 set ($name, $value)
 Set the value for a datalist element. More...
 
 runFunctionOnce ($functionname, $timelastupdatedcheck=0)
 Run a function one time per installation. More...
 

Public Attributes

const MAX_NAME_LENGTH = 255
 

Protected Member Functions

 validateName ($name)
 Verify a datalist name is valid. More...
 

Protected Attributes

 $cache
 
 $db
 
 $logger
 
 $table
 

Detailed Description

Definition at line 20 of file Datalist.php.

Constructor & Destructor Documentation

Elgg\Database\Datalist::__construct ( Pool  $cache,
Database  $db,
Logger  $logger,
  $table 
)

Constructor.

Parameters
Pool$cacheSome kind of caching implementation
Database$dbThe database
Logger$loggerA logger
string$tableThe name of the datalists table, including prefix

Definition at line 44 of file Datalist.php.

Member Function Documentation

Elgg\Database\Datalist::get (   $name)

Get the value of a datalist element.

Plugin authors should use elgg_get_config() and pass null for the site GUID.

Definition at line 77 of file Datalist.php.

Elgg\Database\Datalist::runFunctionOnce (   $functionname,
  $timelastupdatedcheck = 0 
)

Run a function one time per installation.

If you pass a timestamp as the second argument, it will run the function only if (i) it has never been run before or (ii) the timestamp is >= the last time it was run.

Warning
Functions are determined by their name. If you change the name of a function it will be run again.

Use $timelastupdatedcheck in your plugins init function to perform automated upgrades. Schedule a function to run once and pass the timestamp of the new release. This will cause the run once function to be run on all installations. To perform additional upgrades, create new functions for each release.

Warning
The function name cannot be longer than 255 characters long due to the current schema for the datalist table.

Definition at line 161 of file Datalist.php.

Elgg\Database\Datalist::set (   $name,
  $value 
)

Set the value for a datalist element.

Plugin authors should use elgg_save_config() and pass null for the site GUID.

Warning
Names should be selected so as not to collide with the names for the site config.
Values set here are not available in $CONFIG until next page load.
Parameters
string$nameThe name of the datalist
string$valueThe new value
Returns
bool private

Definition at line 110 of file Datalist.php.

Elgg\Database\Datalist::setCache ( Pool  $pool)

Set cache.

The BootService injects a pre-populated cache here. The constructor requires a cache as well because the installer doesn't fully boot.

Parameters
Pool$poolCache
Returns
void private
See also
::boot

Definition at line 60 of file Datalist.php.

Elgg\Database\Datalist::validateName (   $name)
protected

Verify a datalist name is valid.

Parameters
string$nameDatalist name to be checked
Returns
bool

Definition at line 187 of file Datalist.php.

Member Data Documentation

Elgg\Database\Datalist::$cache
protected

Definition at line 25 of file Datalist.php.

Elgg\Database\Datalist::$db
protected

Definition at line 28 of file Datalist.php.

Elgg\Database\Datalist::$logger
protected

Definition at line 31 of file Datalist.php.

Elgg\Database\Datalist::$table
protected

Definition at line 34 of file Datalist.php.

const Elgg\Database\Datalist::MAX_NAME_LENGTH = 255

Definition at line 22 of file Datalist.php.


The documentation for this class was generated from the following file: