Move logger init to seperate funtion so that its PHP 5.3+ syntax does
not fatally break the serendipity_config.inc.php parsing on PHP5 5.3-. Also create a reasonable error message when running on an old version.
This commit is contained in:
@@ -1205,5 +1205,23 @@ function serendipity_db_time() {
|
|||||||
return $ts;
|
return $ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Inits the logger.
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
function serendipity_initLog() {
|
||||||
|
global $serendipity;
|
||||||
|
|
||||||
|
if (isset($serendipity['logLevel']) && $serendipity['logLevel'] !== 'Off') {
|
||||||
|
if ($serendipity['logLevel'] == 'debug') {
|
||||||
|
$log_level = Psr\Log\LogLevel::DEBUG;
|
||||||
|
} else {
|
||||||
|
$log_level = Psr\Log\LogLevel::ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
$serendipity['logger'] = new Katzgrau\KLogger\Logger($serendipity['serendipityPath'] . '/templates_c/logs', $log_level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
define("serendipity_FUNCTIONS_LOADED", true);
|
define("serendipity_FUNCTIONS_LOADED", true);
|
||||||
/* vim: set sts=4 ts=4 expandtab : */
|
/* vim: set sts=4 ts=4 expandtab : */
|
||||||
|
|||||||
@@ -184,6 +184,13 @@ $serendipity['charsets'] = array(
|
|||||||
@define('VIEWMODE_THREADED', 'threaded');
|
@define('VIEWMODE_THREADED', 'threaded');
|
||||||
@define('VIEWMODE_LINEAR', 'linear');
|
@define('VIEWMODE_LINEAR', 'linear');
|
||||||
|
|
||||||
|
if (!version_compare(phpversion(), '5.3', '>=')) {
|
||||||
|
$serendipity['lang'] = 'en';
|
||||||
|
include(S9Y_INCLUDE_PATH . 'include/lang.inc.php');
|
||||||
|
serendipity_die(sprintf(SERENDIPITY_PHPVERSION_FAIL, phpversion(), '5.3'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Kill the script if we are not installed, and not inside the installer
|
* Kill the script if we are not installed, and not inside the installer
|
||||||
*/
|
*/
|
||||||
@@ -310,15 +317,7 @@ if (defined('USE_MEMSNAP')) {
|
|||||||
serendipity_load_configuration();
|
serendipity_load_configuration();
|
||||||
$serendipity['lang'] = serendipity_getSessionLanguage();
|
$serendipity['lang'] = serendipity_getSessionLanguage();
|
||||||
|
|
||||||
if (isset($serendipity['logLevel']) && $serendipity['logLevel'] !== 'Off') {
|
serendipity_initLog();
|
||||||
if ($serendipity['logLevel'] == 'debug') {
|
|
||||||
$log_level = Psr\Log\LogLevel::DEBUG;
|
|
||||||
} else {
|
|
||||||
$log_level = Psr\Log\LogLevel::ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
$serendipity['logger'] = new Katzgrau\KLogger\Logger($serendipity['serendipityPath'] . '/templates_c/logs', $log_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (isset($serendipity['autodetect_baseURL']) && serendipity_db_bool($serendipity['autodetect_baseURL'])) ||
|
if ( (isset($serendipity['autodetect_baseURL']) && serendipity_db_bool($serendipity['autodetect_baseURL'])) ||
|
||||||
(isset($serendipity['embed']) && serendipity_db_bool($serendipity['embed'])) ) {
|
(isset($serendipity['embed']) && serendipity_db_bool($serendipity['embed'])) ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user