Fix ApiStashEdit wrt custom DataUpdates.
[lhc/web/wiklou.git] / includes / api / ApiStashEdit.php
index 2f9f37e..09489e4 100644 (file)
@@ -239,7 +239,9 @@ class ApiStashEdit extends ApiBase {
                                $wgMemc->unlock( $key );
                        }
                        $sec = microtime( true ) - $start;
-                       wfDebugLog( 'StashEdit', "Waited $sec seconds on '$key'." );
+                       if ( $sec > .01 ) {
+                               wfDebugLog( 'StashEdit', "Waited $sec seconds on '$key'." );
+                       }
                }
 
                if ( !is_object( $editInfo ) || !$editInfo->output ) {
@@ -331,7 +333,12 @@ class ApiStashEdit extends ApiBase {
                // If an item is renewed, mind the cache TTL determined by config and parser functions
                $since = time() - wfTimestamp( TS_UNIX, $parserOutput->getTimestamp() );
                $ttl = min( $parserOutput->getCacheExpiry() - $since, 5 * 60 );
-               if ( $ttl > 0 && !$parserOutput->getFlag( 'vary-revision' ) ) {
+
+               // Note: ParserOutput with that contains secondary data update callbacks can not be
+               // stashed, since the callbacks are not serializable (see ParserOutput::__sleep).
+               $hasCustomDataUpdates = $parserOutput->hasCustomDataUpdates();
+
+               if ( $ttl > 0 && !$parserOutput->getFlag( 'vary-revision' ) && !$hasCustomDataUpdates ) {
                        // Only store what is actually needed
                        $stashInfo = (object)array(
                                'pstContent' => $pstContent,