The Hubzilla
 All Classes Namespaces Files Functions Variables Pages
Zotlabs\Lib\PConfig Class Reference

Class for handling channel specific configurations. More...

Static Public Member Functions

static Load ($uid)
 Loads all configuration values of a channel into a cached storage. More...
 
static Get ($uid, $family, $key, $default=false)
 Get a particular channel's config variable given the category name ($family) and a key. More...
 
static Set ($uid, $family, $key, $value)
 Sets a configuration value for a channel. More...
 
static Delete ($uid, $family, $key)
 Deletes the given key from the channel's configuration. More...
 

Detailed Description

Class for handling channel specific configurations.

PConfig is used for channel specific configurations and takes a channel_id as identifier. It stores for example which features are enabled per channel. The storage is of size MEDIUMTEXT.

$var = Zotlabs\Lib\PConfig::Get('uid', 'category', 'key');
// with default value for non existent key
$var = Zotlabs\Lib\PConfig::Get('uid', 'category', 'unsetkey', 'defaultvalue');

The old (deprecated?) way to access a PConfig value is:

$var = get_pconfig(local_channel(), 'category', 'key');

Member Function Documentation

static Zotlabs\Lib\PConfig::Delete (   $uid,
  $family,
  $key 
)
static

Deletes the given key from the channel's configuration.

Removes the configured value from the stored cache in App::$config[$uid] and removes it from the database.

Parameters
string$uidThe channel_id
string$familyThe category of the configuration value
string$keyThe configuration key to delete
Returns
mixed

Referenced by del_pconfig(), and Zotlabs\Lib\Permcat\delete().

static Zotlabs\Lib\PConfig::Get (   $uid,
  $family,
  $key,
  $default = false 
)
static

Get a particular channel's config variable given the category name ($family) and a key.

Get a particular channel's config value from the given category ($family) and the $key from a cached storage in App::$config[$uid].

Returns false if not set.

Parameters
string$uidThe channel_id
string$familyThe category of the configuration value
string$keyThe configuration key to query
mixed$default(optional, default false) Default value to return if key does not exist
Returns
mixed Stored value or false if it does not exist

Referenced by Zotlabs\Access\PermissionLimits\Get(), and get_pconfig().

static Zotlabs\Lib\PConfig::Load (   $uid)
static

Loads all configuration values of a channel into a cached storage.

All configuration values of the given channel are stored in global cache which is available under the global variable App::$config[$uid].

Parameters
string$uidThe channel_id
Returns
void|false Nothing or false if $uid is null or false

Referenced by Zotlabs\Access\PermissionLimits\Get(), and load_pconfig().

static Zotlabs\Lib\PConfig::Set (   $uid,
  $family,
  $key,
  $value 
)
static

Sets a configuration value for a channel.

Stores a config value ($value) in the category ($family) under the key ($key) for the channel_id $uid.

Parameters
string$uidThe channel_id
string$familyThe category of the configuration value
string$keyThe configuration key to set
string$valueThe value to store
Returns
mixed Stored $value or false

Referenced by Zotlabs\Access\PermissionLimits\Set(), set_pconfig(), and Zotlabs\Lib\Permcat\update().


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