(bug 23057) Importers can 'edit' or 'create' a fully-protected page by importing a new revision into it
This commit is contained in:
parent
ef1e4d3e13
commit
2ed55f42e4
2 changed files with 16 additions and 1 deletions
|
|
@ -712,7 +712,12 @@ class WikiImporter {
|
|||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Array or false
|
||||
*/
|
||||
private function processTitle( $text ) {
|
||||
global $wgCommandLineMode;
|
||||
|
||||
$workTitle = $text;
|
||||
$origTitle = Title::newFromText( $workTitle );
|
||||
|
||||
|
|
@ -724,12 +729,20 @@ class WikiImporter {
|
|||
}
|
||||
|
||||
if( is_null( $title ) ) {
|
||||
// Invalid page title? Ignore the page
|
||||
# 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'" );
|
||||
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() );
|
||||
return false;
|
||||
} elseif( !$title->exists() && !$title->userCan( 'create' ) && !$wgCommandLineMode ) {
|
||||
# Do not import if the importing wiki user cannot create this page
|
||||
$this->notice( wfMessage( 'import-error-create', $title->getText() )->text() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return array( $title, $origTitle );
|
||||
|
|
|
|||
|
|
@ -3370,6 +3370,8 @@ A temporary folder is missing.',
|
|||
'import-token-mismatch' => 'Loss of session data.
|
||||
Please try again.',
|
||||
'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 log
|
||||
'importlogpage' => 'Import log',
|
||||
|
|
|
|||
Loading…
Reference in a new issue