Add $flags, document
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 6 May 2008 14:54:17 +0000 (14:54 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 6 May 2008 14:54:17 +0000 (14:54 +0000)
includes/Title.php

index d5d315c..70673ac 100644 (file)
@@ -1891,11 +1891,16 @@ class Title {
                return $this->mLength;
        }
 
-       public function getLatestRevID() {
+       /**
+        * What is the page_latest field for this page?
+        * @param int $flags a bit field; may be GAID_FOR_UPDATE to select for update
+        * @return int
+        */
+       public function getLatestRevID( $flags = 0 ) {
                if ($this->mLatestID !== false)
                        return $this->mLatestID;
 
-               $db = wfGetDB(DB_SLAVE);
+               $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB(DB_MASTER) : wfGetDB(DB_SLAVE);
                return $this->mLatestID = $db->selectField( 'revision',
                        "max(rev_id)",
                        array('rev_page' => $this->getArticleID()),