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

Revision: 108223
Author:   ialex
Date:     2012-01-06 12:06:13 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
* Don't allow to import a page in the Media: namespace, this didn't work just 
because WikiPage::factory() throws an exception when a Title in NS_MEDIA is 
passed
* Added localised message when trying to import a page with an interwiki prefix

Modified Paths:
--------------
    trunk/phase3/includes/Import.php
    trunk/phase3/languages/messages/MessagesEn.php
    trunk/phase3/maintenance/language/messages.inc

Modified: trunk/phase3/includes/Import.php
===================================================================
--- trunk/phase3/includes/Import.php    2012-01-06 12:03:06 UTC (rev 108222)
+++ trunk/phase3/includes/Import.php    2012-01-06 12:06:13 UTC (rev 108223)
@@ -782,9 +782,12 @@
                        # Invalid page title? Ignore the page
                        $this->notice( "Skipping invalid page title 
'$workTitle'" );
                        return false;
-               } elseif( $title->getInterwiki() != '' ) {
-                       $this->notice( "Skipping interwiki page title 
'$workTitle'" );
+               } elseif( $title->isExternal() ) {
+                       $this->notice( wfMessage( 'import-error-interwiki', 
$title->getText() )->text() );
                        return false;
+               } elseif( !$title->canExist() ) {
+                       $this->notice( wfMessage( 'import-error-special', 
$title->getText() )->text() );
+                       return false;
                } elseif( !$title->userCan( 'edit' ) && !$wgCommandLineMode ) {
                        # Do not import if the importing wiki user cannot edit 
this page
                        $this->notice( wfMessage( 'import-error-edit', 
$title->getText() )->text() );

Modified: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php      2012-01-06 12:03:06 UTC 
(rev 108222)
+++ trunk/phase3/languages/messages/MessagesEn.php      2012-01-06 12:06:13 UTC 
(rev 108223)
@@ -3398,6 +3398,8 @@
 'import-invalid-interwiki'   => 'Cannot import from the specified wiki.',
 'import-error-edit'          => 'Page "$1" is not imported because you are not 
allowed to edit it.',
 'import-error-create'        => 'Page "$1" is not imported because you are not 
allowed to create it.',
+'import-error-interwiki'     => 'Page "$1" is not imported because its name is 
reserved for external linking (interwiki).',
+'import-error-special'       => 'Page "$1" is not imported because it belongs 
to a special namespace that does not allow pages.',
 
 # Import log
 'importlogpage'                    => 'Import log',

Modified: trunk/phase3/maintenance/language/messages.inc
===================================================================
--- trunk/phase3/maintenance/language/messages.inc      2012-01-06 12:03:06 UTC 
(rev 108222)
+++ trunk/phase3/maintenance/language/messages.inc      2012-01-06 12:06:13 UTC 
(rev 108223)
@@ -2353,6 +2353,8 @@
                'import-invalid-interwiki',
                'import-error-edit',
                'import-error-create',
+               'import-error-interwiki',
+               'import-error-special',
        ),
        'importlog' => array(
                'importlogpage',


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

Reply via email to