Fix issues with logger instantiation.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 21 Mar 2010 20:35:54 +0000 (21:35 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 21 Mar 2010 20:35:54 +0000 (21:35 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/platal.php
classes/pllogger.php
classes/s.php

index a9376cd..2d988bc 100644 (file)
@@ -41,7 +41,7 @@ abstract class Platal
     public function __construct()
     {
         global $platal, $session, $globals;
-        $platal  =& $this;
+        $platal  = $this;
 
         /* Assign globals first, then call init: init must be used for operations
          * that requires access to the content of $globals (e.g. XDB requires
@@ -391,13 +391,13 @@ abstract class Platal
         }
     }
 
-    public function &buildLogger($uid, $suid)
+    public function &buildLogger($uid, $suid = 0)
     {
         if (defined('PL_LOGGER_CLASS')) {
             $class = PL_LOGGER_CLASS;
             return new $class($uid, $suid);
         } else {
-            return new DummyLogger($uid, $suid);
+            return PlLogger::dummy($uid, $suid);
         }
     }
 
index 77eb97f..87ef69b 100644 (file)
@@ -43,14 +43,6 @@ abstract class PlLogger
      */
     abstract public function isValid($uid);
 
-    /** Build a logger.
-     */
-    public static function get($uid, $suid = 0)
-    {
-        global $platal;
-        return $platal->buildLogger($uid, $suid);
-    }
-
     /** Return a dummy logger.
      */
     public static function dummy($uid, $suid = 0) {
index 346f3be..9f71872 100644 (file)
@@ -95,11 +95,12 @@ class S
     {
         $uid = S::i('uid', $uid);
         if (!S::has('log') || !S::v('log')->isValid($uid)) {
+            global $platal;
             if (S::has('suid')) {
                 $suid = S::v('suid');
-                S::set('log', PlLogger::get(S::i('uid', $uid), $suid['uid']));
+                S::set('log', $platal->buildLogger(S::i('uid', $uid), $suid['uid']));
             } else if (S::has('uid') || $uid) {
-                S::set('log', PlLogger::get(S::i('uid', $uid)));
+                S::set('log', $platal->buildLogger(S::i('uid', $uid)));
             } else {
                 S::set('log', PlLogger::dummy($uid));
             }