From: Alexandre Emsenhuber Date: Wed, 2 May 2012 08:27:21 +0000 (+0200) Subject: Pass the result of the database queries in Title::getPreviousRevisionID() and Title... X-Git-Tag: 1.31.0-rc.0~23713^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=5e7c4140181f3ad86fd10f16868289fe8485a07b;p=lhc%2Fweb%2Fwiklou.git Pass the result of the database queries in Title::getPreviousRevisionID() and Title::getNextRevisionID() into intval(). No idea why mysql_fetch_object() returns string when the field in defined as integer, but it is so on my machine... Change-Id: I353c6087d20d7a72d6d4b39bdc477b094bc460f6 --- diff --git a/includes/Title.php b/includes/Title.php index d26f71c10d..2748651f08 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3919,7 +3919,7 @@ class Title { */ public function getPreviousRevisionID( $revId, $flags = 0 ) { $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); - return $db->selectField( 'revision', 'rev_id', + $revId = $db->selectField( 'revision', 'rev_id', array( 'rev_page' => $this->getArticleID( $flags ), 'rev_id < ' . intval( $revId ) @@ -3927,6 +3927,12 @@ class Title { __METHOD__, array( 'ORDER BY' => 'rev_id DESC' ) ); + + if ( $revId === false ) { + return false; + } else { + return intval( $revId ); + } } /** @@ -3938,7 +3944,7 @@ class Title { */ public function getNextRevisionID( $revId, $flags = 0 ) { $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); - return $db->selectField( 'revision', 'rev_id', + $revId = $db->selectField( 'revision', 'rev_id', array( 'rev_page' => $this->getArticleID( $flags ), 'rev_id > ' . intval( $revId ) @@ -3946,6 +3952,12 @@ class Title { __METHOD__, array( 'ORDER BY' => 'rev_id' ) ); + + if ( $revId === false ) { + return false; + } else { + return intval( $revId ); + } } /**