Elgg  Version 1.11
Public Member Functions | List of all members
Elgg\Database\Datalist Class Reference

Public Member Functions

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

Detailed Description

Definition at line 19 of file Datalist.php.

Constructor & Destructor Documentation

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


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 61 of file Datalist.php.

Elgg\Database\Datalist::loadAll ( )

Load entire datalist in memory.

This could cause OOM problems if the datalists table is large.

array private

Definition at line 124 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.

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.

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

Definition at line 164 of file Datalist.php.

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

Set the value for a datalist element.

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

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.
string$nameThe name of the datalist
string$valueThe new value
bool private

Definition at line 93 of file Datalist.php.

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