Reintroduce some changes which were reverted for causing fatal errors.
authorAndrew Garrett <werdna@users.mediawiki.org>
Tue, 15 Jul 2008 08:43:40 +0000 (08:43 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Tue, 15 Jul 2008 08:43:40 +0000 (08:43 +0000)
includes/EditPage.php

index 98ab49f..0dfe421 100644 (file)
@@ -62,6 +62,7 @@ class EditPage {
        var $autoSumm = '';
        var $hookError = '';
        var $mPreviewTemplates;
+       var $mBaseRevision = false;
 
        # Form values
        var $save = false, $preview = false, $diff = false;
@@ -1722,8 +1723,7 @@ END
                $db = wfGetDB( DB_MASTER );
 
                // This is the revision the editor started from
-               $baseRevision = Revision::loadFromTimestamp(
-                       $db, $this->mTitle, $this->edittime );
+               $baseRevision = $this->getBaseRevision();
                if( is_null( $baseRevision ) ) {
                        wfProfileOut( $fname );
                        return false;
@@ -2332,4 +2332,15 @@ END
                                return false;
                }
        }
+       
+       function getBaseRevision() {
+               if ($this->mBaseRevision == false) {
+                       $db = wfGetDB( DB_MASTER );
+                       $baseRevision = Revision::loadFromTimestamp(
+                               $db, $this->mTitle, $this->edittime );
+                       return $this->mBaseRevision = $baseRevision;
+               } else {
+                       return $this->mBaseRevision;
+               }
+       }
 }