aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-02 01:47:03 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-02 01:47:03 +0100
commitb4c477ca41a7ecaa6364dd6a97603829b14b11ef (patch)
tree3c70bdb6fd1186122896fd25355dbf1a9669a00d /lib
parentdd190ed382a6896244d3159a7a5fda3d1c3aaaf4 (diff)
actualize_script compatible multi-utilisateur
* Messages plus verbeux dans actualize_script * Ajout d'un message syslog lorsque SimplePie fait une requête HTTP * Minz_Session ne fermait pas les sessions complètement. * Nouvelle option dans Minz_Dispatcher et Minz_FrontController pour ne pas utiliser ob_gzhandler. Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126
Diffstat (limited to 'lib')
-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
5 files changed, 38 insertions, 8 deletions
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');