Don't stash on preview if $wgAjaxEditStash=false
authorTim Starling <tstarling@wikimedia.org>
Thu, 5 May 2016 05:56:24 +0000 (15:56 +1000)
committerTim Starling <tstarling@wikimedia.org>
Thu, 5 May 2016 05:56:24 +0000 (15:56 +1000)
Since WikiPage won't check the cache, there's no point in storing it.
Also, this allows the feature to be completely disabled for debugging
etc.

Change-Id: Ibc00e4b20f17091b097a51877123ab9f62fd7f2a

includes/EditPage.php

index 9112112..02093ff 100644 (file)
@@ -3596,7 +3596,7 @@ HTML
         */
        function getPreviewText() {
                global $wgOut, $wgUser, $wgRawHtml, $wgLang;
-               global $wgAllowUserCss, $wgAllowUserJs;
+               global $wgAllowUserCss, $wgAllowUserJs, $wgAjaxEditStash;
 
                $stats = $wgOut->getContext()->getStats();
 
@@ -3708,10 +3708,12 @@ HTML
 
                        # Try to stash the edit for the final submission step
                        # @todo: different date format preferences cause cache misses
-                       ApiStashEdit::stashEditFromPreview(
-                               $this->getArticle(), $content, $pstContent,
-                               $parserOutput, $parserOptions, $parserOptions, wfTimestampNow()
-                       );
+                       if ( $wgAjaxEditStash ) {
+                               ApiStashEdit::stashEditFromPreview(
+                                       $this->getArticle(), $content, $pstContent,
+                                       $parserOutput, $parserOptions, $parserOptions, wfTimestampNow()
+                               );
+                       }
 
                        $parserOutput->setEditSectionTokens( false ); // no section edit links
                        $previewHTML = $parserOutput->getText();