reduce OC_Preferences, OC_Config and \OCP\Config usage

* files_encryption
* files_versions
* files_trashbin
* tests
* status.php
* core
* server container
This commit is contained in:
Morris Jobke 2014-12-04 16:48:07 +01:00
parent 2d5fc9c1a6
commit 0d4f0ab871
21 changed files with 70 additions and 49 deletions

View File

@ -502,7 +502,7 @@ class Hooks {
public static function preDisable($params) { public static function preDisable($params) {
if ($params['app'] === 'files_encryption') { if ($params['app'] === 'files_encryption') {
\OC_Preferences::deleteAppFromAllUsers('files_encryption'); \OC::$server->getConfig()->deleteAppFromAllUsers('files_encryption');
$session = new \OCA\Encryption\Session(new \OC\Files\View('/')); $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
$session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED); $session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED);

View File

@ -225,7 +225,7 @@ class Util {
*/ */
public function recoveryEnabledForUser() { public function recoveryEnabledForUser() {
$recoveryMode = \OC_Preferences::getValue($this->userId, 'files_encryption', 'recovery_enabled', '0'); $recoveryMode = \OC::$server->getConfig()->getUserValue($this->userId, 'files_encryption', 'recovery_enabled', '0');
return ($recoveryMode === '1') ? true : false; return ($recoveryMode === '1') ? true : false;
@ -239,7 +239,12 @@ class Util {
public function setRecoveryForUser($enabled) { public function setRecoveryForUser($enabled) {
$value = $enabled ? '1' : '0'; $value = $enabled ? '1' : '0';
return \OC_Preferences::setValue($this->userId, 'files_encryption', 'recovery_enabled', $value); try {
\OC::$server->getConfig()->setUserValue($this->userId, 'files_encryption', 'recovery_enabled', $value);
return true;
} catch(\OCP\PreConditionNotMetException $e) {
return false;
}
} }
@ -1102,7 +1107,12 @@ class Util {
// convert to string if preCondition is set // convert to string if preCondition is set
$preCondition = ($preCondition === null) ? null : (string)$preCondition; $preCondition = ($preCondition === null) ? null : (string)$preCondition;
return \OC_Preferences::setValue($this->userId, 'files_encryption', 'migration_status', (string)$status, $preCondition); try {
\OC::$server->getConfig()->setUserValue($this->userId, 'files_encryption', 'migration_status', (string)$status, $preCondition);
return true;
} catch(\OCP\PreConditionNotMetException $e) {
return false;
}
} }
@ -1154,9 +1164,9 @@ class Util {
$migrationStatus = false; $migrationStatus = false;
if (\OCP\User::userExists($this->userId)) { if (\OCP\User::userExists($this->userId)) {
$migrationStatus = \OC_Preferences::getValue($this->userId, 'files_encryption', 'migration_status'); $migrationStatus = \OC::$server->getConfig()->getUserValue($this->userId, 'files_encryption', 'migration_status', null);
if ($migrationStatus === null) { if ($migrationStatus === null) {
\OC_Preferences::setValue($this->userId, 'files_encryption', 'migration_status', (string)self::MIGRATION_OPEN); \OC::$server->getConfig()->setUserValue($this->userId, 'files_encryption', 'migration_status', (string)self::MIGRATION_OPEN);
$migrationStatus = self::MIGRATION_OPEN; $migrationStatus = self::MIGRATION_OPEN;
} }
} }

View File

@ -617,7 +617,9 @@ class Test_Encryption_Util extends \OCA\Files_Encryption\Tests\TestCase {
* @return boolean * @return boolean
*/ */
private function setMigrationStatus($status, $user) { private function setMigrationStatus($status, $user) {
return \OC_Preferences::setValue($user, 'files_encryption', 'migration_status', (string)$status); \OC::$server->getConfig()->setUserValue($user, 'files_encryption', 'migration_status', (string)$status);
// the update will definitely be executed -> return value is always true
return true;
} }
} }

View File

@ -621,11 +621,13 @@ class Trashbin {
* @return int available free space for trash bin * @return int available free space for trash bin
*/ */
private static function calculateFreeSpace($trashbinSize, $user) { private static function calculateFreeSpace($trashbinSize, $user) {
$config = \OC::$server->getConfig();
$softQuota = true; $softQuota = true;
$quota = \OC_Preferences::getValue($user, 'files', 'quota'); $quota = $config->getUserValue($user, 'files', 'quota', null);
$view = new \OC\Files\View('/' . $user); $view = new \OC\Files\View('/' . $user);
if ($quota === null || $quota === 'default') { if ($quota === null || $quota === 'default') {
$quota = \OC::$server->getAppConfig()->getValue('files', 'default_quota'); $quota = $config->getAppValue('files', 'default_quota', null);
} }
if ($quota === null || $quota === 'none') { if ($quota === null || $quota === 'none') {
$quota = \OC\Files\Filesystem::free_space('/'); $quota = \OC\Files\Filesystem::free_space('/');

View File

@ -479,15 +479,16 @@ class Storage {
* Erase a file's versions which exceed the set quota * Erase a file's versions which exceed the set quota
*/ */
private static function expire($filename, $versionsSize = null, $offset = 0) { private static function expire($filename, $versionsSize = null, $offset = 0) {
if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { $config = \OC::$server->getConfig();
if($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
list($uid, $filename) = self::getUidAndFilename($filename); list($uid, $filename) = self::getUidAndFilename($filename);
$versionsFileview = new \OC\Files\View('/'.$uid.'/files_versions'); $versionsFileview = new \OC\Files\View('/'.$uid.'/files_versions');
// get available disk space for user // get available disk space for user
$softQuota = true; $softQuota = true;
$quota = \OC_Preferences::getValue($uid, 'files', 'quota'); $quota = $config->getUserValue($uid, 'files', 'quota', null);
if ( $quota === null || $quota === 'default') { if ( $quota === null || $quota === 'default') {
$quota = \OC::$server->getAppConfig()->getValue('files', 'default_quota'); $quota = $config->getAppValue('files', 'default_quota', null);
} }
if ( $quota === null || $quota === 'none' ) { if ( $quota === null || $quota === 'none' ) {
$quota = \OC\Files\Filesystem::free_space('/'); $quota = \OC\Files\Filesystem::free_space('/');

View File

@ -236,7 +236,7 @@ class OC {
$header = 'Strict-Transport-Security: max-age=31536000'; $header = 'Strict-Transport-Security: max-age=31536000';
// If SSL for subdomains is enabled add "; includeSubDomains" to the header // If SSL for subdomains is enabled add "; includeSubDomains" to the header
if(\OC::$server->getSystemConfig()->getmValue('forceSSLforSubdomains', false)) { if(\OC::$server->getSystemConfig()->getValue('forceSSLforSubdomains', false)) {
$header .= '; includeSubDomains'; $header .= '; includeSubDomains';
} }
header($header); header($header);

View File

@ -117,7 +117,7 @@ class AllConfig implements \OCP\IConfig {
* @param string $value the value that should be stored * @param string $value the value that should be stored
*/ */
public function setAppValue($appName, $key, $value) { public function setAppValue($appName, $key, $value) {
\OCP\Config::setAppValue($appName, $key, $value); \OC::$server->getAppConfig()->setValue($appName, $key, $value);
} }
/** /**
@ -129,7 +129,7 @@ class AllConfig implements \OCP\IConfig {
* @return string the saved value * @return string the saved value
*/ */
public function getAppValue($appName, $key, $default = '') { public function getAppValue($appName, $key, $default = '') {
return \OCP\Config::getAppValue($appName, $key, $default); return \OC::$server->getAppConfig()->getValue($appName, $key, $default);
} }
/** /**
@ -139,7 +139,7 @@ class AllConfig implements \OCP\IConfig {
* @param string $key the key of the value, under which it was saved * @param string $key the key of the value, under which it was saved
*/ */
public function deleteAppValue($appName, $key) { public function deleteAppValue($appName, $key) {
\OC_Appconfig::deleteKey($appName, $key); \OC::$server->getAppConfig()->deleteKey($appName, $key);
} }
/** /**
@ -148,7 +148,7 @@ class AllConfig implements \OCP\IConfig {
* @param string $appName the appName the configs are stored under * @param string $appName the appName the configs are stored under
*/ */
public function deleteAppValues($appName) { public function deleteAppValues($appName) {
\OC_Appconfig::deleteApp($appName); \OC::$server->getAppConfig()->deleteApp($appName);
} }

View File

@ -91,7 +91,7 @@ class OC_OCS_Cloud {
} }
public static function getCurrentUser() { public static function getCurrentUser() {
$email=OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', ''); $email=\OC::$server->getConfig()->getUserValue(OC_User::getUser(), 'settings', 'email', '');
$data = array( $data = array(
'id' => OC_User::getUser(), 'id' => OC_User::getUser(),
'display-name' => OC_User::getDisplayName(), 'display-name' => OC_User::getDisplayName(),

View File

@ -79,7 +79,7 @@ class MailNotifications {
foreach ($recipientList as $recipient) { foreach ($recipientList as $recipient) {
$recipientDisplayName = \OCP\User::getDisplayName($recipient); $recipientDisplayName = \OCP\User::getDisplayName($recipient);
$to = \OC_Preferences::getValue($recipient, 'settings', 'email', ''); $to = \OC::$server->getConfig()->getUserValue($recipient, 'settings', 'email', '');
if ($to === '') { if ($to === '') {
$noMail[] = $recipientDisplayName; $noMail[] = $recipientDisplayName;

View File

@ -211,15 +211,15 @@ class Session implements IUserSession, Emitter {
} }
// get stored tokens // get stored tokens
$tokens = \OC_Preferences::getKeys($uid, 'login_token'); $tokens = \OC::$server->getConfig()->getUserKeys($uid, 'login_token');
// test cookies token against stored tokens // test cookies token against stored tokens
if (!in_array($currentToken, $tokens, true)) { if (!in_array($currentToken, $tokens, true)) {
return false; return false;
} }
// replace successfully used token with a new one // replace successfully used token with a new one
\OC_Preferences::deleteKey($uid, 'login_token', $currentToken); \OC::$server->getConfig()->deleteUserValue($uid, 'login_token', $currentToken);
$newToken = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(32); $newToken = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(32);
\OC_Preferences::setValue($uid, 'login_token', $newToken, time()); \OC::$server->getConfig()->setUserValue($uid, 'login_token', $newToken, time());
$this->setMagicInCookie($user->getUID(), $newToken); $this->setMagicInCookie($user->getUID(), $newToken);
//login //login

View File

@ -68,10 +68,11 @@ class User implements IUser {
if ($this->config) { if ($this->config) {
$enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true'); $enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
$this->enabled = ($enabled === 'true'); $this->enabled = ($enabled === 'true');
$this->lastLogin = $this->config->getUserValue($uid, 'login', 'lastLogin', 0);
} else { } else {
$this->enabled = true; $this->enabled = true;
$this->lastLogin = \OC::$server->getConfig()->getUserValue($uid, 'login', 'lastLogin', 0);
} }
$this->lastLogin = \OC_Preferences::getValue($uid, 'login', 'lastLogin', 0);
} }
/** /**
@ -140,7 +141,7 @@ class User implements IUser {
*/ */
public function updateLastLoginTimestamp() { public function updateLastLoginTimestamp() {
$this->lastLogin = time(); $this->lastLogin = time();
\OC_Preferences::setValue( \OC::$server->getConfig()->setUserValue(
$this->uid, 'login', 'lastLogin', $this->lastLogin); $this->uid, 'login', 'lastLogin', $this->lastLogin);
} }
@ -163,7 +164,7 @@ class User implements IUser {
\OC_Group::removeFromGroup($this->uid, $i); \OC_Group::removeFromGroup($this->uid, $i);
} }
// Delete the user's keys in preferences // Delete the user's keys in preferences
\OC_Preferences::deleteUser($this->uid); \OC::$server->getConfig()->deleteAllUserValues($this->uid);
// Delete user files in /data/ // Delete user files in /data/
\OC_Helper::rmdirr(\OC_User::getHome($this->uid)); \OC_Helper::rmdirr(\OC_User::getHome($this->uid));

View File

@ -96,7 +96,7 @@ class Config {
* not exist the default value will be returned * not exist the default value will be returned
*/ */
public static function getAppValue( $app, $key, $default = null ) { public static function getAppValue( $app, $key, $default = null ) {
return \OC_Appconfig::getValue( $app, $key, $default ); return \OC::$server->getConfig()->getAppValue( $app, $key, $default );
} }
/** /**
@ -111,7 +111,7 @@ class Config {
*/ */
public static function setAppValue( $app, $key, $value ) { public static function setAppValue( $app, $key, $value ) {
try { try {
\OC_Appconfig::setValue( $app, $key, $value ); \OC::$server->getConfig()->setAppValue( $app, $key, $value );
} catch (\Exception $e) { } catch (\Exception $e) {
return false; return false;
} }

View File

@ -8,7 +8,7 @@ $l = \OC::$server->getL10N('settings');
// Get data // Get data
if( isset( $_POST['email'] ) && OC_Mail::validateAddress($_POST['email']) ) { if( isset( $_POST['email'] ) && OC_Mail::validateAddress($_POST['email']) ) {
$email=trim($_POST['email']); $email=trim($_POST['email']);
OC_Preferences::setValue(OC_User::getUser(), 'settings', 'email', $email); \OC::$server->getConfig()->setUserValue(OC_User::getUser(), 'settings', 'email', $email);
OC_JSON::success(array("data" => array( "message" => $l->t("Email saved") ))); OC_JSON::success(array("data" => array( "message" => $l->t("Email saved") )));
}else{ }else{
OC_JSON::error(array("data" => array( "message" => $l->t("Invalid email") ))); OC_JSON::error(array("data" => array( "message" => $l->t("Invalid email") )));

View File

@ -11,7 +11,7 @@ if( isset( $_POST['lang'] ) ) {
$languageCodes=OC_L10N::findAvailableLanguages(); $languageCodes=OC_L10N::findAvailableLanguages();
$lang=$_POST['lang']; $lang=$_POST['lang'];
if(array_search($lang, $languageCodes) or $lang === 'en') { if(array_search($lang, $languageCodes) or $lang === 'en') {
OC_Preferences::setValue( OC_User::getUser(), 'core', 'lang', $lang ); \OC::$server->getConfig()->setUserValue( OC_User::getUser(), 'core', 'lang', $lang );
OC_JSON::success(array("data" => array( "message" => $l->t("Language changed") ))); OC_JSON::success(array("data" => array( "message" => $l->t("Language changed") )));
}else{ }else{
OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") ))); OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));

View File

@ -27,7 +27,7 @@ if($quota !== 'none' and $quota !== 'default') {
// Return Success story // Return Success story
if($username) { if($username) {
OC_Preferences::setValue($username, 'files', 'quota', $quota); \OC::$server->getConfig()->setUserValue($username, 'files', 'quota', $quota);
}else{//set the default quota when no username is specified }else{//set the default quota when no username is specified
if($quota === 'default') {//'default' as default quota makes no sense if($quota === 'default') {//'default' as default quota makes no sense
$quota='none'; $quota='none';

View File

@ -9,6 +9,7 @@ OC_Util::checkLoggedIn();
$defaults = new OC_Defaults(); // initialize themable default strings and urls $defaults = new OC_Defaults(); // initialize themable default strings and urls
$certificateManager = \OC::$server->getCertificateManager(); $certificateManager = \OC::$server->getCertificateManager();
$config = \OC::$server->getConfig();
// Highlight navigation entry // Highlight navigation entry
OC_Util::addScript( 'settings', 'personal' ); OC_Util::addScript( 'settings', 'personal' );
@ -16,7 +17,7 @@ OC_Util::addStyle( 'settings', 'settings' );
\OC_Util::addVendorScript('strengthify/jquery.strengthify'); \OC_Util::addVendorScript('strengthify/jquery.strengthify');
\OC_Util::addVendorStyle('strengthify/strengthify'); \OC_Util::addVendorStyle('strengthify/strengthify');
\OC_Util::addScript('files', 'jquery.fileupload'); \OC_Util::addScript('files', 'jquery.fileupload');
if (\OC_Config::getValue('enable_avatars', true) === true) { if ($config->getSystemValue('enable_avatars', true) === true) {
\OC_Util::addVendorScript('jcrop/js/jquery.Jcrop'); \OC_Util::addVendorScript('jcrop/js/jquery.Jcrop');
\OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop'); \OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop');
} }
@ -26,9 +27,9 @@ OC_App::setActiveNavigationEntry( 'personal' );
$storageInfo=OC_Helper::getStorageInfo('/'); $storageInfo=OC_Helper::getStorageInfo('/');
$email=OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', ''); $email=$config->getUserValue(OC_User::getUser(), 'settings', 'email', '');
$userLang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() ); $userLang=$config->getUserValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
$languageCodes=OC_L10N::findAvailableLanguages(); $languageCodes=OC_L10N::findAvailableLanguages();
//check if encryption was enabled in the past //check if encryption was enabled in the past
@ -74,9 +75,9 @@ usort( $languages, function ($a, $b) {
//links to clients //links to clients
$clients = array( $clients = array(
'desktop' => OC_Config::getValue('customclient_desktop', $defaults->getSyncClientUrl()), 'desktop' => $config->getSystemValue('customclient_desktop', $defaults->getSyncClientUrl()),
'android' => OC_Config::getValue('customclient_android', $defaults->getAndroidClientUrl()), 'android' => $config->getSystemValue('customclient_android', $defaults->getAndroidClientUrl()),
'ios' => OC_Config::getValue('customclient_ios', $defaults->getiOSClientUrl()) 'ios' => $config->getSystemValue('customclient_ios', $defaults->getiOSClientUrl())
); );
// Return template // Return template
@ -95,7 +96,7 @@ $tmpl->assign('displayName', OC_User::getDisplayName());
$tmpl->assign('enableDecryptAll' , $enableDecryptAll); $tmpl->assign('enableDecryptAll' , $enableDecryptAll);
$tmpl->assign('backupKeysExists' , $backupKeysExists); $tmpl->assign('backupKeysExists' , $backupKeysExists);
$tmpl->assign('filesStillEncrypted' , $filesStillEncrypted); $tmpl->assign('filesStillEncrypted' , $filesStillEncrypted);
$tmpl->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true)); $tmpl->assign('enableAvatars', $config->getSystemValue('enable_avatars', true));
$tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser())); $tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser()));
$tmpl->assign('certs', $certificateManager->listCertificates()); $tmpl->assign('certs', $certificateManager->listCertificates());

View File

@ -21,6 +21,8 @@ $users = array();
$userManager = \OC_User::getManager(); $userManager = \OC_User::getManager();
$groupManager = \OC_Group::getManager(); $groupManager = \OC_Group::getManager();
$config = \OC::$server->getConfig();
$isAdmin = OC_User::isAdminUser(OC_User::getUser()); $isAdmin = OC_User::isAdminUser(OC_User::getUser());
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager); $groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
@ -28,7 +30,7 @@ $groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
list($adminGroup, $groups) = $groupsInfo->get(); list($adminGroup, $groups) = $groupsInfo->get();
$recoveryAdminEnabled = OC_App::isEnabled('files_encryption') && $recoveryAdminEnabled = OC_App::isEnabled('files_encryption') &&
OC_Appconfig::getValue( 'files_encryption', 'recoveryAdminEnabled' ); $config->getAppValue( 'files_encryption', 'recoveryAdminEnabled', null );
if($isAdmin) { if($isAdmin) {
$accessibleUsers = OC_User::getDisplayNames('', 30); $accessibleUsers = OC_User::getDisplayNames('', 30);
@ -59,7 +61,7 @@ $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false
// load users and quota // load users and quota
foreach($accessibleUsers as $uid => $displayName) { foreach($accessibleUsers as $uid => $displayName) {
$quota = OC_Preferences::getValue($uid, 'files', 'quota', 'default'); $quota = $config->getUserValue($uid, 'files', 'quota', 'default');
$isQuotaUserDefined = array_search($quota, $quotaPreset) === false $isQuotaUserDefined = array_search($quota, $quotaPreset) === false
&& array_search($quota, array('none', 'default')) === false; && array_search($quota, array('none', 'default')) === false;

View File

@ -25,8 +25,10 @@ try {
require_once 'lib/base.php'; require_once 'lib/base.php';
$installed = OC_Config::getValue('installed') == 1; $systemConfig = \OC::$server->getSystemConfig();
$maintenance = OC_Config::getValue('maintenance', false);
$installed = $systemConfig->getValue('installed') == 1;
$maintenance = $systemConfig->getValue('maintenance', false);
$values=array( $values=array(
'installed'=>$installed, 'installed'=>$installed,
'maintenance' => $maintenance, 'maintenance' => $maintenance,

View File

@ -45,7 +45,7 @@ class Test_Helper_Storage extends \Test\TestCase {
\OC_User::setUserId(''); \OC_User::setUserId('');
\OC_User::deleteUser($this->user); \OC_User::deleteUser($this->user);
\OC_Preferences::deleteUser($this->user); \OC::$server->getConfig()->deleteAllUserValues($this->user);
parent::tearDown(); parent::tearDown();
} }

View File

@ -234,7 +234,7 @@ class Session extends \Test\TestCase {
//prepare login token //prepare login token
$token = 'goodToken'; $token = 'goodToken';
\OC_Preferences::setValue('foo', 'login_token', $token, time()); \OC::$server->getConfig()->setUserValue('foo', 'login_token', $token, time());
$userSession = $this->getMock( $userSession = $this->getMock(
'\OC\User\Session', '\OC\User\Session',
@ -282,7 +282,7 @@ class Session extends \Test\TestCase {
//prepare login token //prepare login token
$token = 'goodToken'; $token = 'goodToken';
\OC_Preferences::setValue('foo', 'login_token', $token, time()); \OC::$server->getConfig()->setUserValue('foo', 'login_token', $token, time());
$userSession = new \OC\User\Session($manager, $session); $userSession = new \OC\User\Session($manager, $session);
$granted = $userSession->loginWithCookie('foo', 'badToken'); $granted = $userSession->loginWithCookie('foo', 'badToken');
@ -323,7 +323,7 @@ class Session extends \Test\TestCase {
//prepare login token //prepare login token
$token = 'goodToken'; $token = 'goodToken';
\OC_Preferences::setValue('foo', 'login_token', $token, time()); \OC::$server->getConfig()->setUserValue('foo', 'login_token', $token, time());
$userSession = new \OC\User\Session($manager, $session); $userSession = new \OC\User\Session($manager, $session);
$granted = $userSession->loginWithCookie('foo', $token); $granted = $userSession->loginWithCookie('foo', $token);

View File

@ -152,7 +152,7 @@ class Test_Util extends \Test\TestCase {
function testHomeStorageWrapperWithoutQuota() { function testHomeStorageWrapperWithoutQuota() {
$user1 = $this->getUniqueID(); $user1 = $this->getUniqueID();
\OC_User::createUser($user1, 'test'); \OC_User::createUser($user1, 'test');
OC_Preferences::setValue($user1, 'files', 'quota', 'none'); \OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', 'none');
\OC_User::setUserId($user1); \OC_User::setUserId($user1);
\OC_Util::setupFS($user1); \OC_Util::setupFS($user1);
@ -164,7 +164,7 @@ class Test_Util extends \Test\TestCase {
// clean up // clean up
\OC_User::setUserId(''); \OC_User::setUserId('');
\OC_User::deleteUser($user1); \OC_User::deleteUser($user1);
OC_Preferences::deleteUser($user1); \OC::$server->getConfig()->deleteAllUserValues($user1);
\OC_Util::tearDownFS(); \OC_Util::tearDownFS();
} }
@ -174,7 +174,7 @@ class Test_Util extends \Test\TestCase {
function testHomeStorageWrapperWithQuota() { function testHomeStorageWrapperWithQuota() {
$user1 = $this->getUniqueID(); $user1 = $this->getUniqueID();
\OC_User::createUser($user1, 'test'); \OC_User::createUser($user1, 'test');
OC_Preferences::setValue($user1, 'files', 'quota', '1024'); \OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', '1024');
\OC_User::setUserId($user1); \OC_User::setUserId($user1);
\OC_Util::setupFS($user1); \OC_Util::setupFS($user1);
@ -191,7 +191,7 @@ class Test_Util extends \Test\TestCase {
// clean up // clean up
\OC_User::setUserId(''); \OC_User::setUserId('');
\OC_User::deleteUser($user1); \OC_User::deleteUser($user1);
OC_Preferences::deleteUser($user1); \OC::$server->getConfig()->deleteAllUserValues($user1);
\OC_Util::tearDownFS(); \OC_Util::tearDownFS();
} }