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

Change subject: Fix issues from recent extension registration changes
......................................................................


Fix issues from recent extension registration changes

* Move ApiFancyCaptchaReload.php into the FancyCaptcha subdir
* Fix include of recaptchalib.php
* Restore efReCaptcha() that was randomly deleted

Bug: T100775
Bug: T100504
Bug: T100505
Change-Id: I70f9c3f1610fed5aa4b88f3512b86e1a40d64a6b
(cherry picked from commit e5cb34c0583cee9ead0faff71eaad21b984b6d7e)
---
R FancyCaptcha/ApiFancyCaptchaReload.php
M ReCaptcha/extension.json
M includes/ConfirmEditHooks.php
3 files changed, 27 insertions(+), 2 deletions(-)

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



diff --git a/ApiFancyCaptchaReload.php b/FancyCaptcha/ApiFancyCaptchaReload.php
similarity index 100%
rename from ApiFancyCaptchaReload.php
rename to FancyCaptcha/ApiFancyCaptchaReload.php
diff --git a/ReCaptcha/extension.json b/ReCaptcha/extension.json
index 5f97810..79c9049 100644
--- a/ReCaptcha/extension.json
+++ b/ReCaptcha/extension.json
@@ -1,7 +1,7 @@
 {
        "name": "ReCaptcha",
        "ExtensionFunctions": [
-               "efReCaptcha"
+               "ConfirmEditHooks::efReCaptcha"
        ],
        "MessagesDirs": {
                "ReCaptcha": [
diff --git a/includes/ConfirmEditHooks.php b/includes/ConfirmEditHooks.php
index 5f9c338..41c990f 100644
--- a/includes/ConfirmEditHooks.php
+++ b/includes/ConfirmEditHooks.php
@@ -139,11 +139,36 @@
                        $wgCaptchaDirectory = "$wgUploadDirectory/captcha";
                }
        }
+
        /**
         * Callback for extension.json of ReCaptcha to require the recaptcha 
library php file.
         * FIXME: This should be done in a better way, e.g. only load the 
libraray, if really needed.
         */
        public static function onReCaptchaSetup() {
-               require_once( "ReCaptcha/recaptchalib.php" );
+               require_once( __DIR__ . '/../ReCaptcha/recaptchalib.php' );
+       }
+
+       /**
+        * Extension function, moved from ReCaptcha.php when that was decimated.
+        * Make sure the keys are defined.
+        */
+       public static function efReCaptcha() {
+               global $wgReCaptchaPublicKey, $wgReCaptchaPrivateKey;
+               global $recaptcha_public_key, $recaptcha_private_key;
+               global $wgServerName;
+
+               // Backwards compatibility
+               if ( $wgReCaptchaPublicKey == '' ) {
+                       $wgReCaptchaPublicKey = $recaptcha_public_key;
+               }
+               if ( $wgReCaptchaPrivateKey == '' ) {
+                       $wgReCaptchaPrivateKey = $recaptcha_private_key;
+               }
+
+               if ( $wgReCaptchaPublicKey == '' || $wgReCaptchaPrivateKey == 
'' ) {
+                       die ( 'You need to set $wgReCaptchaPrivateKey and 
$wgReCaptchaPublicKey in LocalSettings.php to ' .
+                               "use the reCAPTCHA plugin. You can sign up for 
a key <a href='" .
+                               htmlentities( recaptcha_get_signup_url ( 
$wgServerName, "mediawiki" ) ) . "'>here</a>." );
+               }
        }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I70f9c3f1610fed5aa4b88f3512b86e1a40d64a6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: REL1_25
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to