throw new PermissionsError( 'import' );
}
- if ( wfReadOnly() ) {
- throw new ReadOnlyError;
- }
-
# @todo Allow Title::getUserPermissionsErrors() to take an array
# @todo FIXME: Title::checkSpecialsAndNSPermissions() has a very wierd expectation of what
# getUserPermissionsErrors() might actually be used for, hence the 'ns-specialprotected'
)
);
- if( $errors ){
- $this->getOutput()->showPermissionsErrorPage( $errors );
- return;
+ if ( $errors ) {
+ throw new PermissionsError( 'import', $errors );
}
+ $this->checkReadOnly();
+
$request = $this->getRequest();
if ( $request->wasPosted() && $request->getVal( 'action' ) == 'submit' ) {
$this->doImport();
if( $user->isAllowed( 'importupload' ) ) {
$source = ImportStreamSource::newFromUpload( "xmlimport" );
} else {
- return $this->getOutput()->permissionRequired( 'importupload' );
+ throw new PermissionsError( 'importupload' );
}
} elseif ( $sourceName == "interwiki" ) {
if( !$user->isAllowed( 'import' ) ){
- return $this->getOutput()->permissionRequired( 'import' );
+ throw new PermissionsError( 'import' );
}
$this->interwiki = $request->getVal( 'interwiki' );
if ( !in_array( $this->interwiki, $wgImportSources ) ) {
"</td>
</tr>" .
Xml::closeElement( 'table' ).
- Html::hidden( 'editToken', $user->editToken() ) .
+ Html::hidden( 'editToken', $user->getEditToken() ) .
Xml::closeElement( 'form' ) .
Xml::closeElement( 'fieldset' )
);
wfMsgExt( 'import-interwiki-text', array( 'parse' ) ) .
Html::hidden( 'action', 'submit' ) .
Html::hidden( 'source', 'interwiki' ) .
- Html::hidden( 'editToken', $user->editToken() ) .
+ Html::hidden( 'editToken', $user->getEditToken() ) .
Xml::openElement( 'table', array( 'id' => 'mw-import-table' ) ) .
"<tr>
<td class='mw-label'>" .
$this->mPageCount++;
- $localCount = $this->getLang()->formatNum( $successCount );
+ $localCount = $this->getLanguage()->formatNum( $successCount );
$contentCount = $wgContLang->formatNum( $successCount );
if( $successCount > 0 ) {
$nullRevision = Revision::newNullRevision( $dbw, $title->getArticleId(), $comment, true );
if (!is_null($nullRevision)) {
$nullRevision->insertOn( $dbw );
- $article = new Article( $title );
+ $page = WikiPage::factory( $title );
# Update page record
- $article->updateRevisionOn( $dbw, $nullRevision );
- wfRunHooks( 'NewRevisionFromEditComplete', array( $article, $nullRevision, $latest, $this->getUser() ) );
+ $page->updateRevisionOn( $dbw, $nullRevision );
+ wfRunHooks( 'NewRevisionFromEditComplete', array( $page, $nullRevision, $latest, $this->getUser() ) );
}
} else {
$this->getOutput()->addHTML( "<li>" . Linker::linkKnown( $title ) . " " .
$out = $this->getOutput();
if ( $this->mLogItemCount > 0 ) {
$msg = wfMsgExt( 'imported-log-entries', 'parseinline',
- $this->getLang()->formatNum( $this->mLogItemCount ) );
+ $this->getLanguage()->formatNum( $this->mLogItemCount ) );
$out->addHTML( Xml::tags( 'li', null, $msg ) );
} elseif( $this->mPageCount == 0 && $this->mLogItemCount == 0 ) {
$out->addHTML( "</ul>\n" );