https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112838

Revision: 112838
Author:   aaron
Date:     2012-03-01 21:55:22 +0000 (Thu, 01 Mar 2012)
Log Message:
-----------
Actually enforce the FileBackend name requirements instead of just having a 
comment

Modified Paths:
--------------
    trunk/phase3/includes/filerepo/backend/FileBackend.php

Modified: trunk/phase3/includes/filerepo/backend/FileBackend.php
===================================================================
--- trunk/phase3/includes/filerepo/backend/FileBackend.php      2012-03-01 
21:29:11 UTC (rev 112837)
+++ trunk/phase3/includes/filerepo/backend/FileBackend.php      2012-03-01 
21:55:22 UTC (rev 112838)
@@ -53,6 +53,7 @@
         * $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 @@
         */
        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_"


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to