Modernized slave wait checks in recompressTracked.php
[lhc/web/wiklou.git] / includes / Revision.php
index 32ee259..90d6265 100644 (file)
@@ -773,7 +773,7 @@ class Revision implements IDBAccessObject {
                if ( $this->mTitle !== null ) {
                        return $this->mTitle;
                }
-               //rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
+               // rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
                if ( $this->mId !== null ) {
                        $dbr = wfGetDB( DB_SLAVE );
                        $row = $dbr->selectRow(
@@ -948,18 +948,25 @@ class Revision implements IDBAccessObject {
        /**
         * Get the RC object belonging to the current revision, if there's one
         *
+        * @param int $flags (optional) $flags include:
+        *      Revision::READ_LATEST  : Select the data from the master
+        *
         * @since 1.22
         * @return RecentChange|null
         */
-       public function getRecentChange() {
+       public function getRecentChange( $flags = 0 ) {
                $dbr = wfGetDB( DB_SLAVE );
+
+               list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
+
                return RecentChange::newFromConds(
                        array(
                                'rc_user_text' => $this->getUserText( Revision::RAW ),
                                'rc_timestamp' => $dbr->timestamp( $this->getTimestamp() ),
                                'rc_this_oldid' => $this->getId()
                        ),
-                       __METHOD__
+                       __METHOD__,
+                       $dbType
                );
        }
 
@@ -1418,8 +1425,8 @@ class Revision implements IDBAccessObject {
                );
 
                if ( $wgContentHandlerUseDB ) {
-                       //NOTE: Store null for the default model and format, to save space.
-                       //XXX: Makes the DB sensitive to changed defaults.
+                       // NOTE: Store null for the default model and format, to save space.
+                       // XXX: Makes the DB sensitive to changed defaults.
                        // Make this behavior optional? Only in miser mode?
 
                        $model = $this->getContentModel();
@@ -1459,7 +1466,7 @@ class Revision implements IDBAccessObject {
        protected function checkContentModel() {
                global $wgContentHandlerUseDB;
 
-               $title = $this->getTitle(); //note: may return null for revisions that have not yet been inserted.
+               $title = $this->getTitle(); // note: may return null for revisions that have not yet been inserted.
 
                $model = $this->getContentModel();
                $format = $this->getContentFormat();