From 329d0558cb1b0a138181901a605770a3bef2dc58 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 18 Mar 2014 13:20:09 -0700 Subject: [PATCH] Added a __sleep() method to ParserOutput to exclude cruft Change-Id: I1a3c45288bf8b29c27277a3e70362ddc36713538 --- includes/parser/ParserOutput.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index b2c9757d4c..d1e3e580fc 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -418,7 +418,7 @@ class ParserOutput extends CacheTime { * @note: Do not use setProperty() to set a property which is only used * in a context where the ParserOutput object itself is already available, * for example a normal page view. There is no need to save such a property - * in the database since it the text is already parsed. You can just hook + * in the database since the text is already parsed. You can just hook * OutputPageParserOutput and get your data out of the ParserOutput object. * * If you are writing an extension where you want to set a property in the @@ -488,8 +488,10 @@ class ParserOutput extends CacheTime { } /** - * Adds an update job to the output. Any update jobs added to the output will eventually bexecuted in order to - * store any secondary information extracted from the page's content. + * Adds an update job to the output. Any update jobs added to the output will + * eventually be executed in order to store any secondary information extracted + * from the page's content. This is triggered by calling getSecondaryDataUpdates() + * and is used for forward links updates on edit and backlink updates by jobs. * * @since 1.20 * @@ -656,4 +658,14 @@ class ParserOutput extends CacheTime { function setLimitReportData( $key, $value ) { $this->mLimitReportData[$key] = $value; } + + /** + * Save space for for serialization by removing useless values + */ + function __sleep() { + return array_diff( + array_keys( get_object_vars( $this ) ), + array( 'mSecondaryDataUpdates', 'mParseStartTime' ) + ); + } } -- 2.20.1