38 $result = $db->query(
'SELECT * FROM `variable`');
40 while ($db->next_record($result)) {
42 $variable = $db->Record;
43 if ((
$variables[$variable[
'name']] = @unserialize($variable[
'value'])) === FALSE) {
44 $variables[$variable[
'name']] = $variable[
'value'];
85 function variable_get($name, $default = null, $createit_comment = null) {
90 if (isset($conf[$name])) {
92 }
elseif (!is_null($createit_comment)) {
110 $msg->log(
'variable',
'variable_set',
'+' . serialize(
$value) .
'+' . $comment .
'+');
115 $value2 = serialize(
$value);
119 if (array_key_exists($name, $conf)) {
120 $previous = $conf[$name];
124 if (!array_key_exists($name, $conf) ||
$value != $conf[$name]) {
126 if (empty($comment)) {
127 $query =
"INSERT INTO variable (name, value) values ( ?, ?) on duplicate key update name= ?, value= ? ;";
128 $query_args = array($name, $value2, $name, $value2);
131 $query =
"INSERT INTO variable (name, value, comment) values ( ?, ?, ?) on duplicate key update name= ?, value= ?, comment= ? ;";
132 $query_args = array($name, $value2, $comment, $name, $value2, $comment);
134 $db->query(
$query, $query_args);
135 $hooks->invoke(
"hook_variable_set", array(
"name" => $name,
"old" => $previous,
"new" =>
$value));
148 $db->query(
"DELETE FROM `variable` WHERE name = ?;", array($name));
159 $db->query(
"SELECT * FROM `variable` WHERE `comment` IS NOT NULL ORDER BY `name`");
160 while ($db->next_record()) {
variable_init($conf=array())
Persistent variable table.
if(empty($site_name)) elseif($piwik->site_add( $site_name, $site_urls))
variable_init_maybe()
Initialize the global $conf array if necessary.
foreach($domaines_user as $domaine) $t
if(! $admin->enabled) $conf
Manages global variables of AlternC.
variable_del($name)
Unset a persistent variable.
variable_set($name, $value, $comment=null)
Set a persistent variable.
variable_get($name, $default=null, $createit_comment=null)
Return a persistent variable.
variables_list()
List all variables.