r112838 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112837‎ | r112838 | r112839 >
Date:21:55, 1 March 2012
Author:aaron
Status:ok
Tags:
Comment:
Actually enforce the FileBackend name requirements instead of just having a comment
Modified paths:
  • /trunk/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -53,6 +53,7 @@
5454 * $config includes:
5555 * 'name' : The unique name of this backend.
5656 * This should consist of alphanumberic, '-', and '_' characters.
 57+ * This name should not be changed after use.
5758 * 'wikiId' : Prefix to container names that is unique to this wiki.
5859 * This should consist of alphanumberic, '-', and '_' characters.
5960 * 'lockManager' : Registered name of a file lock manager to use.
@@ -63,6 +64,9 @@
6465 */
6566 public function __construct( array $config ) {
6667 $this->name = $config['name'];
 68+ if ( !preg_match( '!^[a-zA-Z0-9-_]{1,255}$!', $this->name ) ) {
 69+ throw new MWException( "Backend name `{$this->name}` is invalid." );
 70+ }
6771 $this->wikiId = isset( $config['wikiId'] )
6872 ? $config['wikiId']
6973 : wfWikiID(); // e.g. "my_wiki-en_"

Follow-up revisions

RevisionCommit summaryAuthorDate
r113157MFT r112563, r112566, r112838, r112872, r112873, r112988, r113001, r113024, r...reedy17:36, 6 March 2012

Status & tagging log