aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapp/actualize_script.php36
-rw-r--r--app/views/feed/actualize.phtml2
-rw-r--r--lib/Minz/Dispatcher.php23
-rw-r--r--lib/Minz/FrontController.php15
-rw-r--r--lib/Minz/ModelPdo.php5
-rw-r--r--lib/Minz/Session.php2
-rw-r--r--lib/SimplePie/SimplePie/File.php1
7 files changed, 65 insertions, 19 deletions
diff --git a/app/actualize_script.php b/app/actualize_script.php
index efe21fab6..e0f995afe 100755
--- a/app/actualize_script.php
+++ b/app/actualize_script.php
@@ -3,24 +3,40 @@ require(dirname(__FILE__) . '/../constants.php');
//TODO: check if already running
-$_GET['c'] = 'feed';
-$_GET['a'] = 'actualize';
-$_GET['force'] = true;
-$_SERVER['HTTP_HOST'] = '';
-
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
-$freshRSS = new FreshRSS ();
+session_cache_limiter('');
+ob_implicit_flush(false);
+ob_start();
+echo 'Results: ', "\n"; //Buffered
$users = listUsers();
shuffle($users);
-foreach ($users as $user) {
+foreach ($users as $myUser) {
+ syslog(LOG_INFO, 'FreshRSS actualize ' . $myUser);
+ fwrite(STDOUT, 'Actualize ' . $myUser . "...\n"); //Unbuffered
+ echo $myUser, ' '; //Buffered
+
+ $_GET['c'] = 'feed';
+ $_GET['a'] = 'actualize';
+ $_GET['ajax'] = 1;
+ $_GET['force'] = true;
+ $_SERVER['HTTP_HOST'] = '';
+
+ $freshRSS = new FreshRSS();
+ $freshRSS->_useOb(false);
+
Minz_Session::init('FreshRSS');
- Minz_Session::_param('currentUser', $user);
+ Minz_Session::_param('currentUser', $myUser);
+
$freshRSS->init();
$freshRSS->run();
- //invalidateHttpCache();
- touch(LOG_PATH . '/' . $user . '.log');
+
+ invalidateHttpCache();
Minz_Session::unset_session(true);
+ Minz_ModelPdo::clean();
}
+syslog(LOG_INFO, 'FreshRSS actualize done.');
+ob_end_flush();
+fwrite(STDOUT, 'Done.' . "\n");
diff --git a/app/views/feed/actualize.phtml b/app/views/feed/actualize.phtml
index a0aba9318..d86bac9de 100644
--- a/app/views/feed/actualize.phtml
+++ b/app/views/feed/actualize.phtml
@@ -1 +1 @@
-OK \ No newline at end of file
+OK
diff --git a/lib/Minz/Dispatcher.php b/lib/Minz/Dispatcher.php
index c2c5e7f65..71dfe8ac6 100644
--- a/lib/Minz/Dispatcher.php
+++ b/lib/Minz/Dispatcher.php
@@ -40,19 +40,26 @@ class Minz_Dispatcher {
* Remplit le body de Response à partir de la Vue
* @exception Minz_Exception
*/
- public function run () {
+ public function run ($ob = true) {
$cache = new Minz_Cache();
// Le ob_start est dupliqué : sans ça il y a un bug sous Firefox
// ici on l'appelle avec 'ob_gzhandler', après sans.
// Vraisemblablement la compression fonctionne mais c'est sale
// J'ignore les effets de bord :(
- ob_start ('ob_gzhandler');
+ if ($ob) {
+ ob_start ('ob_gzhandler');
+ }
if (Minz_Cache::isEnabled () && !$cache->expired ()) {
- ob_start ();
+ if ($ob) {
+ ob_start ();
+ }
$cache->render ();
- $text = ob_get_clean();
+ if ($ob) {
+ $text = ob_get_clean();
+ }
} else {
+ $text = ''; //TODO: Clean this code
while (Minz_Request::$reseted) {
Minz_Request::$reseted = false;
@@ -67,9 +74,13 @@ class Minz_Dispatcher {
$this->controller->lastAction ();
if (!Minz_Request::$reseted) {
- ob_start ();
+ if ($ob) {
+ ob_start ();
+ }
$this->controller->view ()->build ();
- $text = ob_get_clean();
+ if ($ob) {
+ $text = ob_get_clean();
+ }
}
} catch (Minz_Exception $e) {
throw $e;
diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php
index 8e9c511a6..7b8526bc8 100644
--- a/lib/Minz/FrontController.php
+++ b/lib/Minz/FrontController.php
@@ -26,6 +26,8 @@ class Minz_FrontController {
protected $dispatcher;
protected $router;
+ private $useOb = true;
+
/**
* Constructeur
* Initialise le router et le dispatcher
@@ -61,7 +63,7 @@ class Minz_FrontController {
*/
public function run () {
try {
- $this->dispatcher->run ();
+ $this->dispatcher->run ($this->useOb);
Minz_Response::send ();
} catch (Minz_Exception $e) {
try {
@@ -94,4 +96,15 @@ class Minz_FrontController {
}
exit ('### Application problem ###<br />'."\n".$txt);
}
+
+ public function useOb() {
+ return $this->useOb;
+ }
+
+ /**
+ * Use ob_start('ob_gzhandler') or not.
+ */
+ public function _useOb($ob) {
+ return $this->useOb = (bool)$ob;
+ }
}
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php
index a643da1f0..831df13a2 100644
--- a/lib/Minz/ModelPdo.php
+++ b/lib/Minz/ModelPdo.php
@@ -93,6 +93,11 @@ class Minz_ModelPdo {
$res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
return $res[0];
}
+
+ public static function clean() {
+ self::$sharedBd = null;
+ self::$sharedPrefix = '';
+ }
}
class FreshPDO extends PDO {
diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php
index 3f6ed88a3..37faff0fb 100644
--- a/lib/Minz/Session.php
+++ b/lib/Minz/Session.php
@@ -60,7 +60,7 @@ class Minz_Session {
public static function unset_session ($force = false) {
$language = self::param ('language');
- session_unset ();
+ session_destroy();
self::$session = array ();
if (!$force) {
diff --git a/lib/SimplePie/SimplePie/File.php b/lib/SimplePie/SimplePie/File.php
index 063ad955e..cf926cf5a 100644
--- a/lib/SimplePie/SimplePie/File.php
+++ b/lib/SimplePie/SimplePie/File.php
@@ -77,6 +77,7 @@ class SimplePie_File
$this->useragent = $useragent;
if (preg_match('/^http(s)?:\/\//i', $url))
{
+ syslog(LOG_INFO, 'SimplePie GET ' . $url); //FreshRSS
if ($useragent === null)
{
$useragent = ini_get('user_agent');