From: Aaron Schulz Date: Sat, 10 May 2008 23:31:52 +0000 (+0000) Subject: Add $flags X-Git-Tag: 1.31.0-rc.0~47720 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=cb658cdcc373c5c6302906c5097e808b98cd07a4;p=lhc%2Fweb%2Fwiklou.git Add $flags --- diff --git a/includes/Title.php b/includes/Title.php index 0c31074818..a1a5e276a2 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -192,12 +192,13 @@ class Title { * but not used for anything else * * @param int $id the page_id corresponding to the Title to create + * @param int $flags, use FOR_UPDATE to use master * @return Title the new object, or NULL on an error */ - public static function newFromID( $id ) { + public static function newFromID( $id, $flags = 0 ) { $fname = 'Title::newFromID'; - $dbr = wfGetDB( DB_SLAVE ); - $row = $dbr->selectRow( 'page', array( 'page_namespace', 'page_title' ), + $db = ($flags & FOR_UPDATE) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); + $row = $db->selectRow( 'page', array( 'page_namespace', 'page_title' ), array( 'page_id' => $id ), $fname ); if ( $row !== false ) { $title = Title::makeTitle( $row->page_namespace, $row->page_title );