r110671 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110670‎ | r110671 | r110672 >
Date:18:05, 3 February 2012
Author:aaron
Status:ok
Tags:filebackend 
Comment:
Per r108369 CR comment, use StringUtils::escapeRegexReplacement() since backend name can have $1 or such. Also added comments to discourage such characters in backend names.
Modified paths:
  • /trunk/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FileBackendMultiWrite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/FileBackendMultiWrite.php
@@ -256,7 +256,7 @@
257257 protected function substPaths( $paths, FileBackendStore $backend ) {
258258 return preg_replace(
259259 '!^mwstore://' . preg_quote( $this->name ) . '/!',
260 - 'mwstore://' . $backend->getName() . '/',
 260+ StringUtils::escapeRegexReplacement( "mwstore://{$backend->getName()}/" ),
261261 $paths // string or array
262262 );
263263 }
@@ -270,7 +270,7 @@
271271 protected function unsubstPaths( $paths ) {
272272 return preg_replace(
273273 '!^mwstore://([^/]+)!',
274 - "mwstore://{$this->name}",
 274+ StringUtils::escapeRegexReplacement( "mwstore://{$this->name}" ),
275275 $paths // string or array
276276 );
277277 }
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -42,8 +42,9 @@
4343 *
4444 * $config includes:
4545 * 'name' : The unique name of this backend.
 46+ * This should consist of alphanumberic, '-', and '_' characters.
4647 * 'wikiId' : Prefix to container names that is unique to this wiki.
47 - * This should consist of alphanumberic, '-', and '_' chars.
 48+ * This should consist of alphanumberic, '-', and '_' characters.
4849 * 'lockManager' : Registered name of a file lock manager to use.
4950 * 'readOnly' : Write operations are disallowed if this is a non-empty string.
5051 * It should be an explanation for the backend being read-only.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108369* Fixed 'success' value of doOperations() Status to match documentation....aaron22:10, 8 January 2012

Status & tagging log