https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113505

Revision: 113505
Author:   aaron
Date:     2012-03-09 19:36:19 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
Made FileOp::allowStaleReads take a boolean argument (more versatile) and 
killed a few lines of code.

Modified Paths:
--------------
    trunk/phase3/includes/filerepo/backend/FileOp.php

Modified: trunk/phase3/includes/filerepo/backend/FileOp.php
===================================================================
--- trunk/phase3/includes/filerepo/backend/FileOp.php   2012-03-09 19:27:55 UTC 
(rev 113504)
+++ trunk/phase3/includes/filerepo/backend/FileOp.php   2012-03-09 19:36:19 UTC 
(rev 113505)
@@ -63,12 +63,13 @@
        }
 
        /**
-        * Allow stale data for file reads and existence checks
+        * Whether to allow stale data for file reads and stat checks
         *
+        * @param $allowStale bool
         * @return void
         */
-       final protected function allowStaleReads() {
-               $this->useLatest = false;
+       final protected function allowStaleReads( $allowStale ) {
+               $this->useLatest = !$allowStale;
        }
 
        /**
@@ -105,9 +106,7 @@
                $predicates = FileOp::newPredicates(); // account for previous 
op in prechecks
                // Do pre-checks for each operation; abort on failure...
                foreach ( $performOps as $index => $fileOp ) {
-                       if ( $allowStale ) {
-                               $fileOp->allowStaleReads(); // allow 
potentially stale reads
-                       }
+                       $fileOp->allowStaleReads( $allowStale );
                        $subStatus = $fileOp->precheck( $predicates );
                        $status->merge( $subStatus );
                        if ( !$subStatus->isOK() ) { // operation failed?


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to