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
---
R FancyCaptcha/ApiFancyCaptchaReload.php
M ReCaptcha/extension.json
M includes/ConfirmEditHooks.php
3 files changed, 27 insertions(+), 2 deletions(-)

Approvals:
  Ricordisamoa: Looks good to me, but someone else must approve
  Florianschmidtwelzow: 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/214610
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I70f9c3f1610fed5aa4b88f3512b86e1a40d64a6b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisa...@openmailbox.org>
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