Index: trunk/phase3/includes/Import.php |
— | — | @@ -712,7 +712,12 @@ |
713 | 713 | return $info; |
714 | 714 | } |
715 | 715 | |
| 716 | + /** |
| 717 | + * @return Array or false |
| 718 | + */ |
716 | 719 | private function processTitle( $text ) { |
| 720 | + global $wgCommandLineMode; |
| 721 | + |
717 | 722 | $workTitle = $text; |
718 | 723 | $origTitle = Title::newFromText( $workTitle ); |
719 | 724 | |
— | — | @@ -724,12 +729,20 @@ |
725 | 730 | } |
726 | 731 | |
727 | 732 | if( is_null( $title ) ) { |
728 | | - // Invalid page title? Ignore the page |
| 733 | + # Invalid page title? Ignore the page |
729 | 734 | $this->notice( "Skipping invalid page title '$workTitle'" ); |
730 | 735 | return false; |
731 | 736 | } elseif( $title->getInterwiki() != '' ) { |
732 | 737 | $this->notice( "Skipping interwiki page title '$workTitle'" ); |
733 | 738 | 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; |
734 | 747 | } |
735 | 748 | |
736 | 749 | return array( $title, $origTitle ); |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3370,6 +3370,8 @@ |
3371 | 3371 | 'import-token-mismatch' => 'Loss of session data. |
3372 | 3372 | Please try again.', |
3373 | 3373 | '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.', |
3374 | 3376 | |
3375 | 3377 | # Import log |
3376 | 3378 | 'importlogpage' => 'Import log', |