From: This, that and the other Date: Sun, 27 Jul 2014 11:02:59 +0000 (+1000) Subject: Preserve log comment text field value across import attempts X-Git-Tag: 1.31.0-rc.0~13734 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=5ed380bed54570a45ace6cc6c86db1ed99eb838f;p=lhc%2Fweb%2Fwiklou.git Preserve log comment text field value across import attempts This was first attempted way back in r45340, but was reverted in r45489. Bug: 16793 Change-Id: Ieb9fb7e7e918b2e7e2b8289b3fdf82a49ea75a17 --- diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index eab4784cef..3d762aa313 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -30,6 +30,7 @@ * @ingroup SpecialPage */ class SpecialImport extends SpecialPage { + private $sourceName = false; private $interwiki = false; private $subproject; private $fullInterwikiPrefix; @@ -98,7 +99,7 @@ class SpecialImport extends SpecialPage { $isUpload = false; $request = $this->getRequest(); $this->namespace = $request->getIntOrNull( 'namespace' ); - $sourceName = $request->getVal( "source" ); + $this->sourceName = $request->getVal( "source" ); $this->logcomment = $request->getText( 'log-comment' ); $this->pageLinkDepth = $this->getConfig()->get( 'ExportMaxLinkDepth' ) == 0 @@ -109,14 +110,14 @@ class SpecialImport extends SpecialPage { $user = $this->getUser(); if ( !$user->matchEditToken( $request->getVal( 'editToken' ) ) ) { $source = Status::newFatal( 'import-token-mismatch' ); - } elseif ( $sourceName == 'upload' ) { + } elseif ( $this->sourceName == 'upload' ) { $isUpload = true; if ( $user->isAllowed( 'importupload' ) ) { $source = ImportStreamSource::newFromUpload( "xmlimport" ); } else { throw new PermissionsError( 'importupload' ); } - } elseif ( $sourceName == "interwiki" ) { + } elseif ( $this->sourceName == "interwiki" ) { if ( !$user->isAllowed( 'import' ) ) { throw new PermissionsError( 'import' ); } @@ -250,7 +251,8 @@ class SpecialImport extends SpecialPage { Xml::label( $this->msg( 'import-comment' )->text(), 'mw-import-comment' ) . " " . - Xml::input( 'log-comment', 50, '', + Xml::input( 'log-comment', 50, + ( $this->sourceName == 'upload' ? $this->logcomment : '' ), array( 'id' => 'mw-import-comment', 'type' => 'text' ) ) . ' ' . " @@ -430,7 +432,8 @@ class SpecialImport extends SpecialPage { Xml::label( $this->msg( 'import-comment' )->text(), 'mw-interwiki-comment' ) . " " . - Xml::input( 'log-comment', 50, '', + Xml::input( 'log-comment', 50, + ( $this->sourceName == 'interwiki' ? $this->logcomment : '' ), array( 'id' => 'mw-interwiki-comment', 'type' => 'text' ) ) . ' ' . "