Prohibit all moves from/to file namespace
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 23 Jul 2010 17:11:30 +0000 (17:11 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 23 Jul 2010 17:11:30 +0000 (17:11 +0000)
Per discussion on wikitech-l.  Previously, it was possible to move pages
to the file namespace, and move pages from the file namespace as long as
there was no associated file.

RELEASE-NOTES
includes/Title.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index c93e01a..e8ec3bb 100644 (file)
@@ -114,6 +114,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 24313) The preference to mark edits minor by default was removed,
   because it encourages edits to be marked minor accidentally and it can be
   easily replicated by custom user scripts for those who really want it.
+* Non-file pages can no longer be moved to the file namespace, nor vice versa.
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive
index e515783..9d2f4c9 100644 (file)
@@ -2899,11 +2899,11 @@ class Title {
 
                // Image-specific checks
                if ( $this->getNamespace() == NS_FILE ) {
+                       if ( $nt->getNamespace() != NS_FILE ) {
+                               $errors[] = array( 'imagenocrossnamespace' );
+                       }
                        $file = wfLocalFile( $this );
                        if ( $file->exists() ) {
-                               if ( $nt->getNamespace() != NS_FILE ) {
-                                       $errors[] = array( 'imagenocrossnamespace' );
-                               }
                                if ( $nt->getText() != wfStripIllegalFilenameChars( $nt->getText() ) ) {
                                        $errors[] = array( 'imageinvalidfilename' );
                                }
@@ -2915,7 +2915,10 @@ class Title {
                        if ( !$wgUser->isAllowed( 'reupload-shared' ) && !$destfile->exists() && wfFindFile( $nt ) ) {
                                $errors[] = array( 'file-exists-sharedrepo' );
                        }
+               }
 
+               if ( $nt->getNamespace() == NS_FILE && $this->getNamespace() != NS_FILE ) {
+                       $errors[] = array( 'nonfile-cannot-move-to-file' );
                }
 
                if ( $auth ) {
index 5760519..88f3ffa 100644 (file)
@@ -3169,6 +3169,7 @@ cannot move a page over itself.',
 'immobile-source-page'         => 'This page is not movable.',
 'immobile-target-page'         => 'Cannot move to that destination title.',
 'imagenocrossnamespace'        => 'Cannot move file to non-file namespace',
+'nonfile-cannot-move-to-file'  => 'Cannot move non-file to file namespace',
 'imagetypemismatch'            => 'The new file extension does not match its type',
 'imageinvalidfilename'         => 'The target file name is invalid',
 'fix-double-redirects'         => 'Update any redirects that point to the original title',
index 066aa89..e032ddb 100644 (file)
@@ -2145,6 +2145,7 @@ $wgMessageStructure = array(
                'immobile-target-page',
                'immobile_namespace',
                'imagenocrossnamespace',
+               'nonfile-cannot-move-to-file',
                'imagetypemismatch',
                'imageinvalidfilename',
                'fix-double-redirects',