r96311 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96310‎ | r96311 | r96312 >
Date:00:01, 6 September 2011
Author:robin
Status:resolved (Comments)
Tags:
Comment:
(bug 23057) Importers can 'edit' or 'create' a fully-protected page by importing a new revision into it
Modified paths:
  • /trunk/phase3/includes/Import.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Import.php
@@ -712,7 +712,12 @@
713713 return $info;
714714 }
715715
 716+ /**
 717+ * @return Array or false
 718+ */
716719 private function processTitle( $text ) {
 720+ global $wgCommandLineMode;
 721+
717722 $workTitle = $text;
718723 $origTitle = Title::newFromText( $workTitle );
719724
@@ -724,12 +729,20 @@
725730 }
726731
727732 if( is_null( $title ) ) {
728 - // Invalid page title? Ignore the page
 733+ # Invalid page title? Ignore the page
729734 $this->notice( "Skipping invalid page title '$workTitle'" );
730735 return false;
731736 } elseif( $title->getInterwiki() != '' ) {
732737 $this->notice( "Skipping interwiki page title '$workTitle'" );
733738 return false;
 739+ } elseif( !$title->userCan( 'edit' ) && !$wgCommandLineMode ) {
 740+ # Do not import if the importing wiki user cannot edit this page
 741+ $this->notice( wfMessage( 'import-error-edit', $title->getText() )->text() );
 742+ return false;
 743+ } elseif( !$title->exists() && !$title->userCan( 'create' ) && !$wgCommandLineMode ) {
 744+ # Do not import if the importing wiki user cannot create this page
 745+ $this->notice( wfMessage( 'import-error-create', $title->getText() )->text() );
 746+ return false;
734747 }
735748
736749 return array( $title, $origTitle );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3370,6 +3370,8 @@
33713371 'import-token-mismatch' => 'Loss of session data.
33723372 Please try again.',
33733373 'import-invalid-interwiki' => 'Cannot import from the specified wiki.',
 3374+'import-error-edit' => 'Page "$1" is not imported because you are not allowed to edit it.',
 3375+'import-error-create' => 'Page "$1" is not imported because you are not allowed to create it.',
33743376
33753377 # Import log
33763378 'importlogpage' => 'Import log',

Follow-up revisions

RevisionCommit summaryAuthorDate
r96312release notes for r96311robin00:04, 6 September 2011
r96334Add new messages of r96311 to messages.incrobin14:08, 6 September 2011

Comments

#Comment by Siebrand (talk | contribs)   06:11, 6 September 2011

messages.inc entries are missing.

#Comment by SPQRobin (talk | contribs)   14:08, 6 September 2011

Added in r96334

Status & tagging log