Merge "(bug 47070) check content model namespace on import."
[lhc/web/wiklou.git] / includes / filebackend / FileBackendMultiWrite.php
index b3c46c6..1b2860a 100644 (file)
@@ -92,7 +92,7 @@ class FileBackendMultiWrite extends FileBackend {
         *   - noPushDirConts : (hack) Only apply directory functions to the master backend.
         *
         * @param array $config
-        * @throws MWException
+        * @throws FileBackendError
         */
        public function __construct( array $config ) {
                parent::__construct( $config );
@@ -119,30 +119,30 @@ class FileBackendMultiWrite extends FileBackend {
                        }
                        $name = $config['name'];
                        if ( isset( $namesUsed[$name] ) ) { // don't break FileOp predicates
-                               throw new MWException( "Two or more backends defined with the name $name." );
+                               throw new FileBackendError( "Two or more backends defined with the name $name." );
                        }
                        $namesUsed[$name] = 1;
                        // Alter certain sub-backend settings for sanity
                        unset( $config['readOnly'] ); // use proxy backend setting
                        unset( $config['fileJournal'] ); // use proxy backend journal
+                       unset( $config['lockManager'] ); // lock under proxy backend
                        $config['wikiId'] = $this->wikiId; // use the proxy backend wiki ID
-                       $config['lockManager'] = 'nullLockManager'; // lock under proxy backend
                        if ( !empty( $config['isMultiMaster'] ) ) {
                                if ( $this->masterIndex >= 0 ) {
-                                       throw new MWException( 'More than one master backend defined.' );
+                                       throw new FileBackendError( 'More than one master backend defined.' );
                                }
                                $this->masterIndex = $index; // this is the "master"
                                $config['fileJournal'] = $this->fileJournal; // log under proxy backend
                        }
                        // Create sub-backend object
                        if ( !isset( $config['class'] ) ) {
-                               throw new MWException( 'No class given for a backend config.' );
+                               throw new FileBackendError( 'No class given for a backend config.' );
                        }
                        $class = $config['class'];
                        $this->backends[$index] = new $class( $config );
                }
                if ( $this->masterIndex < 0 ) { // need backends and must have a master
-                       throw new MWException( 'No master backend defined.' );
+                       throw new FileBackendError( 'No master backend defined.' );
                }
        }
 
@@ -567,6 +567,11 @@ class FileBackendMultiWrite extends FileBackend {
                return $this->backends[$this->masterIndex]->getFileStat( $realParams );
        }
 
+       public function getFileXAttributes( array $params ) {
+               $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
+               return $this->backends[$this->masterIndex]->getFileXAttributes( $realParams );
+       }
+
        public function getFileContentsMulti( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
                $contentsM = $this->backends[$this->masterIndex]->getFileContentsMulti( $realParams );
@@ -645,6 +650,10 @@ class FileBackendMultiWrite extends FileBackend {
                return $this->backends[$this->masterIndex]->getFileList( $realParams );
        }
 
+       public function getFeatures() {
+               return $this->backends[$this->masterIndex]->getFeatures();
+       }
+
        public function clearCache( array $paths = null ) {
                foreach ( $this->backends as $backend ) {
                        $realPaths = is_array( $paths ) ? $this->substPaths( $paths, $backend ) : null;