Index: trunk/phase3/includes/filerepo/backend/FileBackend.php |
— | — | @@ -53,6 +53,7 @@ |
54 | 54 | * $config includes: |
55 | 55 | * 'name' : The unique name of this backend. |
56 | 56 | * This should consist of alphanumberic, '-', and '_' characters. |
| 57 | + * This name should not be changed after use. |
57 | 58 | * 'wikiId' : Prefix to container names that is unique to this wiki. |
58 | 59 | * This should consist of alphanumberic, '-', and '_' characters. |
59 | 60 | * 'lockManager' : Registered name of a file lock manager to use. |
— | — | @@ -63,6 +64,9 @@ |
64 | 65 | */ |
65 | 66 | public function __construct( array $config ) { |
66 | 67 | $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 | + } |
67 | 71 | $this->wikiId = isset( $config['wikiId'] ) |
68 | 72 | ? $config['wikiId'] |
69 | 73 | : wfWikiID(); // e.g. "my_wiki-en_" |