Rights log changes:
[lhc/web/wiklou.git] / includes / Group.php
index 54dfa0c..cc94a69 100644 (file)
@@ -9,7 +9,7 @@
  */
 class Group {
        /**#@+
-        * @access private
+        * @private
         */
        /** string $name Group name */
        var $name;
@@ -22,7 +22,7 @@ class Group {
        /** string $rights Contain rights values : "foo,bar,bla" */
        var $rights;
        /**#@-*/
-       
+
        /** Constructor */
        function Group() {
                $this->clear();
@@ -48,7 +48,7 @@ class Group {
 
                // be sure it's an integer
                $this->id = intval($this->id);
-               
+
                if($this->id) {
                        // By ID
                        $dbr =& wfGetDB( DB_SLAVE );
@@ -85,12 +85,12 @@ class Group {
                $this->description = $row->gr_description;
                $this->rights = $row->gr_rights;
                $this->dataLoaded = true;
-       }               
-       
+       }
+
        /** Initialise a new row in the database */
        function addToDatabase() {
                if ( Group::getStaticGroups() ) {
-                       wfDebugDieBacktrace( "Can't modify groups in static mode" );
+                       throw new MWException( "Can't modify groups in static mode" );
                }
 
                $fname = 'Group::addToDatabase';
@@ -110,13 +110,13 @@ class Group {
                global $wgMemc;
 
                if ( Group::getStaticGroups() ) {
-                       wfDebugDieBacktrace( "Can't modify groups in static mode" );
+                       throw new MWException( "Can't modify groups in static mode" );
                }
                if($this->id == 0) { return; }
-               
+
                $fname = 'Group::save';
                $dbw =& wfGetDB( DB_MASTER );
-               
+
                $dbw->update( 'groups',
                        array( /* SET */
                                'gr_name' => $this->name,
@@ -126,7 +126,7 @@ class Group {
                                'gr_id' => $this->id
                        ), $fname
                );
-       
+
                $wgMemc->set( Group::getCacheKey( $this->id ), $this, 3600 );
        }
 
@@ -136,10 +136,10 @@ class Group {
                global $wgMemc;
 
                if ( Group::getStaticGroups() ) {
-                       wfDebugDieBacktrace( "Can't modify groups in static mode" );
+                       throw new MWException( "Can't modify groups in static mode" );
                }
                if($this->id == 0) { return; }
-               
+
                $fname = 'Group::delete';
                $dbw =& wfGetDB( DB_MASTER );
 
@@ -151,7 +151,7 @@ class Group {
 
                $wgMemc->delete( Group::getCacheKey( $this->id ) );
        }
-       
+
        /**
         * Get memcached key
         * @static
@@ -164,12 +164,12 @@ class Group {
 // Factories
        /**
         * Uses Memcached if available.
-        * @param integer $id Group database id
+        * @param $id Integer: group database id
         */
        function newFromId($id) {
-               global $wgMemc, $wgDBname;
+               global $wgMemc;
                $fname = 'Group::newFromId';
-               
+
                $staticGroups =& Group::getStaticGroups();
                if ( $staticGroups ) {
                        if ( array_key_exists( $id, $staticGroups ) ) {
@@ -185,7 +185,7 @@ class Group {
                        wfDebug( "$fname loaded group $id from cache\n" );
                        return $group;
                }
-               
+
                $group = new Group();
                $group->id = $id;
                $group->loadFromDatabase();
@@ -201,10 +201,10 @@ class Group {
        }
 
 
-       /** @param string $name Group database name */
+       /** @param $name String: group database name */
        function newFromName($name) {
                $fname = 'Group::newFromName';
-               
+
                $staticGroups =& Group::getStaticGroups();
                if ( $staticGroups ) {
                        $id = Group::idFromName( $name );
@@ -214,7 +214,7 @@ class Group {
                                return null;
                        }
                }
-               
+
                $g = new Group();
                $g->name = $name;
                $g->loadFromDatabase();
@@ -278,7 +278,7 @@ class Group {
 
 // Converters
        /**
-        * @param integer $id Group database id
+        * @param $id Integer: group database id
         * @return string Group database name
         */
        function nameFromId($id) {
@@ -291,7 +291,7 @@ class Group {
        }
 
        /**
-        * @param string $name Group database name
+        * @param $name String: group database name
         * @return integer Group database id
         */
        function idFromName($name) {
@@ -328,7 +328,7 @@ class Group {
                $this->loadFromDatabase();
                return $this->getMessage( $this->name );
        }
-       
+
        function getNameForContent() {
                $this->loadFromDatabase();
                return $this->getMessageForContent( $this->name );
@@ -338,13 +338,13 @@ class Group {
                $this->loadFromDatabase();
                $this->name = $name;
        }
-       
+
        function getId() { return $this->id; }
        function setId($id) {
                $this->id = intval($id);
                $this->dataLoaded = false;
        }
-       
+
        function getDescription() {
                return $this->description;
        }