fix < 1.19 compat, or at least some of it :)
[toast/cookiecaptcha.git] / ReCaptcha.class.php
index b0c15fbda2edc1c9539acbaa08277986c29391ae..a041aeb1309fadac874655408f95bcb9c67445db 100644 (file)
@@ -36,9 +36,12 @@ class ReCaptcha extends SimpleCaptcha {
                        return false;
                }
 
+               // Compat: WebRequest::getIP is only available since MW 1.19.
+               $ip = method_exists( $wgRequest, 'getIP' ) ? $wgRequest->getIP() : wfGetIP();
+
                $recaptcha_response = recaptcha_check_answer(
                        $wgReCaptchaPrivateKey,
-                       $wgRequest->getIP(),
+                       $ip,
                        $challenge,
                        $response
                );