jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/361696 )

Change subject: Add beta warning and exclude from special pages list
......................................................................


Add beta warning and exclude from special pages list

Bug: T169066
Change-Id: I869c386413697eea8a012125f79e69cb21425304
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M src/SpecialImportFile.php
4 files changed, 20 insertions(+), 6 deletions(-)

Approvals:
  WMDE-Fisch: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index 996002c..fb08b70 100644
--- a/extension.json
+++ b/extension.json
@@ -80,6 +80,7 @@
        ],
        "config": {
                "FileImporterRequiredRight": "upload",
+               "FileImporterInBeta": true,
                "FileImporterSourceSiteServices": [
                        "FileImporterSitesTableMediaWikiSite"
                ],
diff --git a/i18n/en.json b/i18n/en.json
index a81b5ca..1f2a559 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -45,5 +45,6 @@
        "fileimporter-heading-fileinfo": "File info",
        "fileimporter-heading-filehistory": "File history",
        "fileimporter-revision-removed-text": "Suppressed text removed by 
FileImporter.",
-       "fileimporter-revision-removed-comment": "Suppressed comment removed by 
FileImporter."
+       "fileimporter-revision-removed-comment": "Suppressed comment removed by 
FileImporter.",
+       "fileimporter-in-beta": "File import is in beta mode: We tested it 
carefully but it still might have some problems. If you encounter problems, 
please [//www.mediawiki.org/w/index.php?title=Extension_talk:FileImporter 
report them on our help page] - ideally with a step by step way to reproduce 
the problem, so we can understand and fix it."
 }
\ No newline at end of file
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 2ac13f3..655cea4 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -47,5 +47,6 @@
        "fileimporter-heading-fileinfo": "Heading of the file info on the 
import page.",
        "fileimporter-heading-filehistory": "Heading of the file history on the 
import page.",
        "fileimporter-revision-removed-text": "Text inserted if the original 
text is suppressed.",
-       "fileimporter-revision-removed-comment": "Text inserted as a revision 
comment if the original comment is suppressed."
+       "fileimporter-revision-removed-comment": "Text inserted as a revision 
comment if the original comment is suppressed.",
+       "fileimporter-in-beta": "Text shown when the special page is loaded 
warning the user that the extension is in beta."
 }
diff --git a/src/SpecialImportFile.php b/src/SpecialImportFile.php
index d8e76b9..7b45ee3 100644
--- a/src/SpecialImportFile.php
+++ b/src/SpecialImportFile.php
@@ -47,11 +47,17 @@
         */
        private $importPlanFactory;
 
+       private $config;
+
        public function __construct() {
                $services = MediaWikiServices::getInstance();
-               $config = $services->getMainConfig();
+               $this->config = $services->getMainConfig();
 
-               parent::__construct( 'FileImporter-SpecialPage', $config->get( 
'FileImporterRequiredRight' ) );
+               parent::__construct(
+                       'FileImporter-SpecialPage',
+                       $this->config->get( 'FileImporterRequiredRight' ),
+                       !$this->config->get( 'FileImporterInBeta' )
+               );
 
                // TODO inject services!
                $this->sourceSiteLocator = $services->getService( 
'FileImporterSourceSiteLocator' );
@@ -231,8 +237,9 @@
                        Html::rawElement(
                                'div',
                                [ 'class' => 'warningbox' ],
-                               Html::element( 'p', [], $message )
-                       )
+                               Html::rawElement( 'p', [], $message )
+                       ) .
+                       Html::rawElement( 'br' )
                );
        }
 
@@ -243,6 +250,10 @@
        }
 
        private function showInputForm( SourceUrl $sourceUrl = null ) {
+               if ( $this->config->get( 'FileImporterInBeta' ) ) {
+                       $this->showWarningMessage( ( new Message( 
'fileimporter-in-beta' ) )->parse() );
+               }
+
                $this->getOutput()->addHTML( ( new InputFormPage( $this, 
$sourceUrl ) )->getHtml() );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/361696
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I869c386413697eea8a012125f79e69cb21425304
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/FileImporter
Gerrit-Branch: master
Gerrit-Owner: Andrew-WMDE <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Andrew-WMDE <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: WMDE-Fisch <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to