Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-10-05 15:05:47 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-10-05 15:05:47 +0400
commit5a1eab97f54b44f57356b4276b9c9df2a8eef51b (patch)
tree83864ece2806ccf6e6bb49abf3fd65de92c13ad8 /core/Option.php
parent19bcd2d262343eae9d553378e4c66ce7e033b4d8 (diff)
refs #5940 put tests in correct folders, better testsuite names, some tests still fail and I cannot figure out why
Diffstat (limited to 'core/Option.php')
-rw-r--r--core/Option.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/core/Option.php b/core/Option.php
index c4410520ea..d50e5c4235 100644
--- a/core/Option.php
+++ b/core/Option.php
@@ -139,6 +139,7 @@ class Option
if (self::$instance == null) {
self::$instance = new self;
}
+
return self::$instance;
}
@@ -162,6 +163,7 @@ class Option
if (isset($this->all[$name])) {
return $this->all[$name];
}
+
$value = Db::fetchOne('SELECT option_value FROM `' . Common::prefixTable('option') . '` ' .
'WHERE option_name = ?', $name);
@@ -176,10 +178,14 @@ class Option
protected function setValue($name, $value, $autoLoad = 0)
{
$autoLoad = (int)$autoLoad;
- Db::query('INSERT INTO `' . Common::prefixTable('option') . '` (option_name, option_value, autoload) ' .
- ' VALUES (?, ?, ?) ' .
- ' ON DUPLICATE KEY UPDATE option_value = ?',
- array($name, $value, $autoLoad, $value));
+
+ $sql = 'INSERT INTO `' . Common::prefixTable('option') . '` (option_name, option_value, autoload) ' .
+ ' VALUES (?, ?, ?) ' .
+ ' ON DUPLICATE KEY UPDATE option_value = ?';
+ $bind = array($name, $value, $autoLoad, $value);
+
+ Db::query($sql, $bind);
+
$this->all[$name] = $value;
}
@@ -217,11 +223,13 @@ class Option
{
$sql = 'SELECT option_name, option_value FROM `' . Common::prefixTable('option') . '` WHERE option_name LIKE ?';
$bind = array($name);
+ $rows = Db::fetchAll($sql, $bind);
$result = array();
- foreach (Db::fetchAll($sql, $bind) as $row) {
+ foreach ($rows as $row) {
$result[$row['option_name']] = $row['option_value'];
}
+
return $result;
}
@@ -236,8 +244,10 @@ class Option
return;
}
- $all = Db::fetchAll('SELECT option_value, option_name FROM `' . Common::prefixTable('option') . '`
- WHERE autoload = 1');
+ $table = Common::prefixTable('option');
+ $sql = 'SELECT option_value, option_name FROM `' . $table . '` WHERE autoload = 1';
+ $all = Db::fetchAll($sql);
+
foreach ($all as $option) {
$this->all[$option['option_name']] = $option['option_value'];
}