summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialImport.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialImport.php')
-rw-r--r--includes/specials/SpecialImport.php50
1 files changed, 29 insertions, 21 deletions
diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php
index 7d1cf0dd..fc904a23 100644
--- a/includes/specials/SpecialImport.php
+++ b/includes/specials/SpecialImport.php
@@ -30,14 +30,15 @@
* @ingroup SpecialPage
*/
class SpecialImport extends SpecialPage {
-
+
private $interwiki = false;
private $namespace;
private $frompage = '';
private $logcomment= false;
private $history = true;
private $includeTemplates = false;
-
+ private $pageLinkDepth;
+
/**
* Constructor
*/
@@ -46,26 +47,27 @@ class SpecialImport extends SpecialPage {
global $wgImportTargetNamespace;
$this->namespace = $wgImportTargetNamespace;
}
-
+
/**
* Execute
*/
function execute( $par ) {
global $wgRequest, $wgUser, $wgOut;
-
+
$this->setHeaders();
$this->outputHeader();
-
+
if ( wfReadOnly() ) {
$wgOut->readOnlyPage();
return;
}
-
- if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) )
+
+ if( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) {
return $wgOut->permissionRequired( 'import' );
+ }
- # TODO: allow Title::getUserPermissionsErrors() to take an array
- # FIXME: Title::checkSpecialsAndNSPermissions() has a very wierd expectation of what
+ # @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'
$errors = wfMergeErrorArrays(
$this->getTitle()->getUserPermissionsErrors(
@@ -88,7 +90,7 @@ class SpecialImport extends SpecialPage {
}
$this->showForm();
}
-
+
/**
* Do the actual import
*/
@@ -162,7 +164,7 @@ class SpecialImport extends SpecialPage {
# Success!
$wgOut->addWikiMsg( 'importsuccess' );
}
- $wgOut->addWikiText( '<hr />' );
+ $wgOut->addHTML( '<hr />' );
}
}
@@ -290,7 +292,7 @@ class SpecialImport extends SpecialPage {
<td>
</td>
<td class='mw-submit'>" .
- Xml::submitButton( wfMsg( 'import-interwiki-submit' ), $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'import' ) ) .
+ Xml::submitButton( wfMsg( 'import-interwiki-submit' ), Linker::tooltipAndAccesskeyAttribs( 'import' ) ) .
"</td>
</tr>" .
Xml::closeElement( 'table' ).
@@ -312,8 +314,8 @@ class ImportReporter {
private $mLogItemCount = 0;
function __construct( $importer, $upload, $interwiki , $reason=false ) {
- $this->mOriginalPageOutCallback =
- $importer->setPageOutCallback( array( $this, 'reportPage' ) );
+ $this->mOriginalPageOutCallback =
+ $importer->setPageOutCallback( array( $this, 'reportPage' ) );
$this->mOriginalLogCallback =
$importer->setLogItemCallback( array( $this, 'reportLogItem' ) );
$this->mPageCount = 0;
@@ -326,7 +328,7 @@ class ImportReporter {
global $wgOut;
$wgOut->addHTML( "<ul>\n" );
}
-
+
function reportLogItem( /* ... */ ) {
$this->mLogItemCount++;
if ( is_callable( $this->mOriginalLogCallback ) ) {
@@ -334,21 +336,27 @@ class ImportReporter {
}
}
+ /**
+ * @param Title $title
+ * @param Title $origTitle
+ * @param int $revisionCount
+ * @param $successCount
+ * @param $pageInfo
+ * @return void
+ */
function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
global $wgOut, $wgUser, $wgLang, $wgContLang;
-
+
$args = func_get_args();
call_user_func_array( $this->mOriginalPageOutCallback, $args );
- $skin = $wgUser->getSkin();
-
$this->mPageCount++;
$localCount = $wgLang->formatNum( $successCount );
$contentCount = $wgContLang->formatNum( $successCount );
if( $successCount > 0 ) {
- $wgOut->addHTML( "<li>" . $skin->linkKnown( $title ) . " " .
+ $wgOut->addHTML( "<li>" . Linker::linkKnown( $title ) . " " .
wfMsgExt( 'import-revision-count', array( 'parsemag', 'escape' ), $localCount ) .
"</li>\n"
);
@@ -382,14 +390,14 @@ class ImportReporter {
$article->updateRevisionOn( $dbw, $nullRevision );
wfRunHooks( 'NewRevisionFromEditComplete', array($article, $nullRevision, $latest, $wgUser) );
} else {
- $wgOut->addHTML( "<li>" . $skin->linkKnown( $title ) . " " .
+ $wgOut->addHTML( "<li>" . Linker::linkKnown( $title ) . " " .
wfMsgHtml( 'import-nonewrevisions' ) . "</li>\n" );
}
}
function close() {
global $wgOut, $wgLang;
-
+
if ( $this->mLogItemCount > 0 ) {
$msg = wfMsgExt( 'imported-log-entries', 'parseinline',
$wgLang->formatNum( $this->mLogItemCount ) );