Fix useless SQL queries when on Xnet but not in a group.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 20 Mar 2010 15:12:14 +0000 (16:12 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 20 Mar 2010 15:12:14 +0000 (16:12 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/platalglobals.php.in
core

index aabdac3..774a809 100644 (file)
@@ -52,15 +52,17 @@ class PlatalGlobals extends PlGlobals
 
     public function asso($key = null)
     {
+        static $fetched = false;
         static $aid = null;
 
-        if (isset($GLOBALS['IS_XNET_SITE']) && is_null($aid)) {
+        if (isset($GLOBALS['IS_XNET_SITE']) && !$fetched) {
             $gp = Get::v('n');
             if ($p = strpos($gp, '/')) {
                 $gp = substr($gp, 0, $p);
             }
 
             $aid = Group::get($gp);
+            $fetched = true;
         }
         if (empty($key)) {
             return $aid;
diff --git a/core b/core
index fd669a5..9d421b2 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit fd669a5756eb8607006d19575956a2f6ea1508ce
+Subproject commit 9d421b2930b5cd1b70dbbe5d11ad3c8c4197faa5