aboutsummaryrefslogtreecommitdiffstats
path: root/include/common.inc.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2015-04-24 14:00:50 +0000
committermistic100 <mistic@piwigo.org>2015-04-24 14:00:50 +0000
commit0c576ea19d6d42950615f94feb33df305107a9a6 (patch)
tree95cbc5022fb9b357aeaaf85f107621a1f27c99f0 /include/common.inc.php
parentbecc0117f06c612517272badbcc63b55c75d2227 (diff)
feature 3221 Add Logger class
git-svn-id: http://piwigo.org/svn/trunk@31102 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/common.inc.php')
-rw-r--r--include/common.inc.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index e3f4a16c7..8fab02ab2 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -104,6 +104,9 @@ if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors']))
include(PHPWG_ROOT_PATH . 'include/constants.php');
include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
+include(PHPWG_ROOT_PATH . 'include/template.class.php');
+include(PHPWG_ROOT_PATH . 'include/cache.class.php');
+include(PHPWG_ROOT_PATH . 'include/Logger.class.php');
$persistent_cache = new PersistentFileCache();
@@ -122,6 +125,17 @@ pwg_db_check_charset();
load_conf_from_db();
+$logger = new Logger(array(
+ 'directory' => PHPWG_ROOT_PATH . $conf['data_location'] . $conf['log_dir'],
+ 'severity' => $conf['log_level'],
+ // we use an hashed filename to prevent direct file access, and we salt with
+ // the db_password instead of secret_key because the log must be usable in i.php
+ // (secret_key is in the database)
+ 'filename' => 'log_' . date('Y-m-d') . '_' . sha1(date('Y-m-d') . $conf['db_password']) . '.txt',
+ 'globPattern' => 'log_*.txt',
+ 'archiveDays' => $conf['log_archive_days'],
+ ));
+
if (!$conf['check_upgrade_feed'])
{
if (!isset($conf['piwigo_db_version']) or $conf['piwigo_db_version'] != get_branch_from_version(PHPWG_VERSION))