diff options
Diffstat (limited to 'extensions/ConfirmEdit/Captcha.php')
-rw-r--r-- | extensions/ConfirmEdit/Captcha.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/extensions/ConfirmEdit/Captcha.php b/extensions/ConfirmEdit/Captcha.php index ef039462..3d6494ff 100644 --- a/extensions/ConfirmEdit/Captcha.php +++ b/extensions/ConfirmEdit/Captcha.php @@ -181,7 +181,8 @@ class SimpleCaptcha { if ( $wgCaptchaWhitelistIP ) { global $wgRequest; - $ip = $wgRequest->getIP(); + // Compat: WebRequest::getIP is only available since MW 1.19. + $ip = method_exists( $wgRequest, 'getIP' ) ? $wgRequest->getIP() : wfGetIP(); foreach ( $wgCaptchaWhitelistIP as $range ) { if ( IP::isInRange( $ip, $range ) ) { @@ -199,7 +200,9 @@ class SimpleCaptcha { */ function badLoginKey() { global $wgRequest; - return wfMemcKey( 'captcha', 'badlogin', 'ip', $wgRequest->getIP() ); + // Compat: WebRequest::getIP is only available since MW 1.19. + $ip = method_exists( $wgRequest, 'getIP' ) ? $wgRequest->getIP() : wfGetIP(); + return wfMemcKey( 'captcha', 'badlogin', 'ip', $ip ); } /** @@ -418,7 +421,7 @@ class SimpleCaptcha { */ function getLinksFromTracker( $title ) { $dbr = wfGetDB( DB_SLAVE ); - $id = $title->getArticleId(); // should be zero queries + $id = $title->getArticleID(); // should be zero queries $res = $dbr->select( 'externallinks', array( 'el_to' ), array( 'el_from' => $id ), __METHOD__ ); $links = array(); |