]> source.dussan.org Git - nextcloud-server.git/commitdiff
move some deprecated usage of OC_Config and OC_AppConfig to \OC::server
authorThomas Müller <thomas.mueller@tmit.eu>
Fri, 17 Oct 2014 10:08:31 +0000 (12:08 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 20 Oct 2014 12:44:44 +0000 (14:44 +0200)
apps/files_sharing/ajax/list.php
apps/files_sharing/tests/api.php
core/ajax/appconfig.php
cron.php
lib/base.php

index 93964c5ed5bdc0b45b6b5c07c9afaadf5e43b8c5..7e2e54a1bd95544ed18e17898fbce26593aeecda 100644 (file)
@@ -76,7 +76,7 @@ $data['dirToken'] = $linkItem['token'];
 $permissions = $linkItem['permissions'];
 
 // if globally disabled
-if (OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
+if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
        // only allow reading
        $permissions = \OCP\PERMISSION_READ;
 }
index fd3d25564b6c1c619d868d0d599c05766f436f37..035aa1b6a5bede5a074482b6b4c2ca26bfbd33e2 100644 (file)
@@ -180,7 +180,7 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
 
                // sharing file to a user should work if shareapi_exclude_groups is set
                // to no
-               \OC_Appconfig::setValue('core', 'shareapi_exclude_groups', 'no');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'no');
                $_POST['path'] = $this->filename;
                $_POST['shareWith'] = \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2;
                $_POST['shareType'] = \OCP\Share::SHARE_TYPE_USER;
@@ -204,8 +204,8 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
                $this->assertTrue($result);
 
                // exclude groups, but not the group the user belongs to. Sharing should still work
-               \OC_Appconfig::setValue('core', 'shareapi_exclude_groups', 'yes');
-               \OC_Appconfig::setValue('core', 'shareapi_exclude_groups_list', 'admin,group1,group2');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'yes');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', 'admin,group1,group2');
 
                $_POST['path'] = $this->filename;
                $_POST['shareWith'] = \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2;
@@ -230,7 +230,7 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
                $this->assertTrue($result);
 
                // now we exclude the group the user belongs to ('group'), sharing should fail now
-               \OC_Appconfig::setValue('core', 'shareapi_exclude_groups_list', 'admin,group');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', 'admin,group');
 
                $_POST['path'] = $this->filename;
                $_POST['shareWith'] = \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2;
@@ -241,8 +241,8 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
                $this->assertFalse($result->succeeded());
 
                // cleanup
-               \OC_Appconfig::setValue('core', 'shareapi_exclude_groups', 'no');
-               \OC_Appconfig::setValue('core', 'shareapi_exclude_groups_list', '');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'no');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', '');
        }
 
 
@@ -1209,9 +1209,9 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
 
        public function testDefaultExpireDate() {
                \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
-               \OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes');
-               \OC_Appconfig::setValue('core', 'shareapi_enforce_expire_date', 'yes');
-               \OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'yes');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'yes');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_expire_after_n_days', '2');
 
                // default expire date is set to 2 days
                // the time when the share was created is set to 3 days in the past
@@ -1255,8 +1255,8 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
                //cleanup
                $result = \OCP\Share::unshare('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
                $this->assertTrue($result);
-               \OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'no');
-               \OC_Appconfig::setValue('core', 'shareapi_enforce_expire_date', 'no');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'no');
+               \OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'no');
 
        }
 }
index 05b7572c6d76c5d9abb8725e4cf7451cf7bd771f..7d73185dae6a3320ae6f6020981210b3abc0dab4 100644 (file)
@@ -24,27 +24,28 @@ if($app === 'core' && isset($_POST['key']) &&(substr($_POST['key'],0,7) === 'rem
 }
 
 $result=false;
+$appConfig = \OC::$server->getAppConfig();
 switch($action) {
        case 'getValue':
-               $result=OC_Appconfig::getValue($app, $_GET['key'], $_GET['defaultValue']);
+               $result=$appConfig->getValue($app, $_GET['key'], $_GET['defaultValue']);
                break;
        case 'setValue':
-               $result=OC_Appconfig::setValue($app, $_POST['key'], $_POST['value']);
+               $result=$appConfig->setValue($app, $_POST['key'], $_POST['value']);
                break;
        case 'getApps':
-               $result=OC_Appconfig::getApps();
+               $result=$appConfig->getApps();
                break;
        case 'getKeys':
-               $result=OC_Appconfig::getKeys($app);
+               $result=$appConfig->getKeys($app);
                break;
        case 'hasKey':
-               $result=OC_Appconfig::hasKey($app, $_GET['key']);
+               $result=$appConfig->hasKey($app, $_GET['key']);
                break;
        case 'deleteKey':
-               $result=OC_Appconfig::deleteKey($app, $_POST['key']);
+               $result=$appConfig->deleteKey($app, $_POST['key']);
                break;
        case 'deleteApp':
-               $result=OC_Appconfig::deleteApp($app);
+               $result=$appConfig->deleteApp($app);
                break;
 }
 OC_JSON::success(array('data'=>$result));
index e77cc885aba79d48949f12fc2e6b4922f29f78b6..8344e5516801fb6d3d9fd91f4adee1e96365004b 100644 (file)
--- a/cron.php
+++ b/cron.php
@@ -132,9 +132,9 @@ try {
 
        // done!
        TemporaryCronClass::$sent = true;
-       // Log the successfull cron exec
-       if (OC_Config::getValue('cron_log', true)) {
-               OC_Appconfig::setValue('core', 'lastcron', time());
+       // Log the successful cron execution
+       if (\OC::$server->getConfig()->getSystemValue('cron_log', true)) {
+               \OC::$server->getAppConfig()->setValue('core', 'lastcron', time());
        }
        exit();
 
index 0086531e52348119f3484ca71d98bf23455273de..5ba8d3829ca142747c64eeaeb3c8b4dac62a5aeb 100644 (file)
@@ -573,7 +573,7 @@ class OC {
                register_shutdown_function(array('OC_Helper', 'cleanTmp'));
 
                if (OC_Config::getValue('installed', false) && !self::checkUpgrade(false)) {
-                       if (OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
+                       if (\OC::$server->getAppConfig()->getValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
                                OC_Util::addScript('backgroundjobs');
                        }
                }