From: Aaron Schulz Date: Fri, 9 Mar 2012 19:36:19 +0000 (+0000) Subject: Made FileOp::allowStaleReads take a boolean argument (more versatile) and killed... X-Git-Tag: 1.31.0-rc.0~24315 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=1b4dc593f16a532a088839ce7f38101efba04fea;p=lhc%2Fweb%2Fwiklou.git Made FileOp::allowStaleReads take a boolean argument (more versatile) and killed a few lines of code. --- diff --git a/includes/filerepo/backend/FileOp.php b/includes/filerepo/backend/FileOp.php index 312a531006..825a666b55 100644 --- a/includes/filerepo/backend/FileOp.php +++ b/includes/filerepo/backend/FileOp.php @@ -63,12 +63,13 @@ abstract class FileOp { } /** - * 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 @@ abstract class FileOp { $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?