diff options
| author | 2014-02-01 12:23:12 +0100 | |
|---|---|---|
| committer | 2014-02-01 12:23:12 +0100 | |
| commit | 5e9c60752c9a40e1540de50d02e19ba1d06e5491 (patch) | |
| tree | 905b7bde4ccdfaa1ae200e6f0f5c3e48686cd194 | |
| parent | 1a48165a442a05071f57eb02edf877c492fb2afd (diff) | |
Actualize : Tolère PHP lancé en CGI plutôt que CLI
Corrige https://github.com/marienfressinaud/FreshRSS/issues/405
+ Message d'erreur en cas de problème de droits dans ./data/ (par
exemple si le cron utilise un mauvais utilisateur)
| -rw-r--r-- | app/FreshRSS.php | 4 | ||||
| -rwxr-xr-x | app/actualize_script.php | 23 | ||||
| -rw-r--r-- | lib/lib_rss.php | 2 |
3 files changed, 20 insertions, 9 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php index c51f91dec..84cf3429b 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -94,10 +94,6 @@ class FreshRSS extends Minz_FrontController { $loginOk = false; break; } - if ((!$loginOk) && (PHP_SAPI === 'cli') && (Minz_Request::actionName() === 'actualize')) { //Command line - Minz_Configuration::_authType('none'); - $loginOk = true; - } } Minz_View::_param ('loginOk', $loginOk); return $loginOk; diff --git a/app/actualize_script.php b/app/actualize_script.php index 9ac80a852..bef9bd218 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -8,7 +8,10 @@ if (file_exists($lock) && ((time() - @filemtime($lock)) > 3600)) { } if (($handle = @fopen($lock, 'x')) === false) { syslog(LOG_NOTICE, 'FreshRSS actualize already running?'); - fwrite(STDERR, 'FreshRSS actualize already running?' . "\n"); + if (defined('STDERR')) { + fwrite(STDERR, 'FreshRSS actualize already running?' . "\n"); + } + echo 'FreshRSS actualize already running?', "\n"; return; } register_shutdown_function('unlink', $lock); @@ -32,7 +35,9 @@ $users = array_unique($users); foreach ($users as $myUser) { syslog(LOG_INFO, 'FreshRSS actualize ' . $myUser); - fwrite(STDOUT, 'Actualize ' . $myUser . "...\n"); //Unbuffered + if (defined('STDOUT')) { + fwrite(STDOUT, 'Actualize ' . $myUser . "...\n"); //Unbuffered + } echo $myUser, ' '; //Buffered $_GET['c'] = 'feed'; @@ -44,16 +49,26 @@ foreach ($users as $myUser) { $freshRSS = new FreshRSS(); $freshRSS->_useOb(false); + Minz_Configuration::_authType('none'); + Minz_Session::init('FreshRSS'); Minz_Session::_param('currentUser', $myUser); $freshRSS->init(); $freshRSS->run(); - invalidateHttpCache(); + if (!invalidateHttpCache()) { + syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . LOG_PATH . '/*.log!'); + if (defined('STDERR')) { + fwrite(STDERR, 'Write access problem in ' . LOG_PATH . '/*.log!' . "\n"); + } + } Minz_Session::unset_session(true); Minz_ModelPdo::clean(); } syslog(LOG_INFO, 'FreshRSS actualize done.'); +if (defined('STDOUT')) { + fwrite(STDOUT, 'Done.' . "\n"); +} +echo 'End.', "\n"; ob_end_flush(); -fwrite(STDOUT, 'Done.' . "\n"); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 1bb117ab6..a13d9e951 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -214,8 +214,8 @@ function uSecString() { } function invalidateHttpCache() { - touch(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log'); Minz_Session::_param('touch', uTimeString()); + return touch(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log'); } function usernameFromPath($userPath) { |
