Add a guard against overlapping transactions.
[platal.git] / classes / pllogger.php
index 6505a4d..87ef69b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /*
- * Copyright (C) 2003-2004 Polytechnique.org
+ * Copyright (C) 2003-2010 Polytechnique.org
  * http://opensource.polytechnique.org/
  *
  * This program is free software; you can redistribute it and/or modify
@@ -36,27 +36,17 @@ abstract class PlLogger
      */
     abstract public function log($action, $data = null);
 
-    /** Build a logger.
+    /** Check validity of the logger.
+     *
+     * @param $uid the uid of the current session.
+     * @return TRUE if the logger can still be used.
      */
-    public static function get($uid, $suid = 0)
-    {
-        if (defined('PL_LOGGER_CLASS')) {
-            $class = PL_LOGGER_CLASS;
-            return new $class($uid, $suid);
-        } else {
-            return new DummyLogger($uid, $suid);
-        }
-    }
-}
+    abstract public function isValid($uid);
 
-class DummyLogger extends PlLogger
-{
-    public function __construct($uid, $suid = 0)
-    {
-    }
-
-    public function log($action, $data = null)
-    {
+    /** Return a dummy logger.
+     */
+    public static function dummy($uid, $suid = 0) {
+        return new DummyLogger($uid, $suid);
     }
 }