Per r108369 CR comment, use StringUtils::escapeRegexReplacement() since backend name...
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 3 Feb 2012 18:05:33 +0000 (18:05 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 3 Feb 2012 18:05:33 +0000 (18:05 +0000)
includes/filerepo/backend/FileBackend.php
includes/filerepo/backend/FileBackendMultiWrite.php

index 3dc09e1..27e3b84 100644 (file)
@@ -42,8 +42,9 @@ abstract class FileBackend {
         * 
         * $config includes:
         *     'name'        : The unique name of this backend.
+        *                     This should consist of alphanumberic, '-', and '_' characters.
         *     'wikiId'      : Prefix to container names that is unique to this wiki.
-        *                     This should consist of alphanumberic, '-', and '_' chars.
+        *                     This should consist of alphanumberic, '-', and '_' characters.
         *     'lockManager' : Registered name of a file lock manager to use.
         *     'readOnly'    : Write operations are disallowed if this is a non-empty string.
         *                     It should be an explanation for the backend being read-only.
index 550a8af..c0f1ac5 100644 (file)
@@ -256,7 +256,7 @@ class FileBackendMultiWrite extends FileBackend {
        protected function substPaths( $paths, FileBackendStore $backend ) {
                return preg_replace(
                        '!^mwstore://' . preg_quote( $this->name ) . '/!',
-                       'mwstore://' . $backend->getName() . '/',
+                       StringUtils::escapeRegexReplacement( "mwstore://{$backend->getName()}/" ),
                        $paths // string or array
                );
        }
@@ -270,7 +270,7 @@ class FileBackendMultiWrite extends FileBackend {
        protected function unsubstPaths( $paths ) {
                return preg_replace(
                        '!^mwstore://([^/]+)!',
-                       "mwstore://{$this->name}",
+                       StringUtils::escapeRegexReplacement( "mwstore://{$this->name}" ),
                        $paths // string or array
                );
        }