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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-04-14 19:53:02 +0400
committerRobin Appelman <icewind@owncloud.com>2012-04-14 19:53:02 +0400
commitdec139716e7f93d25a7064ff03b2b68a51e3ebff (patch)
tree9dd560d8b11b36541eac7317686ce1665e8f6c3a /lib/appconfig.php
parent5608867edc0c4c7c9135f78800e6a199bfec7ada (diff)
cache app types in the db
Diffstat (limited to 'lib/appconfig.php')
-rw-r--r--lib/appconfig.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/appconfig.php b/lib/appconfig.php
index 2b5cef59adc..5aaaadd9c4a 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -163,4 +163,38 @@ class OC_Appconfig{
return true;
}
+
+ /**
+ * get multiply values, either the app or key can be used as wildcard by setting it to false
+ * @param app
+ * @param key
+ * @return array
+ */
+ public static function getValues($app,$key){
+ if($app!==false and $key!==false){
+ return false;
+ }
+ $where='WHERE';
+ $fields='configvalue';
+ $params=array();
+ if($app!==false){
+ $where.=' appid = ?';
+ $fields.=', configkey';
+ $params[]=$app;
+ $key='configkey';
+ }else{
+ $fields.=', appid';
+ $where.=' configkey = ?';
+ $params[]=$key;
+ $key='appid';
+ }
+ $queryString='SELECT '.$fields.' FROM *PREFIX*appconfig '.$where;
+ $query=OC_DB::prepare($queryString);
+ $result=$query->execute($params);
+ $values=array();
+ while($row=$result->fetchRow()){
+ $values[$row[$key]]=$row['configvalue'];
+ }
+ return $values;
+ }
}