Merge pull request #5905 from nextcloud/ocp-config

Use IConfig instead of static OCP\Config
This commit is contained in:
Morris Jobke 2017-07-31 10:54:40 +02:00 committed by GitHub
commit 7b2c08a31a
7 changed files with 12 additions and 10 deletions

View File

@ -161,7 +161,7 @@ class Storage {
* store a new version of a file.
*/
public static function store($filename) {
if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
if(\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
// if the file gets streamed we need to remove the .part extension
// to get the right target
@ -320,7 +320,7 @@ class Storage {
*/
public static function rollback($file, $revision) {
if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
if(\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
// add expected leading slash
$file = '/' . ltrim($file, '/');
list($uid, $filename) = self::getUidAndFilename($file);

View File

@ -21,10 +21,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doSet');
$config = \OC::$server->getConfig();
$state = $config->getSystemValue('ldapIgnoreNamingRules', 'doSet');
if($state === 'doSet') {
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
}
$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$helper = new \OCA\User_LDAP\Helper($config);
$helper->setLDAPProvider();

View File

@ -349,7 +349,7 @@ class Configuration {
*/
protected function getSystemValue($varName) {
//FIXME: if another system value is added, softcode the default value
return \OCP\Config::getSystemValue($varName, false);
return \OC::$server->getConfig()->getSystemValue($varName, false);
}
/**

View File

@ -88,7 +88,7 @@ class Scanner extends BasicEmitter implements IScanner {
$this->storage = $storage;
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
$this->cacheActive = !Config::getSystemValue('filesystem_cache_readonly', false);
$this->cacheActive = !\OC::$server->getConfig()->getSystemValue('filesystem_cache_readonly', false);
$this->lockingProvider = \OC::$server->getLockingProvider();
}

View File

@ -42,7 +42,7 @@ abstract class Office extends Provider {
$tmpDir = \OC::$server->getTempManager()->getTempBaseDir();
$defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
$clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
$clParameters = \OC::$server->getConfig()->getSystemValue('preview_office_cl_parameters', $defaultParameters);
$exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);

View File

@ -1081,7 +1081,8 @@ class OC_Util {
$location = $urlGenerator->getAbsoluteURL($defaultPage);
} else {
$appId = 'files';
$defaultApps = explode(',', \OCP\Config::getSystemValue('defaultapp', 'files'));
$config = \OC::$server->getConfig();
$defaultApps = explode(',', $config->getSystemValue('defaultapp', 'files'));
// find the first app that is enabled for the current user
foreach ($defaultApps as $defaultApp) {
$defaultApp = OC_App::cleanAppId(strip_tags($defaultApp));
@ -1091,7 +1092,7 @@ class OC_Util {
}
}
if(\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') {
if($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') {
$location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/');
} else {
$location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');

View File

@ -305,7 +305,7 @@ class UtilTest extends \Test\TestCase {
* @group DB
*/
function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) {
$oldDefaultApps = \OCP\Config::getSystemValue('defaultapp', '');
$oldDefaultApps = \OC::$server->getConfig()->getSystemValue('defaultapp', '');
// CLI is doing messy stuff with the webroot, so need to work it around
$oldWebRoot = \OC::$WEBROOT;
\OC::$WEBROOT = '';