More cleanups of OC_Config usage

This commit is contained in:
Morris Jobke 2015-12-03 16:41:23 +01:00
parent 1fe7957fd0
commit c60c793cf2
9 changed files with 12 additions and 11 deletions

View file

@ -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 {

View file

@ -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);

View file

@ -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);
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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');
}

View file

@ -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');

View file

@ -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;

View file

@ -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);