jenkins-bot has submitted this change and it was merged.

Change subject: Make HTTPS requirement configurable.
......................................................................


Make HTTPS requirement configurable.

Bug: T114485
Change-Id: Ib1e14d6291823b278bf9361046f06c8fc1b255c7
---
M extension.json
M includes/SurveyFactory.php
2 files changed, 7 insertions(+), 1 deletion(-)

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



diff --git a/extension.json b/extension.json
index 6987d0a..ed684ce 100644
--- a/extension.json
+++ b/extension.json
@@ -112,6 +112,7 @@
                ]
        },
        "config": {
+               "QuickSurveysRequireHttps": true,
                "QuickSurveysConfig": [
                        {
                                "@name": "survey name",
diff --git a/includes/SurveyFactory.php b/includes/SurveyFactory.php
index 6f04953..8a255af 100644
--- a/includes/SurveyFactory.php
+++ b/includes/SurveyFactory.php
@@ -3,6 +3,7 @@
 namespace QuickSurveys;
 
 use InvalidArgumentException;
+use ConfigFactory;
 
 class SurveyFactory
 {
@@ -67,7 +68,11 @@
                        throw new InvalidArgumentException( "The \"{$name}\" 
external survey doesn't have a link." );
                }
 
-               if ( !preg_match( '/https/i', wfMessage( $spec['link'] ) ) ) {
+               $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'quicksurveys' );
+               if (
+                       $config->get( 'QuickSurveysRequireHttps' ) &&
+                       !preg_match( '/https/i', wfMessage( $spec['link'] ) )
+               ) {
                        throw new InvalidArgumentException( "The \"{$name}\" 
external survey link requires https." );
                }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1e14d6291823b278bf9361046f06c8fc1b255c7
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to