r113505 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113504‎ | r113505 | r113506 >
Date:19:36, 9 March 2012
Author:aaron
Status:ok
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/FileOp.php
@@ -63,12 +63,13 @@
6464 }
6565
6666 /**
67 - * Allow stale data for file reads and existence checks
 67+ * Whether to allow stale data for file reads and stat checks
6868 *
 69+ * @param $allowStale bool
6970 * @return void
7071 */
71 - final protected function allowStaleReads() {
72 - $this->useLatest = false;
 72+ final protected function allowStaleReads( $allowStale ) {
 73+ $this->useLatest = !$allowStale;
7374 }
7475
7576 /**
@@ -105,9 +106,7 @@
106107 $predicates = FileOp::newPredicates(); // account for previous op in prechecks
107108 // Do pre-checks for each operation; abort on failure...
108109 foreach ( $performOps as $index => $fileOp ) {
109 - if ( $allowStale ) {
110 - $fileOp->allowStaleReads(); // allow potentially stale reads
111 - }
 110+ $fileOp->allowStaleReads( $allowStale );
112111 $subStatus = $fileOp->precheck( $predicates );
113112 $status->merge( $subStatus );
114113 if ( !$subStatus->isOK() ) { // operation failed?

Status & tagging log