From c60c793cf2c179838710946c5db31b3f26b645b4 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 3 Dec 2015 16:41:23 +0100 Subject: [PATCH] More cleanups of OC_Config usage --- apps/user_ldap/lib/helper.php | 2 +- lib/private/db/connection.php | 2 +- lib/private/db/statementwrapper.php | 2 +- lib/private/log/owncloud.php | 7 ++++--- lib/private/log/rotate.php | 2 +- lib/private/log/syslog.php | 2 +- lib/private/route/router.php | 2 +- lib/private/user/database.php | 2 +- lib/private/user/session.php | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php index f05a4afad2c..c189e753853 100644 --- a/apps/user_ldap/lib/helper.php +++ b/apps/user_ldap/lib/helper.php @@ -62,7 +62,7 @@ class Helper { '; if($activeConfigurations) { - if (\OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { + if (\OC::$server->getConfig()->getSystemValue( 'dbtype', 'sqlite' ) === 'oci') { //FIXME oracle hack: need to explicitly cast CLOB to CHAR for comparison $sql .= ' AND to_char(`configvalue`)=\'1\''; } else { diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php index 85b1b7cd5ea..d32d1c5fa46 100644 --- a/lib/private/db/connection.php +++ b/lib/private/db/connection.php @@ -154,7 +154,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { $statement = $this->replaceTablePrefix($statement); $statement = $this->adapter->fixupStatement($statement); - if(\OC_Config::getValue( 'log_query', false)) { + if(\OC::$server->getSystemConfig()->getValue( 'log_query', false)) { \OCP\Util::writeLog('core', 'DB prepare : '.$statement, \OCP\Util::DEBUG); } return parent::prepare($statement); diff --git a/lib/private/db/statementwrapper.php b/lib/private/db/statementwrapper.php index 4bdaf01f071..c888fab0774 100644 --- a/lib/private/db/statementwrapper.php +++ b/lib/private/db/statementwrapper.php @@ -64,7 +64,7 @@ class OC_DB_StatementWrapper { * @return \OC_DB_StatementWrapper|int */ public function execute($input=array()) { - if(OC_Config::getValue( "log_query", false)) { + if(\OC::$server->getSystemConfig()->getValue( "log_query", false)) { $params_str = str_replace("\n", " ", var_export($input, true)); \OCP\Util::writeLog('core', 'DB execute with arguments : '.$params_str, \OCP\Util::DEBUG); } diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php index 721bc6002fa..f8a5f7534c5 100644 --- a/lib/private/log/owncloud.php +++ b/lib/private/log/owncloud.php @@ -38,8 +38,9 @@ class OC_Log_Owncloud { * Init class data */ public static function init() { - $defaultLogFile = OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'; - self::$logFile = OC_Config::getValue("logfile", $defaultLogFile); + $systemConfig = \OC::$server->getSystemConfig(); + $defaultLogFile = $systemConfig->getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'; + self::$logFile = $systemConfig->getValue("logfile", $defaultLogFile); /* * Fall back to default log file if specified logfile does not exist @@ -110,7 +111,7 @@ class OC_Log_Owncloud { */ public static function getEntries($limit=50, $offset=0) { self::init(); - $minLevel=OC_Config::getValue( "loglevel", \OCP\Util::WARN ); + $minLevel = \OC::$server->getSystemConfig()->getValue("loglevel", \OCP\Util::WARN); $entries = array(); $handle = @fopen(self::$logFile, 'rb'); if ($handle) { diff --git a/lib/private/log/rotate.php b/lib/private/log/rotate.php index 27731c07db2..98ebef25988 100644 --- a/lib/private/log/rotate.php +++ b/lib/private/log/rotate.php @@ -32,7 +32,7 @@ namespace OC\Log; class Rotate extends \OC\BackgroundJob\Job { private $max_log_size; public function run($logFile) { - $this->max_log_size = \OC_Config::getValue('log_rotate_size', false); + $this->max_log_size = \OC::$server->getConfig()->getSystemValue('log_rotate_size', false); if ($this->max_log_size) { $filesize = @filesize($logFile); if ($filesize >= $this->max_log_size) { diff --git a/lib/private/log/syslog.php b/lib/private/log/syslog.php index cc4c5a29c39..7a638c36a77 100644 --- a/lib/private/log/syslog.php +++ b/lib/private/log/syslog.php @@ -35,7 +35,7 @@ class OC_Log_Syslog { * Init class data */ public static function init() { - openlog(OC_Config::getValue("syslog_tag", "ownCloud"), LOG_PID | LOG_CONS, LOG_USER); + openlog(\OC::$server->getSystemConfig()->getValue("syslog_tag", "ownCloud"), LOG_PID | LOG_CONS, LOG_USER); // Close at shutdown register_shutdown_function('closelog'); } diff --git a/lib/private/route/router.php b/lib/private/route/router.php index 25860ee46bf..4ca5e16ddf2 100644 --- a/lib/private/route/router.php +++ b/lib/private/route/router.php @@ -260,7 +260,7 @@ class Router implements IRouter { $this->loadRoutes($app); } else if (substr($url, 0, 6) === '/core/' or substr($url, 0, 10) === '/settings/') { \OC::$REQUESTEDAPP = $url; - if (!\OC_Config::getValue('maintenance', false) && !\OCP\Util::needUpgrade()) { + if (!\OC::$server->getConfig()->getSystemValue('maintenance', false) && !\OCP\Util::needUpgrade()) { \OC_App::loadApps(); } $this->loadRoutes('core'); diff --git a/lib/private/user/database.php b/lib/private/user/database.php index 3969b446071..98850771212 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -266,7 +266,7 @@ class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend { */ public function getHome($uid) { if ($this->userExists($uid)) { - return OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data") . '/' . $uid; + return \OC::$server->getConfig()->getSystemValue("datadirectory", OC::$SERVERROOT . "/data") . '/' . $uid; } return false; diff --git a/lib/private/user/session.php b/lib/private/user/session.php index baceeb43956..ba702c9f365 100644 --- a/lib/private/user/session.php +++ b/lib/private/user/session.php @@ -287,7 +287,7 @@ class Session implements IUserSession, Emitter { */ public function setMagicInCookie($username, $token) { $secureCookie = \OC::$server->getRequest()->getServerProtocol() === 'https'; - $expires = time() + \OC_Config::getValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15); + $expires = time() + \OC::$server->getConfig()->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15); setcookie("oc_username", $username, $expires, \OC::$WEBROOT, '', $secureCookie, true); setcookie("oc_token", $token, $expires, \OC::$WEBROOT, '', $secureCookie, true); setcookie("oc_remember_login", "1", $expires, \OC::$WEBROOT, '', $secureCookie, true); -- 2.39.5