From b9c28dd034aef9f6f2471e6817076e5647c9eec7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 2 May 2005 02:07:37 +0000 Subject: [PATCH] * (bug 2046) Make the wiki work on PHP5 again Kicks static groups loader back to the factory method to avoid the illegal $this assignment --- includes/Group.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/includes/Group.php b/includes/Group.php index 037761616d..a660583c5c 100644 --- a/includes/Group.php +++ b/includes/Group.php @@ -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(); -- 2.20.1