summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-07-03 14:16:29 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-07-03 18:00:16 +0200
commit1385b1ec487d1ce97ca520247bc32e35b23d837b (patch)
tree55fb9e10a6c0569c3f53a2b46649a17dd65281b3 /lib
parentd3ac73c0c9419750c65d3ccb8f0b0c25edacf34f (diff)
downloadnextcloud-server-1385b1ec487d1ce97ca520247bc32e35b23d837b.tar.gz
nextcloud-server-1385b1ec487d1ce97ca520247bc32e35b23d837b.zip
Remove OC_Appconfig
Diffstat (limited to 'lib')
-rw-r--r--lib/private/app.php14
-rw-r--r--lib/private/installer.php18
-rw-r--r--lib/private/legacy/appconfig.php131
-rw-r--r--lib/private/share/share.php10
-rw-r--r--lib/private/util.php6
5 files changed, 24 insertions, 155 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index 8062debef5f..1e49fdc6010 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -168,7 +168,7 @@ class OC_App {
private static function getAppTypes($app) {
//load the cache
if (count(self::$appTypes) == 0) {
- self::$appTypes = OC_Appconfig::getValues(false, 'types');
+ self::$appTypes = \OC::$server->getAppConfig()->getValues(false, 'types');
}
if (isset(self::$appTypes[$app])) {
@@ -190,7 +190,7 @@ class OC_App {
$appTypes = '';
}
- OC_Appconfig::setValue($app, 'types', $appTypes);
+ \OC::$server->getAppConfig()->setValue($app, 'types', $appTypes);
}
/**
@@ -821,7 +821,7 @@ class OC_App {
continue;
}
- $enabled = OC_Appconfig::getValue($app, 'enabled', 'no');
+ $enabled = \OC::$server->getAppConfig()->getValue($app, 'enabled', 'no');
$info['groups'] = null;
if ($enabled === 'yes') {
$active = true;
@@ -1173,9 +1173,9 @@ class OC_App {
//set remote/public handlers
$appData = self::getAppInfo($appId);
if (array_key_exists('ocsid', $appData)) {
- OC_Appconfig::setValue($appId, 'ocsid', $appData['ocsid']);
- } elseif(OC_Appconfig::getValue($appId, 'ocsid', null) !== null) {
- OC_Appconfig::deleteKey($appId, 'ocsid');
+ \OC::$server->getAppConfig()->setValue($appId, 'ocsid', $appData['ocsid']);
+ } elseif(\OC::$server->getAppConfig()->getValue($appId, 'ocsid', null) !== null) {
+ \OC::$server->getAppConfig()->deleteKey($appId, 'ocsid');
}
foreach ($appData['remote'] as $name => $path) {
OCP\CONFIG::setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
@@ -1187,7 +1187,7 @@ class OC_App {
self::setAppTypes($appId);
$version = \OC_App::getAppVersion($appId);
- \OC_Appconfig::setValue($appId, 'installed_version', $version);
+ \OC::$server->getAppConfig()->setValue($appId, 'installed_version', $version);
return true;
}
diff --git a/lib/private/installer.php b/lib/private/installer.php
index 2da525d3ed7..37af8d0edcb 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -114,7 +114,7 @@ class OC_Installer{
//install the database
if(is_file($basedir.'/appinfo/database.xml')) {
- if (OC_Appconfig::getValue($info['id'], 'installed_version') === null) {
+ if (\OC::$server->getAppConfig()->getValue($info['id'], 'installed_version') === null) {
OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml');
} else {
OC_DB::updateDbFromStructure($basedir.'/appinfo/database.xml');
@@ -127,8 +127,8 @@ class OC_Installer{
}
//set the installed version
- OC_Appconfig::setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
- OC_Appconfig::setValue($info['id'], 'enabled', 'no');
+ \OC::$server->getAppConfig()->setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
+ \OC::$server->getAppConfig()->setValue($info['id'], 'enabled', 'no');
//set remote/public handelers
foreach($info['remote'] as $name=>$path) {
@@ -151,7 +151,7 @@ class OC_Installer{
* Checks whether or not an app is installed, i.e. registered in apps table.
*/
public static function isInstalled( $app ) {
- return (OC_Appconfig::getValue($app, "installed_version") !== null);
+ return (\OC::$server->getAppConfig()->getValue($app, "installed_version") !== null);
}
/**
@@ -184,7 +184,7 @@ class OC_Installer{
* -# setting the installed version
*
* upgrade.php can determine the current installed version of the app using
- * "OC_Appconfig::getValue($appid, 'installed_version')"
+ * "\OC::$server->getAppConfig()->getValue($appid, 'installed_version')"
*/
public static function updateApp( $info=array(), $isShipped=false) {
list($extractDir, $path) = self::downloadApp($info);
@@ -387,7 +387,7 @@ class OC_Installer{
return false;
}
- $ocsid=OC_Appconfig::getValue( $app, 'ocsid', '');
+ $ocsid=\OC::$server->getAppConfig()->getValue( $app, 'ocsid', '');
if($ocsid<>'') {
$ocsClient = new OCSClient(
@@ -503,7 +503,7 @@ class OC_Installer{
$enabled = isset($info['default_enable']);
if( $enabled ) {
OC_Installer::installShippedApp($filename);
- OC_Appconfig::setValue($filename, 'enabled', 'yes');
+ \OC::$server->getAppConfig()->setValue($filename, 'enabled', 'yes');
}
}
}
@@ -533,9 +533,9 @@ class OC_Installer{
if (is_null($info)) {
return false;
}
- OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
+ \OC::$server->getAppConfig()->setValue($app, 'installed_version', OC_App::getAppVersion($app));
if (array_key_exists('ocsid', $info)) {
- OC_Appconfig::setValue($app, 'ocsid', $info['ocsid']);
+ \OC::$server->getAppConfig()->setValue($app, 'ocsid', $info['ocsid']);
}
//set remote/public handlers
diff --git a/lib/private/legacy/appconfig.php b/lib/private/legacy/appconfig.php
deleted file mode 100644
index 54e568d9ff6..00000000000
--- a/lib/private/legacy/appconfig.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
- * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
- * @author Vincent Petry <pvince81@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * This class provides an easy way for apps to store config values in the
- * database.
- *
- * @deprecated use \OC::$server->getAppConfig() to get an \OCP\IAppConfig instance
- */
-class OC_Appconfig {
- /**
- * @return \OCP\IAppConfig
- */
- private static function getAppConfig() {
- return \OC::$server->getAppConfig();
- }
-
- /**
- * 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 static function getApps() {
- return self::getAppConfig()->getApps();
- }
-
- /**
- * Get the available keys for an app
- * @param string $app the app we are looking for
- * @return array an array of key names
- *
- * This function gets all keys of an app. Please note that the values are
- * not returned.
- */
- public static function getKeys($app) {
- return self::getAppConfig()->getKeys($app);
- }
-
- /**
- * Gets the config value
- * @param string $app app
- * @param string $key key
- * @param string $default = null, default value if the key does not exist
- * @return string the value or $default
- *
- * This function gets a value from the appconfig table. If the key does
- * not exist the default value will be returned
- */
- public static function getValue($app, $key, $default = null) {
- return self::getAppConfig()->getValue($app, $key, $default);
- }
-
- /**
- * check if a key is set in the appconfig
- * @param string $app
- * @param string $key
- * @return bool
- */
- public static function hasKey($app, $key) {
- return self::getAppConfig()->hasKey($app, $key);
- }
-
- /**
- * sets a value in the appconfig
- * @param string $app app
- * @param string $key key
- * @param string $value value
- *
- * Sets a value. If the key did not exist before it will be created.
- */
- public static function setValue($app, $key, $value) {
- self::getAppConfig()->setValue($app, $key, $value);
- }
-
- /**
- * Deletes a key
- * @param string $app app
- * @param string $key key
- *
- * Deletes a key.
- */
- public static function deleteKey($app, $key) {
- self::getAppConfig()->deleteKey($app, $key);
- }
-
- /**
- * Remove app from appconfig
- * @param string $app app
- *
- * Removes all keys in appconfig belonging to the app.
- */
- public static function deleteApp($app) {
- self::getAppConfig()->deleteApp($app);
- }
-
- /**
- * get multiply values, either the app or key can be used as wildcard by setting it to false
- *
- * @param string|false $app
- * @param string|false $key
- * @return array
- */
- public static function getValues($app, $key) {
- return self::getAppConfig()->getValues($app, $key);
- }
-}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 5d2e3b74da1..14909c6f8ce 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -102,7 +102,7 @@ class Share extends Constants {
* The Share API is enabled by default if not configured
*/
public static function isEnabled() {
- if (\OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes') == 'yes') {
return true;
}
return false;
@@ -703,7 +703,7 @@ class Share extends Constants {
$shareWith['users'] = array_diff(\OC_Group::usersInGroup($group), array($uidOwner));
} else if ($shareType === self::SHARE_TYPE_LINK) {
$updateExistingShare = false;
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes') == 'yes') {
// when updating a link share
// FIXME Don't delete link if we update it
@@ -1365,7 +1365,7 @@ class Share extends Constants {
*/
public static function isResharingAllowed() {
if (!isset(self::$isResharingAllowed)) {
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes') == 'yes') {
self::$isResharingAllowed = true;
} else {
self::$isResharingAllowed = false;
@@ -1509,7 +1509,7 @@ class Share extends Constants {
$queryArgs = array($itemType);
}
}
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
$where .= ' AND `share_type` != ?';
$queryArgs[] = self::SHARE_TYPE_LINK;
}
@@ -2504,7 +2504,7 @@ class Share extends Constants {
* @return bool
*/
public static function shareWithGroupMembersOnly() {
- $value = \OC_Appconfig::getValue('core', 'shareapi_only_share_with_group_members', 'no');
+ $value = \OC::$server->getAppConfig()->getValue('core', 'shareapi_only_share_with_group_members', 'no');
return ($value === 'yes') ? true : false;
}
diff --git a/lib/private/util.php b/lib/private/util.php
index 8dbb2622142..51815a0ae3d 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -212,9 +212,9 @@ class OC_Util {
* @return boolean
*/
public static function isSharingDisabledForUser() {
- if (\OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
$user = \OCP\User::getUser();
- $groupsList = \OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', '');
+ $groupsList = \OC::$server->getAppConfig()->getValue('core', 'shareapi_exclude_groups_list', '');
$excludedGroups = explode(',', $groupsList);
$usersGroups = \OC_Group::getUserGroups($user);
if (!empty($usersGroups)) {
@@ -999,7 +999,7 @@ class OC_Util {
if (isset($_REQUEST['redirect_url']) && strpos($_REQUEST['redirect_url'], '@') === false) {
$location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url']));
} else {
- $defaultPage = OC_Appconfig::getValue('core', 'defaultpage');
+ $defaultPage = \OC::$server->getAppConfig()->getValue('core', 'defaultpage');
if ($defaultPage) {
$location = $urlGenerator->getAbsoluteURL($defaultPage);
} else {