]> source.dussan.org Git - nextcloud-server.git/commitdiff
Simplify AppConfig->getValues()
authorRobin Appelman <icewind@owncloud.com>
Sun, 1 Jun 2014 12:14:30 +0000 (14:14 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sun, 1 Jun 2014 12:14:30 +0000 (14:14 +0200)
lib/private/appconfig.php

index d4ad20816eb0eb9ea2b2866769a88f58672eea06..196d04aa9a506a73d27da4b3858ced318d7ac758 100644 (file)
@@ -251,28 +251,18 @@ class AppConfig implements \OCP\IAppConfig {
                        return false;
                }
 
-               $fields = '`configvalue`';
-               $where = 'WHERE';
-               $params = array();
                if ($app !== false) {
-                       $fields .= ', `configkey`';
-                       $where .= ' `appid` = ?';
-                       $params[] = $app;
-                       $key = 'configkey';
+                       return $this->getAppValues($app);
                } else {
-                       $fields .= ', `appid`';
-                       $where .= ' `configkey` = ?';
-                       $params[] = $key;
-                       $key = 'appid';
-               }
-               $query = 'SELECT ' . $fields . ' FROM `*PREFIX*appconfig` ' . $where;
-               $result = $this->conn->executeQuery($query, $params);
+                       $query = 'SELECT `configvalue`, `appid` FROM `*PREFIX*appconfig` WHERE `configkey` = ?';
+                       $result = $this->conn->executeQuery($query, array($key));
 
-               $values = array();
-               while ($row = $result->fetch((\PDO::FETCH_ASSOC))) {
-                       $values[$row[$key]] = $row['configvalue'];
-               }
+                       $values = array();
+                       while ($row = $result->fetch((\PDO::FETCH_ASSOC))) {
+                               $values[$row['appid']] = $row['configvalue'];
+                       }
 
-               return $values;
+                       return $values;
+               }
        }
 }