From fc4683ae7b3b532d0a5cbbd63789f2c96307a8b4 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 19 May 2012 01:33:01 -0700 Subject: [PATCH] [FileBackend] Made supported ops check more explicit for sanity. Change-Id: I8d7b4e3dcae77f76d390432fe0c52366e63e3f2d --- includes/filerepo/backend/FileBackendStore.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/filerepo/backend/FileBackendStore.php b/includes/filerepo/backend/FileBackendStore.php index 88efe79862..95e8627778 100644 --- a/includes/filerepo/backend/FileBackendStore.php +++ b/includes/filerepo/backend/FileBackendStore.php @@ -949,6 +949,7 @@ abstract class FileBackendStore extends FileBackend { wfProfileIn( __METHOD__ . '-' . $this->name ); $status = Status::newGood(); + $supportedOps = array( 'create', 'store', 'copy', 'move', 'delete', 'null' ); $async = ( $this->parallelize === 'implicit' ); $maxConcurrency = $this->concurrency; // throttle @@ -957,12 +958,12 @@ abstract class FileBackendStore extends FileBackend { $curFileOpHandles = array(); // current handle batch // Perform the sync-only ops and build up op handles for the async ops... foreach ( $ops as $index => $params ) { - $method = $params['op'] . 'Internal'; // e.g. "storeInternal" - if ( !MWInit::methodExists( __CLASS__, $method ) ) { + if ( !in_array( $params['op'], $supportedOps ) ) { wfProfileOut( __METHOD__ . '-' . $this->name ); wfProfileOut( __METHOD__ ); throw new MWException( "Operation '{$params['op']}' is not supported." ); } + $method = $params['op'] . 'Internal'; // e.g. "storeInternal" $subStatus = $this->$method( array( 'async' => $async ) + $params ); if ( $subStatus->value instanceof FileBackendStoreOpHandle ) { // async if ( count( $curFileOpHandles ) >= $maxConcurrency ) { -- 2.20.1