* (bug 2046) Make the wiki work on PHP5 again
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 2 May 2005 02:07:37 +0000 (02:07 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 2 May 2005 02:07:37 +0000 (02:07 +0000)
Kicks static groups loader back to the factory method to avoid the illegal $this assignment

includes/Group.php

index 0377616..a660583 100644 (file)
@@ -47,21 +47,6 @@ class Group {
                        return;
                }
 
-               // If we're using static groups, don't touch the database, use the 
-               // internal arrays
-               $staticGroups =& Group::getStaticGroups();
-               if ( $staticGroups ) {
-                       if ( $this->id ) {
-                               $this = $staticGroups[$this->id];
-                       } else {
-                               $this->id = Group::idFromName( $this->name );
-                               $this = $staticGroups[$this->id];
-                       }
-                       return;
-               }
-
-               // Now go for the database
-
                // be sure it's an integer
                $this->id = IntVal($this->id);
                
@@ -201,6 +186,17 @@ class Group {
        /** @param string $name Group database name */
        function newFromName($name) {
                $fname = 'Group::newFromName';
+               
+               $staticGroups =& Group::getStaticGroups();
+               if ( $staticGroups ) {
+                       $id = Group::idFromName( $name );
+                       if ( array_key_exists( $id, $staticGroups ) ) {
+                               return $staticGroups[$id];
+                       } else {
+                               return null;
+                       }
+               }
+               
                $g = new Group();
                $g->name = $name;
                $g->loadFromDatabase();