From: Aaron Schulz Date: Thu, 1 Mar 2012 21:55:22 +0000 (+0000) Subject: Actually enforce the FileBackend name requirements instead of just having a comment X-Git-Tag: 1.31.0-rc.0~24439 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=c3bdf64a991c656cbb855e7d89f3871de4566cdc;p=lhc%2Fweb%2Fwiklou.git Actually enforce the FileBackend name requirements instead of just having a comment --- diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index 1923d287a3..78d71b5353 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -53,6 +53,7 @@ abstract class FileBackend { * $config includes: * 'name' : The unique name of this backend. * This should consist of alphanumberic, '-', and '_' characters. + * This name should not be changed after use. * 'wikiId' : Prefix to container names that is unique to this wiki. * This should consist of alphanumberic, '-', and '_' characters. * 'lockManager' : Registered name of a file lock manager to use. @@ -63,6 +64,9 @@ abstract class FileBackend { */ public function __construct( array $config ) { $this->name = $config['name']; + if ( !preg_match( '!^[a-zA-Z0-9-_]{1,255}$!', $this->name ) ) { + throw new MWException( "Backend name `{$this->name}` is invalid." ); + } $this->wikiId = isset( $config['wikiId'] ) ? $config['wikiId'] : wfWikiID(); // e.g. "my_wiki-en_"