r108223 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108222‎ | r108223 | r108224 >
Date:12:06, 6 January 2012
Author:ialex
Status:ok
Tags:
Comment:
* 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 (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -2353,6 +2353,8 @@
23542354 'import-invalid-interwiki',
23552355 'import-error-edit',
23562356 'import-error-create',
 2357+ 'import-error-interwiki',
 2358+ 'import-error-special',
23572359 ),
23582360 'importlog' => array(
23592361 'importlogpage',
Index: trunk/phase3/includes/Import.php
@@ -782,9 +782,12 @@
783783 # Invalid page title? Ignore the page
784784 $this->notice( "Skipping invalid page title '$workTitle'" );
785785 return false;
786 - } elseif( $title->getInterwiki() != '' ) {
787 - $this->notice( "Skipping interwiki page title '$workTitle'" );
 786+ } elseif( $title->isExternal() ) {
 787+ $this->notice( wfMessage( 'import-error-interwiki', $title->getText() )->text() );
788788 return false;
 789+ } elseif( !$title->canExist() ) {
 790+ $this->notice( wfMessage( 'import-error-special', $title->getText() )->text() );
 791+ return false;
789792 } elseif( !$title->userCan( 'edit' ) && !$wgCommandLineMode ) {
790793 # Do not import if the importing wiki user cannot edit this page
791794 $this->notice( wfMessage( 'import-error-edit', $title->getText() )->text() );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3398,6 +3398,8 @@
33993399 'import-invalid-interwiki' => 'Cannot import from the specified wiki.',
34003400 'import-error-edit' => 'Page "$1" is not imported because you are not allowed to edit it.',
34013401 'import-error-create' => 'Page "$1" is not imported because you are not allowed to create it.',
 3402+'import-error-interwiki' => 'Page "$1" is not imported because its name is reserved for external linking (interwiki).',
 3403+'import-error-special' => 'Page "$1" is not imported because it belongs to a special namespace that does not allow pages.',
34023404
34033405 # Import log
34043406 'importlogpage' => 'Import log',

Status & tagging log