Set READ_LATEST for Revision query.
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 26 Sep 2012 21:15:39 +0000 (14:15 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 26 Sep 2012 21:15:39 +0000 (14:15 -0700)
Change-Id: I3946e2e7bbc7ce1099412dd14b4b38b7f12e7954

Captcha.php

index ab52fae8ff32673a8e402cac8683e991c2cf45e1..0f78d36f546ffc6effb2a46b0754387fc49d0398 100644 (file)
@@ -315,8 +315,8 @@ class SimpleCaptcha {
 
                global $wgCaptchaRegexes;
                if ( $wgCaptchaRegexes ) {
-                       // Custom regex checks
-                       $oldtext = $this->loadText( $editPage, $section );
+                       // Custom regex checks. Reuse $oldtext if set above.
+                       $oldtext = isset( $oldtext ) ? $oldtext : $this->loadText( $editPage, $section );
 
                        foreach ( $wgCaptchaRegexes as $regex ) {
                                $newMatches = array();
@@ -683,7 +683,7 @@ class SimpleCaptcha {
         * @access private
         */
        function loadText( $editPage, $section ) {
-               $rev = Revision::newFromTitle( $editPage->mTitle );
+               $rev = Revision::newFromTitle( $editPage->mTitle, false, Revision::READ_LATEST );
                if ( is_null( $rev ) ) {
                        return "";
                } else {