From 09c423f42e90ffbf01a5d37df157e46b0c57dd4e Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Mon, 2 Oct 2006 16:17:57 +0000 Subject: [PATCH] New method loadFromId() per brion's suggestion. Reverted newFromId() change. --- includes/Revision.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/includes/Revision.php b/includes/Revision.php index 3c99d46af1..8ea4df2a87 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -22,16 +22,13 @@ class Revision { * Returns null if no such revision can be found. * * @param int $id - * @param Database $db * @access public * @static */ - public static function newFromId( $id, $db = null ) { - $conditions = array( 'page_id=rev_page', 'rev_id' => intval( $id )); - if (is_null($db)) - return Revision::newFromConds( $conditions ); - else - return Revision::loadFromConds( $db, $conditions ); + public static function newFromId( $id ) { + return Revision::newFromConds( + array( 'page_id=rev_page', + 'rev_id' => intval( $id ) ) ); } /** @@ -58,6 +55,21 @@ class Revision { 'page_title' => $title->getDbkey() ) ); } + /** + * Load a page revision from a given revision ID number. + * Returns null if no such revision can be found. + * + * @param Database $db + * @param int $id + * @access public + * @static + */ + public static function loadFromId( &$db, $id ) { + return Revision::loadFromConds( $db, + array( 'page_id=rev_page', + 'rev_id' => intval( $id ) ) ); + } + /** * Load either the current, or a specified, revision * that's attached to a given page. If not attached -- 2.20.1