From f81924c72cf8827b5206af30eaaea547f460483b Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Tue, 21 Jan 2014 16:52:39 +0000 Subject: [PATCH] Bonne table variable lors de l'install Corrige un bug dans variable_get --- bureau/admin/main.php | 2 +- bureau/class/m_variables.php | 2 +- install/mysql.sql | 25 ++++++++++--------------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/bureau/admin/main.php b/bureau/admin/main.php index 9f8ff84f..7384ebcd 100644 --- a/bureau/admin/main.php +++ b/bureau/admin/main.php @@ -44,7 +44,7 @@ if ($mem->user["lastfail"]) { if (!empty($error) ) { echo "

$error

";$error=''; } -$feed_url = variable_get('rss_feed'); +$feed_url = variable_get('rss_feed', 0, 'This is an RSS feed that will be displayed on the users homepages when they log in. Set this to 0 or a "false" string to ignore.'); if (!empty($feed_url)) { $cache_time = 60*5; // 5 minutes $cache_file = "/tmp/alterncpanel_cache_main.rss"; diff --git a/bureau/class/m_variables.php b/bureau/class/m_variables.php index 906fc1da..5e4fb0c9 100644 --- a/bureau/class/m_variables.php +++ b/bureau/class/m_variables.php @@ -163,7 +163,7 @@ class m_variables { if (isset($conf[$name])) { return $conf[$name]['value']; } elseif (!is_null($createit_comment)) { - $this->variable_update_or_create($name, $value, 'DEFAULT', null, null, $createit_comment); + $this->variable_update_or_create($name, $default, 'DEFAULT', null, null, $createit_comment); } return $default; } diff --git a/install/mysql.sql b/install/mysql.sql index e4646b66..3636306f 100644 --- a/install/mysql.sql +++ b/install/mysql.sql @@ -384,16 +384,18 @@ INSERT IGNORE INTO tld VALUES ('asia', 1); -- -- Table structure for table 'variable' -- --- Taken from http://cvs.drupal.org/viewcvs/drupal/drupal/database/database.mysql?rev=1.164&view=auto --- -- if comment is null, then the variable is internal and will not show -- up in the generic configuration panel -CREATE TABLE IF NOT EXISTS variable ( - name varchar(48) NOT NULL default '', - value longtext NOT NULL, - comment mediumtext NULL, - PRIMARY KEY (name), - KEY name (name) +CREATE TABLE `variable` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(48) NOT NULL DEFAULT '', + `value` longtext NOT NULL, + `comment` mediumtext, + `strata` enum('DEFAULT','GLOBAL','FQDN','FQDN_CREATOR','CREATOR','MEMBER','DOMAIN') NOT NULL DEFAULT 'DEFAULT', + `strata_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_2` (`name`,`strata`,`strata_id`), + KEY `name` (`name`) ) ENGINE=MyISAM; -- hosting_tld: only used, for now, in bureau/admin/adm_*add.php @@ -407,13 +409,6 @@ the domain "username.example.com". If this is set to 0 or a "false" string, it will be ignored.'); -INSERT IGNORE INTO `variable` (name, value, comment) VALUES ('rss_feed', 0, -'This is an RSS feed that will be displayed on the users homepages when -they log in. Set this to 0 or a "false" string to ignore.'); - -INSERT IGNORE INTO `variable` (name, value, comment) VALUES ('new_email', 0, -'An email will be sent to this address when new accounts are created if set.'); - INSERT IGNORE INTO `variable` (name, value, comment) VALUES ('mailname_bounce', '', 'FQDN of the mail server, used to create vhost virtual mail_adress.');