[FileBackend] Moved short-circuit check from 6b1194b9 up to FileBackend.
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 10 May 2013 20:55:39 +0000 (13:55 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 10 May 2013 20:55:39 +0000 (13:55 -0700)
Change-Id: I57566a1779f353c18d96c59c47112c753aea6b90

includes/filebackend/FileBackend.php
includes/filebackend/FileBackendStore.php

index 0c9f7a1..ab30d30 100644 (file)
@@ -314,6 +314,9 @@ abstract class FileBackend {
                if ( empty( $opts['bypassReadOnly'] ) && $this->isReadOnly() ) {
                        return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
                }
+               if ( !count( $ops ) ) {
+                       return Status::newGood(); // nothing to do
+               }
                if ( empty( $opts['force'] ) ) { // sanity
                        unset( $opts['nonLocking'] );
                }
@@ -545,6 +548,9 @@ abstract class FileBackend {
                if ( empty( $opts['bypassReadOnly'] ) && $this->isReadOnly() ) {
                        return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
                }
+               if ( !count( $ops ) ) {
+                       return Status::newGood(); // nothing to do
+               }
                foreach ( $ops as &$op ) {
                        $op['overwrite'] = true; // avoids RTTs in key/value stores
                        if ( isset( $op['disposition'] ) ) { // b/c (MW 1.20)
index c620dd3..e20c6fc 100644 (file)
@@ -1134,10 +1134,6 @@ abstract class FileBackendStore extends FileBackend {
                wfProfileIn( __METHOD__ . '-' . $this->name );
                $status = Status::newGood();
 
-               if ( !count( $ops ) ) {
-                       return $status; // nothing to do
-               }
-
                // Fix up custom header name/value pairs...
                $ops = array_map( array( $this, 'stripInvalidHeadersFromOp' ), $ops );
 
@@ -1190,10 +1186,6 @@ abstract class FileBackendStore extends FileBackend {
                wfProfileIn( __METHOD__ . '-' . $this->name );
                $status = Status::newGood();
 
-               if ( !count( $ops ) ) {
-                       return $status; // nothing to do
-               }
-
                // Fix up custom header name/value pairs...
                $ops = array_map( array( $this, 'stripInvalidHeadersFromOp' ), $ops );