Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>tags/v14.0.0beta1
@@ -62,8 +62,8 @@ class ApiTest extends TestCase { | |||
protected function setUp() { | |||
parent::setUp(); | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'no'); | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_expire_after_n_days', '7'); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_expire_after_n_days', '7'); | |||
$this->folder = self::TEST_FOLDER_NAME; | |||
$this->subfolder = '/subfolder_share_api_test'; | |||
@@ -239,8 +239,8 @@ class ApiTest extends TestCase { | |||
function testEnfoceLinkPassword() { | |||
$password = md5(time()); | |||
$appConfig = \OC::$server->getAppConfig(); | |||
$appConfig->setValue('core', 'shareapi_enforce_links_password', 'yes'); | |||
$config = \OC::$server->getConfig(); | |||
$config->setAppValue('core', 'shareapi_enforce_links_password', 'yes'); | |||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); | |||
try { | |||
@@ -287,7 +287,7 @@ class ApiTest extends TestCase { | |||
$ocs->deleteShare($data['id']); | |||
$ocs->cleanup(); | |||
$appConfig->setValue('core', 'shareapi_enforce_links_password', 'no'); | |||
$config->setAppValue('core', 'shareapi_enforce_links_password', 'no'); | |||
} | |||
/** | |||
@@ -296,7 +296,7 @@ class ApiTest extends TestCase { | |||
function testSharePermissions() { | |||
// sharing file to a user should work if shareapi_exclude_groups is set | |||
// to no | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'no'); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); | |||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); | |||
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); | |||
@@ -311,8 +311,8 @@ class ApiTest extends TestCase { | |||
$ocs->cleanup(); | |||
// exclude groups, but not the group the user belongs to. Sharing should still work | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'yes'); | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', 'admin,group1,group2'); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'yes'); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', 'admin,group1,group2'); | |||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); | |||
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); | |||
@@ -327,15 +327,15 @@ class ApiTest extends TestCase { | |||
$ocs->cleanup(); | |||
// now we exclude the group the user belongs to ('group'), sharing should fail now | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', 'admin,group'); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', 'admin,group'); | |||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); | |||
$ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); | |||
$ocs->cleanup(); | |||
// cleanup | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'no'); | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', ''); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', ''); | |||
} | |||
@@ -163,7 +163,7 @@ class AllConfig implements \OCP\IConfig { | |||
* @param string|float|int $value the value that should be stored | |||
*/ | |||
public function setAppValue($appName, $key, $value) { | |||
\OC::$server->getAppConfig()->setValue($appName, $key, $value); | |||
\OC::$server->query(\OC\AppConfig::class)->setValue($appName, $key, $value); | |||
} | |||
/** |
@@ -162,7 +162,6 @@ class AppConfig implements IAppConfig { | |||
* @param string $key key | |||
* @param string|float|int $value value | |||
* @return bool True if the value was inserted or updated, false if the value was the same | |||
* @deprecated 8.0.0 use method setAppValue of \OCP\IConfig | |||
*/ | |||
public function setValue($app, $key, $value) { | |||
if (!$this->hasKey($app, $key)) { |
@@ -298,12 +298,12 @@ class OC_App { | |||
$appData['types'] = []; | |||
} | |||
\OC::$server->getAppConfig()->setValue($app, 'types', $appTypes); | |||
\OC::$server->getConfig()->setAppValue($app, 'types', $appTypes); | |||
if (\OC::$server->getAppManager()->hasProtectedAppType($appData['types'])) { | |||
$enabled = \OC::$server->getConfig()->getAppValue($app, 'enabled', 'yes'); | |||
if ($enabled !== 'yes' && $enabled !== 'no') { | |||
\OC::$server->getAppConfig()->setValue($app, 'enabled', 'yes'); | |||
\OC::$server->getConfig()->setAppValue($app, 'enabled', 'yes'); | |||
} | |||
} | |||
} | |||
@@ -1075,7 +1075,7 @@ class OC_App { | |||
self::setAppTypes($appId); | |||
$version = \OC_App::getAppVersion($appId); | |||
\OC::$server->getAppConfig()->setValue($appId, 'installed_version', $version); | |||
\OC::$server->getConfig()->setAppValue($appId, 'installed_version', $version); | |||
\OC::$server->getEventDispatcher()->dispatch(ManagerEvent::EVENT_APP_UPDATE, new ManagerEvent( | |||
ManagerEvent::EVENT_APP_UPDATE, $appId |
@@ -59,19 +59,6 @@ interface IAppConfig { | |||
*/ | |||
public function getFilteredValues($app); | |||
/** | |||
* sets a value in the appconfig | |||
* @param string $app app | |||
* @param string $key key | |||
* @param string|float|int $value value | |||
* @deprecated 8.0.0 use method setAppValue of \OCP\IConfig | |||
* | |||
* Sets a value. If the key did not exist before it will be created. | |||
* @return void | |||
* @since 7.0.0 | |||
*/ | |||
public function setValue($app, $key, $value); | |||
/** | |||
* Get all apps using the config | |||
* @return array an array of app ids |
@@ -71,7 +71,7 @@ if($username) { | |||
if($quota === 'default') {//'default' as default quota makes no sense | |||
$quota='none'; | |||
} | |||
\OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota); | |||
\OC::$server->getConfig()->setAppValue('files', 'default_quota', $quota); | |||
} | |||
OC_JSON::success(array("data" => array( "username" => $username , 'quota' => $quota))); | |||
@@ -104,7 +104,7 @@ class ShareTest extends \Test\TestCase { | |||
\OC_Hook::clear('OCP\\Share'); | |||
\OC::registerShareHooks(); | |||
$this->resharing = \OC::$server->getConfig()->getAppValue('core', 'shareapi_allow_resharing', 'yes'); | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes'); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_allow_resharing', 'yes'); | |||
// 20 Minutes in the past, 20 minutes in the future. | |||
$now = time(); | |||
@@ -116,7 +116,7 @@ class ShareTest extends \Test\TestCase { | |||
protected function tearDown() { | |||
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?'); | |||
$query->execute(array('test')); | |||
\OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', $this->resharing); | |||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_allow_resharing', $this->resharing); | |||
$this->user1->delete(); | |||
$this->user2->delete(); |