* introduces config.php option 'debug' that defaults to false * migrate DEBUG constant to config valuetags/v8.2beta1
@@ -94,3 +94,12 @@ if ($installedVersion === '1.1.9' && ( | |||
} | |||
} | |||
} | |||
/** | |||
* migrate old constant DEBUG to new config value 'debug' | |||
* | |||
* TODO: remove this in ownCloud 8.3 | |||
*/ | |||
if(defined('DEBUG') && DEBUG === true) { | |||
\OC::$server->getConfig()->setSystemValue('debug', true); | |||
} |
@@ -1 +1 @@ | |||
1.1.10 | |||
1.1.11 |
@@ -20,12 +20,6 @@ | |||
* * use RST syntax | |||
*/ | |||
/** | |||
* Only enable this for local development and not in production environments | |||
* This will disable the minifier and outputs some additional debug informations | |||
*/ | |||
define('DEBUG', true); | |||
$CONFIG = array( | |||
@@ -1079,6 +1073,14 @@ $CONFIG = array( | |||
*/ | |||
'memcache.locking' => '\\OC\\Memcache\\Redis', | |||
/** | |||
* Set this ownCloud instance to debugging mode | |||
* | |||
* Only enable this for local development and not in production environments | |||
* This will disable the minifier and outputs some additional debug information | |||
*/ | |||
'debug' => false, | |||
/** | |||
* This entry is just here to show a warning in case somebody copied the sample | |||
* configuration. DO NOT ADD THIS SWITCH TO YOUR CONFIGURATION! |
@@ -62,7 +62,7 @@ if ($defaultExpireDateEnabled) { | |||
$outgoingServer2serverShareEnabled = $config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; | |||
$array = array( | |||
"oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', | |||
"oc_debug" => $config->getSystemValue('debug', false), | |||
"oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', | |||
"oc_webroot" => "\"".OC::$WEBROOT."\"", | |||
"oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |
@@ -582,7 +582,7 @@ class OC { | |||
if (!defined('PHPUNIT_RUN')) { | |||
$logger = \OC::$server->getLogger(); | |||
OC\Log\ErrorHandler::setLogger($logger); | |||
if (defined('DEBUG') and DEBUG) { | |||
if (\OC::$server->getConfig()->getSystemValue('debug', false)) { | |||
OC\Log\ErrorHandler::register(true); | |||
set_exception_handler(array('OC_Template', 'printExceptionErrorPage')); | |||
} else { | |||
@@ -1040,7 +1040,7 @@ class OC { | |||
return false; | |||
} | |||
if (defined("DEBUG") && DEBUG) { | |||
if (\OC::$server->getConfig()->getSystemValue('debug', false)) { | |||
\OCP\Util::writeLog('core', 'Trying to login from cookie', \OCP\Util::DEBUG); | |||
} | |||
@@ -1093,11 +1093,12 @@ class OC { | |||
self::cleanupLoginTokens($userId); | |||
if (!empty($_POST["remember_login"])) { | |||
if (defined("DEBUG") && DEBUG) { | |||
$config = self::$server->getConfig(); | |||
if ($config->getSystemValue('debug', false)) { | |||
self::$server->getLogger()->debug('Setting remember login to cookie', array('app' => 'core')); | |||
} | |||
$token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(32); | |||
self::$server->getConfig()->setUserValue($userId, 'login_token', $token, time()); | |||
$config->setUserValue($userId, 'login_token', $token, time()); | |||
OC_User::setMagicInCookie($userId, $token); | |||
} else { | |||
OC_User::unsetMagicInCookie(); |
@@ -47,8 +47,6 @@ class Config { | |||
protected $configFilePath; | |||
/** @var string */ | |||
protected $configFileName; | |||
/** @var bool */ | |||
protected $debugMode; | |||
/** | |||
* @param string $configDir Path to the config dir, needs to end with '/' | |||
@@ -59,7 +57,6 @@ class Config { | |||
$this->configFilePath = $this->configDir.$fileName; | |||
$this->configFileName = $fileName; | |||
$this->readData(); | |||
$this->debugMode = (defined('DEBUG') && DEBUG); | |||
} | |||
/** | |||
@@ -225,9 +222,6 @@ class Config { | |||
private function writeData() { | |||
// Create a php file ... | |||
$content = "<?php\n"; | |||
if ($this->debugMode) { | |||
$content .= "define('DEBUG',true);\n"; | |||
} | |||
$content .= '$CONFIG = '; | |||
$content .= var_export($this->cache, true); | |||
$content .= ";\n"; |
@@ -329,14 +329,14 @@ class Server extends SimpleContainer implements IServerContainer { | |||
); | |||
}); | |||
$this->registerService('EventLogger', function (Server $c) { | |||
if (defined('DEBUG') and DEBUG) { | |||
if ($c->getSystemConfig()->getValue('debug', false)) { | |||
return new EventLogger(); | |||
} else { | |||
return new NullEventLogger(); | |||
} | |||
}); | |||
$this->registerService('QueryLogger', function ($c) { | |||
if (defined('DEBUG') and DEBUG) { | |||
$this->registerService('QueryLogger', function (Server $c) { | |||
if ($c->getSystemConfig()->getValue('debug', false)) { | |||
return new QueryLogger(); | |||
} else { | |||
return new NullQueryLogger(); |
@@ -233,7 +233,7 @@ class OC_Template extends \OC\Template\Base { | |||
$content->assign('file', $exception->getFile()); | |||
$content->assign('line', $exception->getLine()); | |||
$content->assign('trace', $exception->getTraceAsString()); | |||
$content->assign('debugMode', defined('DEBUG') && DEBUG === true); | |||
$content->assign('debugMode', \OC::$server->getSystemConfig()->getValue('debug', false)); | |||
$content->assign('remoteAddr', $request->getRemoteAddress()); | |||
$content->assign('requestID', $request->getId()); | |||
$content->printPage(); |