/** * get the types of an app * * @param string $app * @return array */ private static function getAppTypes($app) { //load the cache if (count(self::$appTypes) == 0) { self::$appTypes = OC_Appconfig::getValues(false, 'types'); } if (isset(self::$appTypes[$app])) { return explode(',', self::$appTypes[$app]); } else { return array(); } }
public function testGetValues() { $this->assertFalse(\OC_Appconfig::getValues('testapp', 'enabled')); $query = \OC_DB::prepare('SELECT `configkey`, `configvalue` FROM `*PREFIX*appconfig` WHERE `appid` = ?'); $query->execute(array('testapp')); $expected = array(); while ($row = $query->fetchRow()) { $expected[$row['configkey']] = $row['configvalue']; } $values = \OC_Appconfig::getValues('testapp', false); $this->assertEquals($expected, $values); $query = \OC_DB::prepare('SELECT `appid`, `configvalue` FROM `*PREFIX*appconfig` WHERE `configkey` = ?'); $query->execute(array('enabled')); $expected = array(); while ($row = $query->fetchRow()) { $expected[$row['appid']] = $row['configvalue']; } $values = \OC_Appconfig::getValues(false, 'enabled'); $this->assertEquals($expected, $values); }