Revert r35848 per Brion's WONTFIX of bug 14536: "This would just mean that there...
[lhc/web/wiklou.git] / includes / Revision.php
index 0f8ba71..8058e61 100644 (file)
@@ -35,10 +35,8 @@ class Revision {
         * @param Title $title
         * @param int $id
         * @return Revision
-        * @access public
-        * @static
         */
-       public static function newFromTitle( &$title, $id = 0 ) {
+       public static function newFromTitle( $title, $id = 0 ) {
                if( $id ) {
                        $matchId = intval( $id );
                } else {
@@ -60,7 +58,7 @@ class Revision {
         * @access public
         * @static
         */
-       public static function loadFromId( &$db, $id ) {
+       public static function loadFromId( $db, $id ) {
                return Revision::loadFromConds( $db,
                        array( 'page_id=rev_page',
                               'rev_id' => intval( $id ) ) );
@@ -100,7 +98,7 @@ class Revision {
         * @access public
         * @static
         */
-       public static function loadFromTitle( &$db, $title, $id = 0 ) {
+       public static function loadFromTitle( $db, $title, $id = 0 ) {
                if( $id ) {
                        $matchId = intval( $id );
                } else {
@@ -126,7 +124,7 @@ class Revision {
         * @access public
         * @static
         */
-       public static function loadFromTimestamp( &$db, &$title, $timestamp ) {
+       public static function loadFromTimestamp( $db, $title, $timestamp ) {
                return Revision::loadFromConds(
                        $db,
                        array( 'rev_timestamp'  => $db->timestamp( $timestamp ),
@@ -187,7 +185,7 @@ class Revision {
         * @access public
         * @static
         */
-       public static function fetchAllRevisions( &$title ) {
+       public static function fetchAllRevisions( $title ) {
                return Revision::fetchFromConds(
                        wfGetDB( DB_SLAVE ),
                        array( 'page_namespace' => $title->getNamespace(),
@@ -205,7 +203,7 @@ class Revision {
         * @access public
         * @static
         */
-       public static function fetchRevision( &$title ) {
+       public static function fetchRevision( $title ) {
                return Revision::fetchFromConds(
                        wfGetDB( DB_SLAVE ),
                        array( 'rev_id=page_latest',
@@ -406,7 +404,8 @@ class Revision {
                               'rev_id' => $this->mId ),
                        'Revision::getTitle' );
                if( $row ) {
-                       $this->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
+                       $this->mTitle = Title::makeTitle( $row->page_namespace,
+                                                         $row->page_title );
                }
                return $this->mTitle;
        }
@@ -557,24 +556,26 @@ class Revision {
         * @return Revision
         */
        public function getPrevious() {
-               $prev = $this->getTitle() ? $this->getTitle()->getPreviousRevisionID( $this->mId ) : null;
-               if( $prev ) {
-                       return Revision::newFromTitle( $this->mTitle, $prev );
-               } else {
-                       return null;
+               if( $this->getTitle() ) {
+                       $prev = $this->getTitle()->getPreviousRevisionID( $this->getId() );
+                       if( $prev ) {
+                               return Revision::newFromTitle( $this->getTitle(), $prev );
+                       }
                }
+               return null;
        }
 
        /**
         * @return Revision
         */
        public function getNext() {
-               $next = $this->getTitle() ? $this->getTitle()->getNextRevisionID( $this->mId ) : null;
-               if ( $next ) {
-                       return Revision::newFromTitle( $this->mTitle, $next );
-               } else {
-                       return null;
+               if( $this->getTitle() ) {
+                       $next = $this->getTitle()->getNextRevisionID( $this->getId() );
+                       if ( $next ) {
+                               return Revision::newFromTitle( $this->getTitle(), $next );
+                       }
                }
+               return null;
        }
 
        /**
@@ -709,7 +710,7 @@ class Revision {
         * @param Database $dbw
         * @return int
         */
-       public function insertOn( &$dbw ) {
+       public function insertOn( $dbw ) {
                global $wgDefaultExternalStore;
 
                wfProfileIn( __METHOD__ );
@@ -849,7 +850,7 @@ class Revision {
         * @param bool     $minor
         * @return Revision
         */
-       public static function newNullRevision( &$dbw, $pageId, $summary, $minor ) {
+       public static function newNullRevision( $dbw, $pageId, $summary, $minor ) {
                wfProfileIn( __METHOD__ );
 
                $current = $dbw->selectRow(
@@ -889,7 +890,7 @@ class Revision {
                if( ( $this->mDeleted & $field ) == $field ) {
                        global $wgUser;
                        $permission = ( $this->mDeleted & self::DELETED_RESTRICTED ) == self::DELETED_RESTRICTED
-                               ? 'hiderevision'
+                               ? 'suppressrevision'
                                : 'deleterevision';
                        wfDebug( "Checking for $permission due to $field match on $this->mDeleted\n" );
                        return $wgUser->isAllowed( $permission );
@@ -904,7 +905,7 @@ class Revision {
         * @param integer $id
         * @param integer $pageid, optional
         */
-       static function getTimestampFromID( $id, $pageId = 0 ) {
+       static function getTimestampFromId( $id, $pageId = 0 ) {
                $dbr = wfGetDB( DB_SLAVE );
                $conds = array( 'rev_id' => $id );
                if( $pageId ) {