Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Protected Member Functions | 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...
 

Protected Member Functions

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

Detailed Description

Definition at line 19 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 41 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 74 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 147 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 103 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 57 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 173 of file Datalist.php.


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