diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-04-14 17:53:02 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-04-14 17:53:02 +0200 |
commit | dec139716e7f93d25a7064ff03b2b68a51e3ebff (patch) | |
tree | 9dd560d8b11b36541eac7317686ce1665e8f6c3a /lib/appconfig.php | |
parent | 5608867edc0c4c7c9135f78800e6a199bfec7ada (diff) | |
download | nextcloud-server-dec139716e7f93d25a7064ff03b2b68a51e3ebff.tar.gz nextcloud-server-dec139716e7f93d25a7064ff03b2b68a51e3ebff.zip |
cache app types in the db
Diffstat (limited to 'lib/appconfig.php')
-rw-r--r-- | lib/appconfig.php | 34 |
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; + } } |