private $appsLoaded = array();
+ /**
+ * @var string[]
+ */
+ private $apps = null;
+
/**
* @param \OC\DB\Connection $conn
*/
/**
* Get all apps using the config
+ *
* @return array an array of app ids
*
* This function returns a list of all apps that have at least one
* entry in the appconfig table.
*/
public function getApps() {
+ if (is_array($this->apps)) {
+ return $this->apps;
+ }
$query = 'SELECT DISTINCT `appid` FROM `*PREFIX*appconfig` ORDER BY `appid`';
$result = $this->conn->executeQuery($query);
while ($appid = $result->fetchColumn()) {
$apps[] = $appid;
}
+ $this->apps = $apps;
return $apps;
}
/**
* Get the available keys for an app
+ *
* @param string $app the app we are looking for
* @return array an array of key names
*
/**
* Gets the config value
+ *
* @param string $app app
* @param string $key key
* @param string $default = null, default value if the key does not exist
/**
* check if a key is set in the appconfig
+ *
* @param string $app
* @param string $key
* @return bool
/**
* sets a value in the appconfig
+ *
* @param string $app app
* @param string $key key
* @param string $value value
if (!isset($this->cache[$app])) {
$this->cache[$app] = array();
}
+ if (is_array($this->apps) and array_search($app, $this->apps) === false) {
+ $this->apps[] = $app;
+ }
$this->cache[$app][$key] = $value;
}
/**
* Deletes a key
+ *
* @param string $app app
* @param string $key key
* @return boolean|null
/**
* Remove app from appconfig
+ *
* @param string $app app
* @return boolean|null
*
);
$this->conn->delete('*PREFIX*appconfig', $where);
unset($this->cache[$app]);
+ if (is_array($this->apps) and $i = array_search($app, $this->apps) !== false) {
+ unset($this->apps[$i]);
+ }
+ $this->apps = null;
}
/**