From fe293900061263a1917fc1cf18ca369c8e07cb99 Mon Sep 17 00:00:00 2001 From: plopoyop Date: Mon, 20 Oct 2014 22:28:40 +0200 Subject: start with admin only if exists --- app/actualize_script.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/actualize_script.php') diff --git a/app/actualize_script.php b/app/actualize_script.php index 4c306b8da..e5925514e 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -11,8 +11,11 @@ Minz_Configuration::init(); $users = listUsers(); shuffle($users); //Process users in random order -array_unshift($users, Minz_Configuration::defaultUser()); //But always start with admin -$users = array_unique($users); + +if (Minz_Configuration::defaultUser() !== ''){ + array_unshift($users, Minz_Configuration::defaultUser()); //But always start with admin + $users = array_unique($users); +} foreach ($users as $myUser) { syslog(LOG_INFO, 'FreshRSS actualize ' . $myUser); -- cgit v1.2.3 From 956896bf87275317ba822188c14e07eb21fae3de Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Sun, 26 Oct 2014 17:01:31 +0100 Subject: Fixes #683 --- app/actualize_script.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/actualize_script.php') diff --git a/app/actualize_script.php b/app/actualize_script.php index e5925514e..74840215b 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -7,6 +7,11 @@ ob_implicit_flush(false); ob_start(); echo 'Results: ', "\n"; //Buffered +if (defined('STDOUT')) { + $begin_date = date_create('now'); + fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('H:i:s (O)') . "\n"); //Unbuffered +} + Minz_Configuration::init(); $users = listUsers(); @@ -52,6 +57,10 @@ foreach ($users as $myUser) { syslog(LOG_INFO, 'FreshRSS actualize done.'); if (defined('STDOUT')) { fwrite(STDOUT, 'Done.' . "\n"); + $end_date = date_create('now'); + $duration = date_diff($end_date, $begin_date); + fwrite(STDOUT, 'Ending feed actualization at ' . $begin_date->format('H:i:s (O)') . "\n"); //Unbuffered + fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%H hours %M minutes and %S') . ' secondes for ' . count($users) . " users\n"); //Unbuffered } echo 'End.', "\n"; ob_end_flush(); -- cgit v1.2.3 From e861e5789d52fab6c4055e39fb92d64194eaab5e Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Sun, 26 Oct 2014 19:00:00 +0100 Subject: Fix errors + improvements on bug #683 fix. --- app/actualize_script.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/actualize_script.php') diff --git a/app/actualize_script.php b/app/actualize_script.php index 74840215b..9fe499cc9 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -9,7 +9,7 @@ echo 'Results: ', "\n"; //Buffered if (defined('STDOUT')) { $begin_date = date_create('now'); - fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('H:i:s (O)') . "\n"); //Unbuffered + fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('c') . "\n"); //Unbuffered } Minz_Configuration::init(); @@ -59,8 +59,8 @@ if (defined('STDOUT')) { fwrite(STDOUT, 'Done.' . "\n"); $end_date = date_create('now'); $duration = date_diff($end_date, $begin_date); - fwrite(STDOUT, 'Ending feed actualization at ' . $begin_date->format('H:i:s (O)') . "\n"); //Unbuffered - fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%H hours %M minutes and %S') . ' secondes for ' . count($users) . " users\n"); //Unbuffered + fwrite(STDOUT, 'Ending feed actualization at ' . $end_date->format('c') . "\n"); //Unbuffered + fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%a day(s), %h hour(s), %i minute(s) and %s seconds') . ' for ' . count($users) . " users\n"); //Unbuffered } echo 'End.', "\n"; ob_end_flush(); -- cgit v1.2.3 From 9f97f7df8822ed2f32a9bc9d46ece92dee93089c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 29 Oct 2014 00:45:42 +0100 Subject: Ne pas rafraîchir les flux des utilisateurs non logués depuis x jours MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/marienfressinaud/FreshRSS/issues/681 Warning: needs some testing --- CHANGELOG | 2 +- app/Controllers/userController.php | 3 +-- app/Models/Auth.php | 13 +++++-------- app/Models/UserDAO.php | 10 +++++++++- app/actualize_script.php | 10 ++++++++++ lib/Minz/Configuration.php | 7 +++++++ 6 files changed, 33 insertions(+), 12 deletions(-) (limited to 'app/actualize_script.php') diff --git a/CHANGELOG b/CHANGELOG index 688a286e3..a556fcc13 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,7 +3,7 @@ ## * Configuration - * New options in config.php for cache duration, timeout, max number of feeds and categories per user. + * New options in config.php for cache duration, timeout, max inactivity, max number of feeds and categories per user. ## 2014-09-26 FreshRSS 0.8.0 / 0.9.0 (beta) diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 2343520ca..39db1d879 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -95,9 +95,8 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('gen.title.user_management') . ' · '); // Get the correct current user. - $userDAO = new FreshRSS_UserDAO(); $username = Minz_Request::param('u', Minz_Session::param('currentUser')); - if (!$userDAO->exist($username)) { + if (!FreshRSS_UserDAO::exist($username)) { $username = Minz_Session::param('currentUser'); } $this->view->current_user = $username; diff --git a/app/Models/Auth.php b/app/Models/Auth.php index cc23d7974..2971d65c8 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -20,10 +20,11 @@ class FreshRSS_Auth { Minz_Session::_param('currentUser', $current_user); } - $access_ok = self::accessControl(); - - if ($access_ok) { + if (self::$login_ok) { self::giveAccess(); + } elseif (self::accessControl()) { + self::giveAccess(); + FreshRSS_UserDAO::touch($current_user); } else { // Be sure all accesses are removed! self::removeAccess(); @@ -38,11 +39,7 @@ class FreshRSS_Auth { * * @return boolean true if user can be connected, false else. */ - public static function accessControl() { - if (self::$login_ok) { - return true; - } - + private static function accessControl() { switch (Minz_Configuration::authType()) { case 'form': $credentials = FreshRSS_FormAuth::getCredentialsFromCookie(); diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 85b45c4a7..60fca71b1 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -54,7 +54,15 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { } } - public function exist($username) { + public static function exist($username) { return file_exists(DATA_PATH . '/' . $username . '_user.php'); } + + public static function touch($username) { + return touch(DATA_PATH . '/' . $username . '_user.php'); + } + + public static function mtime($username) { + return @filemtime(DATA_PATH . '/' . $username . '_user.php'); + } } diff --git a/app/actualize_script.php b/app/actualize_script.php index 9fe499cc9..6ce4178cd 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -22,7 +22,17 @@ if (Minz_Configuration::defaultUser() !== ''){ $users = array_unique($users); } +$limits = Minz_Configuration::limits(); +$minLastActivity = time() - $limits['max_inactivity']; + foreach ($users as $myUser) { + if (($myUser !== Minz_Configuration::defaultUser()) && (FreshRSS_UserDAO::mtime($myUser) < $minLastActivity)) { + syslog(LOG_INFO, 'FreshRSS skip inactive user ' . $myUser); + if (defined('STDOUT')) { + fwrite(STDOUT, 'FreshRSS skip inactive user ' . $myUser . "\n"); //Unbuffered + } + continue; + } syslog(LOG_INFO, 'FreshRSS actualize ' . $myUser); if (defined('STDOUT')) { fwrite(STDOUT, 'Actualize ' . $myUser . "...\n"); //Unbuffered diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 9511cb357..6cbc9fc0b 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -64,6 +64,7 @@ class Minz_Configuration { private static $limits = array( 'cache_duration' => 800, //SimplePie cache duration in seconds 'timeout' => 10, //SimplePie timeout in seconds + 'max_inactivity' => PHP_INT_MAX, //Time in seconds after which a user who has not used the account is considered inactive (no auto-refresh of feeds). 'max_feeds' => Minz_Configuration::MAX_SMALL_INT, 'max_categories' => Minz_Configuration::MAX_SMALL_INT, ); @@ -317,6 +318,12 @@ class Minz_Configuration { self::$limits['timeout'] = $v; } } + if (isset($limits['max_inactivity'])) { + $v = intval($limits['max_inactivity']); + if ($v > 0) { + self::$limits['max_inactivity'] = $v; + } + } if (isset($limits['max_feeds'])) { $v = intval($limits['max_feeds']); if ($v > 0 && $v < Minz_Configuration::MAX_SMALL_INT) { -- cgit v1.2.3 From c391ca62f1ad4130202b995bb5bb9111894e65ff Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 28 Dec 2014 18:05:02 +0100 Subject: Remove all old references to LOG_PATH See https://github.com/FreshRSS/FreshRSS/issues/729 --- app/actualize_script.php | 4 ++-- lib/Minz/FrontController.php | 4 ---- lib/Minz/Log.php | 6 +++--- lib/lib_rss.php | 7 +++++-- p/api/greader.php | 2 +- p/i/index.php | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) (limited to 'app/actualize_script.php') diff --git a/app/actualize_script.php b/app/actualize_script.php index 6ce4178cd..e8bc67c10 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -56,9 +56,9 @@ foreach ($users as $myUser) { $freshRSS->run(); if (!invalidateHttpCache()) { - syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . LOG_PATH . '/*.log!'); + syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . USERS_PATH . '/*/log.txt!'); if (defined('STDERR')) { - fwrite(STDERR, 'Write access problem in ' . LOG_PATH . '/*.log!' . "\n"); + fwrite(STDERR, 'Write access problem in ' . USERS_PATH . '/*/log.txt!' . "\n"); } } Minz_Session::unset_session(true); diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php index e95c56bf3..3dac1e438 100644 --- a/lib/Minz/FrontController.php +++ b/lib/Minz/FrontController.php @@ -30,10 +30,6 @@ class Minz_FrontController { * Initialise le dispatcher, met à jour la Request */ public function __construct () { - if (LOG_PATH === false) { - $this->killApp ('Path not found: LOG_PATH'); - } - try { Minz_Configuration::init (); diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php index 26412c547..d19edc1dc 100644 --- a/lib/Minz/Log.php +++ b/lib/Minz/Log.php @@ -28,7 +28,7 @@ class Minz_Log { * - level = NOTICE et environment = PRODUCTION * @param $information message d'erreur / information à enregistrer * @param $level niveau d'erreur - * @param $file_name fichier de log, par défaut LOG_PATH/application.log + * @param $file_name fichier de log */ public static function record ($information, $level, $file_name = null) { $env = Minz_Configuration::environment (); @@ -37,7 +37,7 @@ class Minz_Log { || ($env === Minz_Configuration::PRODUCTION && ($level >= Minz_Log::NOTICE)))) { if ($file_name === null) { - $file_name = join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'); + $file_name = join_path(USERS_PATH, Minz_Session::param('currentUser', '_'), 'log.txt'); } switch ($level) { @@ -71,7 +71,7 @@ class Minz_Log { * Automatise le log des variables globales $_GET et $_POST * Fait appel à la fonction record(...) * Ne fonctionne qu'en environnement "development" - * @param $file_name fichier de log, par défaut LOG_PATH/application.log + * @param $file_name fichier de log */ public static function recordRequest($file_name = null) { $msg_get = str_replace("\n", '', '$_GET content : ' . print_r($_GET, true)); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index cc60a1607..d450ec858 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -222,7 +222,10 @@ function invalidateHttpCache() { function listUsers() { $final_list = array(); $base_path = join_path(DATA_PATH, 'users'); - $dir_list = array_values(array_diff(scandir($base_path), array('..', '.'))); + $dir_list = array_values(array_diff( + scandir($base_path), + array('..', '.', '_') + )); foreach ($dir_list as $file) { if (is_dir(join_path($base_path, $file))) { @@ -297,7 +300,7 @@ function check_install_files() { return array( 'data' => DATA_PATH && is_writable(DATA_PATH), 'cache' => CACHE_PATH && is_writable(CACHE_PATH), - 'logs' => LOG_PATH && is_writable(LOG_PATH), + 'users' => USERS_PATH && is_writable(USERS_PATH), 'favicons' => is_writable(DATA_PATH . '/favicons'), 'persona' => is_writable(DATA_PATH . '/persona'), 'tokens' => is_writable(DATA_PATH . '/tokens'), diff --git a/p/api/greader.php b/p/api/greader.php index 1a66c30fb..80714d478 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -77,7 +77,7 @@ class MyPDO extends Minz_ModelPdo { } function logMe($text) { - file_put_contents(LOG_PATH . '/api.log', $text, FILE_APPEND); + file_put_contents(join_path(USERS_PATH, '_', 'log_api.txt'), $text, FILE_APPEND); } function debugInfo() { diff --git a/p/i/index.php b/p/i/index.php index ec969c159..009d56bc3 100755 --- a/p/i/index.php +++ b/p/i/index.php @@ -32,8 +32,8 @@ if (file_exists(DATA_PATH . '/do-install.txt')) { require(LIB_PATH . '/http-conditional.php'); $currentUser = Minz_Session::param('currentUser', ''); $dateLastModification = $currentUser === '' ? time() : max( - @filemtime(LOG_PATH . '/' . $currentUser . '.log'), - @filemtime(DATA_PATH . '/config.php') + @filemtime(join_path(USERS_PATH, $currentUser, 'log.txt')), + @filemtime(join_path(DATA_PATH . 'config.php')) ); if (httpConditional($dateLastModification, 0, 0, false, PHP_COMPRESSION, true)) { exit(); //No need to send anything -- cgit v1.2.3 From 5cdfd6d493705eed93481ff945e8a84cbcff92f7 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 6 Jan 2015 22:12:48 +0100 Subject: Fix and improve actualize_script See https://github.com/FreshRSS/FreshRSS/issues/730 --- app/actualize_script.php | 52 ++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'app/actualize_script.php') diff --git a/app/actualize_script.php b/app/actualize_script.php index e8bc67c10..cc2a88c51 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -12,21 +12,36 @@ if (defined('STDOUT')) { fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('c') . "\n"); //Unbuffered } -Minz_Configuration::init(); -$users = listUsers(); -shuffle($users); //Process users in random order +// Set the header params ($_GET) to call the FRSS application. +$_GET['c'] = 'feed'; +$_GET['a'] = 'actualize'; +$_GET['ajax'] = 1; +$_GET['force'] = true; +$_SERVER['HTTP_HOST'] = ''; + + +$app = new FreshRSS(); +$app->init(); -if (Minz_Configuration::defaultUser() !== ''){ - array_unshift($users, Minz_Configuration::defaultUser()); //But always start with admin +$system_conf = Minz_Configuration::get('system'); +$system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) + +// Create the list of users to actualize. +// Users are processed in a random order but always start with admin +$users = listUsers(); +shuffle($users); +if ($system_conf->default_user !== ''){ + array_unshift($users, $system_conf->default_user); $users = array_unique($users); } -$limits = Minz_Configuration::limits(); -$minLastActivity = time() - $limits['max_inactivity']; +$limits = $system_conf->limits; +$minLastActivity = time() - $limits['max_inactivity']; foreach ($users as $myUser) { - if (($myUser !== Minz_Configuration::defaultUser()) && (FreshRSS_UserDAO::mtime($myUser) < $minLastActivity)) { + if (($myUser !== $system_conf->default_user) && + (FreshRSS_UserDAO::mtime($myUser) < $minLastActivity)) { syslog(LOG_INFO, 'FreshRSS skip inactive user ' . $myUser); if (defined('STDOUT')) { fwrite(STDOUT, 'FreshRSS skip inactive user ' . $myUser . "\n"); //Unbuffered @@ -39,31 +54,20 @@ foreach ($users as $myUser) { } echo $myUser, ' '; //Buffered - $_GET['c'] = 'feed'; - $_GET['a'] = 'actualize'; - $_GET['ajax'] = 1; - $_GET['force'] = true; - $_SERVER['HTTP_HOST'] = ''; - - $freshRSS = new FreshRSS(); - - Minz_Configuration::_authType('none'); - Minz_Session::init('FreshRSS'); Minz_Session::_param('currentUser', $myUser); + $app->run(); - $freshRSS->init(); - $freshRSS->run(); if (!invalidateHttpCache()) { - syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . USERS_PATH . '/*/log.txt!'); + syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . join_path(USERS_PATH, $myUser, 'log.txt')); if (defined('STDERR')) { - fwrite(STDERR, 'Write access problem in ' . USERS_PATH . '/*/log.txt!' . "\n"); + fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $myUser, 'log.txt') . "\n"); } } - Minz_Session::unset_session(true); - Minz_ModelPdo::clean(); } + + syslog(LOG_INFO, 'FreshRSS actualize done.'); if (defined('STDOUT')) { fwrite(STDOUT, 'Done.' . "\n"); -- cgit v1.2.3 From cf406fc5755322ae1ddb7b8320e3b74a8a383a89 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 6 Jan 2015 23:06:17 +0100 Subject: Fix a bug of authentication in actualize_script See https://github.com/FreshRSS/FreshRSS/issues/730 --- app/actualize_script.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app/actualize_script.php') diff --git a/app/actualize_script.php b/app/actualize_script.php index cc2a88c51..b498c6a5a 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -56,6 +56,7 @@ foreach ($users as $myUser) { Minz_Session::_param('currentUser', $myUser); + FreshRSS_Auth::giveAccess(); $app->run(); -- cgit v1.2.3 From c96e1d9aec81d4872d4c35d86b7a062389d191d2 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 6 Jan 2015 23:07:57 +0100 Subject: Coding style in actualize_script --- app/actualize_script.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'app/actualize_script.php') diff --git a/app/actualize_script.php b/app/actualize_script.php index b498c6a5a..c7959be82 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -38,32 +38,32 @@ if ($system_conf->default_user !== ''){ $limits = $system_conf->limits; -$minLastActivity = time() - $limits['max_inactivity']; -foreach ($users as $myUser) { - if (($myUser !== $system_conf->default_user) && - (FreshRSS_UserDAO::mtime($myUser) < $minLastActivity)) { - syslog(LOG_INFO, 'FreshRSS skip inactive user ' . $myUser); +$min_last_activity = time() - $limits['max_inactivity']; +foreach ($users as $user) { + if (($user !== $system_conf->default_user) && + (FreshRSS_UserDAO::mtime($user) < $min_last_activity)) { + syslog(LOG_INFO, 'FreshRSS skip inactive user ' . $user); if (defined('STDOUT')) { - fwrite(STDOUT, 'FreshRSS skip inactive user ' . $myUser . "\n"); //Unbuffered + fwrite(STDOUT, 'FreshRSS skip inactive user ' . $user . "\n"); //Unbuffered } continue; } - syslog(LOG_INFO, 'FreshRSS actualize ' . $myUser); + syslog(LOG_INFO, 'FreshRSS actualize ' . $user); if (defined('STDOUT')) { - fwrite(STDOUT, 'Actualize ' . $myUser . "...\n"); //Unbuffered + fwrite(STDOUT, 'Actualize ' . $user . "...\n"); //Unbuffered } - echo $myUser, ' '; //Buffered + echo $user, ' '; //Buffered - Minz_Session::_param('currentUser', $myUser); + Minz_Session::_param('currentUser', $user); FreshRSS_Auth::giveAccess(); $app->run(); if (!invalidateHttpCache()) { - syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . join_path(USERS_PATH, $myUser, 'log.txt')); + syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt')); if (defined('STDERR')) { - fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $myUser, 'log.txt') . "\n"); + fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $user, 'log.txt') . "\n"); } } } -- cgit v1.2.3 From 12081f7ba2089c8046dacac23ebe44ea843d7ef1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 20 Jan 2015 23:29:04 +0100 Subject: Quick fix cron actualization due to problematic FreshRSS constructor/init https://github.com/FreshRSS/FreshRSS/issues/759 Suggestion: the static objects should be user-independent (or at least with the possibility to be re-set), while the FreshRSS object and its attributes should be user-dependent. --- app/actualize_script.php | 3 ++- lib/Minz/Configuration.php | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'app/actualize_script.php') diff --git a/app/actualize_script.php b/app/actualize_script.php index c7959be82..bae40aa56 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -22,7 +22,6 @@ $_SERVER['HTTP_HOST'] = ''; $app = new FreshRSS(); -$app->init(); $system_conf = Minz_Configuration::get('system'); $system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) @@ -56,7 +55,9 @@ foreach ($users as $user) { Minz_Session::_param('currentUser', $user); + new Minz_ModelPdo($user); //TODO: FIXME: Quick-fix while waiting for a better FreshRSS() constructor/init FreshRSS_Auth::giveAccess(); + $app->init(); $app->run(); diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index fe415e22b..ab5bb4fc2 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -16,16 +16,9 @@ class Minz_Configuration { * @param $config_filename the filename of the configuration * @param $default_filename a filename containing default values for the configuration * @param $configuration_setter an optional helper to set values in configuration - * @throws Minz_ConfigurationNamespaceException if the namespace already exists. */ public static function register($namespace, $config_filename, $default_filename = null, $configuration_setter = null) { - if (isset(self::$config_list[$namespace])) { - throw new Minz_ConfigurationNamespaceException( - $namespace . ' namespace already exists' - ); - } - self::$config_list[$namespace] = new Minz_Configuration( $namespace, $config_filename, $default_filename, $configuration_setter ); -- cgit v1.2.3 From 59ea9f2a3b131432236745483e20cb50338110df Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 29 Jan 2015 10:14:45 +0100 Subject: Remove calls to syslog() Temporary fix: - Change syslog by Minz_Log::notice in most of the files - Logs are stored in USERS_PATH/_/log.txt for actualize_script.php - Simply comment syslog in SimplePie See https://github.com/FreshRSS/FreshRSS/issues/711 --- app/Models/Feed.php | 4 ++-- app/actualize_script.php | 12 ++++++++---- lib/SimplePie/SimplePie.php | 4 ++-- lib/SimplePie/SimplePie/File.php | 2 +- lib/lib_rss.php | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) (limited to 'app/actualize_script.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 86cbb783e..74869bf11 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -249,10 +249,10 @@ class FreshRSS_Feed extends Minz_Model { } if (($mtime === true) ||($mtime > $this->lastUpdate)) { - syslog(LOG_DEBUG, 'FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $subscribe_url); + Minz_Log::notice('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $subscribe_url); $this->loadEntries($feed); // et on charge les articles du flux } else { - syslog(LOG_DEBUG, 'FreshRSS use cache for ' . $subscribe_url); + Minz_Log::notice('FreshRSS use cache for ' . $subscribe_url); $this->entries = array(); } diff --git a/app/actualize_script.php b/app/actualize_script.php index bae40aa56..fc4f9bfbb 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -21,6 +21,9 @@ $_GET['force'] = true; $_SERVER['HTTP_HOST'] = ''; +$log_file = join_path(USERS_PATH, '_', 'log.txt'); + + $app = new FreshRSS(); $system_conf = Minz_Configuration::get('system'); @@ -41,13 +44,13 @@ $min_last_activity = time() - $limits['max_inactivity']; foreach ($users as $user) { if (($user !== $system_conf->default_user) && (FreshRSS_UserDAO::mtime($user) < $min_last_activity)) { - syslog(LOG_INFO, 'FreshRSS skip inactive user ' . $user); + Minz_Log::notice('FreshRSS skip inactive user ' . $user, $log_file); if (defined('STDOUT')) { fwrite(STDOUT, 'FreshRSS skip inactive user ' . $user . "\n"); //Unbuffered } continue; } - syslog(LOG_INFO, 'FreshRSS actualize ' . $user); + Minz_Log::notice('FreshRSS actualize ' . $user, $log_file); if (defined('STDOUT')) { fwrite(STDOUT, 'Actualize ' . $user . "...\n"); //Unbuffered } @@ -62,7 +65,8 @@ foreach ($users as $user) { if (!invalidateHttpCache()) { - syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt')); + Minz_Log::notice('FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'), + $log_file); if (defined('STDERR')) { fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $user, 'log.txt') . "\n"); } @@ -70,7 +74,7 @@ foreach ($users as $user) { } -syslog(LOG_INFO, 'FreshRSS actualize done.'); +Minz_Log::notice('FreshRSS actualize done.', $log_file); if (defined('STDOUT')) { fwrite(STDOUT, 'Done.' . "\n"); $end_date = date_create('now'); diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index dc4bbb6cb..c4872b5be 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -1529,11 +1529,11 @@ class SimplePie { //FreshRSS $md5 = $this->cleanMd5($file->body); if ($this->data['md5'] === $md5) { - syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url); + // syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url); $cache->touch(); return true; //Content unchanged even though server did not send a 304 } else { - syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url); + // syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url); $this->data['md5'] = $md5; } } diff --git a/lib/SimplePie/SimplePie/File.php b/lib/SimplePie/SimplePie/File.php index b1bbe4420..9625af2a9 100644 --- a/lib/SimplePie/SimplePie/File.php +++ b/lib/SimplePie/SimplePie/File.php @@ -79,7 +79,7 @@ class SimplePie_File $this->useragent = $useragent; if (preg_match('/^http(s)?:\/\//i', $url)) { - syslog(LOG_INFO, 'SimplePie GET ' . $url); //FreshRSS + // syslog(LOG_INFO, 'SimplePie GET ' . $url); //FreshRSS if ($useragent === null) { $useragent = ini_get('user_agent'); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 083e87745..3b3f6d279 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -180,7 +180,7 @@ function sanitizeHTML($data, $base = '') { function get_content_by_parsing ($url, $path) { require_once (LIB_PATH . '/lib_phpQuery.php'); - syslog(LOG_INFO, 'FreshRSS GET ' . $url); + Minz_Log::notice('FreshRSS GET ' . $url); $html = file_get_contents ($url); if ($html) { -- cgit v1.2.3