$mTOCEnabled = true; # Whether TOC should be shown, can't override __NOTOC__
private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
private $mAccessedOptions = array(); # List of ParserOptions (stored in the keys)
- private $mSecondaryDataUpdates = array(); # List of DataUpdate, used to save info from the page somewhere else.
private $mExtensionData = array(); # extra data used by extensions
private $mLimitReportData = array(); # Parser limit report data
private $mParseStartTime = array(); # Timestamps for getTimeSinceStart()
private $mPreventClickjacking = false; # Whether to emit X-Frame-Options: DENY
+ private $mFlags = array(); # Generic flags
const EDITSECTION_REGEX =
'#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
public function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(),
- $containsOldMagic = false, $titletext = ''
+ $unused = false, $titletext = ''
) {
$this->mText = $text;
$this->mLanguageLinks = $languageLinks;
$this->mCategories = $categoryLinks;
- $this->mContainsOldMagic = $containsOldMagic;
$this->mTitleText = $titletext;
}
public function getText() {
- wfProfileIn( __METHOD__ );
$text = $this->mText;
if ( $this->mEditSectionTokens ) {
$text = preg_replace_callback(
$text
);
}
- wfProfileOut( __METHOD__ );
return $text;
}
* Add a tracking category, getting the title from a system message,
* or print a debug message if the title is invalid.
*
- * Please add any message that you use with this function to
- * $wgTrackingCategories. That way they will be listed on
- * Special:TrackingCategories.
+ * Any message used with this function should be registered so it will
+ * show up on Special:TrackingCategories. Core messages should be added
+ * to SpecialTrackingCategories::$coreTrackingCategories, and extensions
+ * should add to "TrackingCategories" in their extension.json.
*
* @param string $msg Message key
* @param Title $title title of the page which is being tracked
}
/**
- * 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.
+ * @deprecated since 1.25. Instead, store any relevant data using setExtensionData,
+ * and implement Content::getSecondaryDataUpdates() if possible, or use the
+ * 'SecondaryDataUpdates' hook to construct the necessary update objects.
*
- * @since 1.20
+ * @note Hard deprecation and removal without long deprecation period, since there are no
+ * known users, but known conceptual issues.
+ *
+ * @todo remove in 1.26
*
* @param DataUpdate $update
+ *
+ * @throws MWException
*/
public function addSecondaryDataUpdate( DataUpdate $update ) {
- $this->mSecondaryDataUpdates[] = $update;
+ wfDeprecated( __METHOD__, '1.25' );
+ throw new MWException( 'ParserOutput::addSecondaryDataUpdate() is no longer supported. Override Content::getSecondaryDataUpdates() or use the SecondaryDataUpdates hook instead.' );
}
/**
- * Returns any DataUpdate jobs to be executed in order to store secondary information
- * extracted from the page's content, including a LinksUpdate object for all links stored in
- * this ParserOutput object.
+ * @deprecated since 1.25.
*
- * @note Avoid using this method directly, use ContentHandler::getSecondaryDataUpdates()
- * instead! The content handler may provide additional update objects.
+ * @note Hard deprecation and removal without long deprecation period, since there are no
+ * known users, but known conceptual issues.
*
- * @since 1.20
+ * @todo remove in 1.26
*
- * @param Title $title The title of the page we're updating. If not given, a title object will
- * be created based on $this->getTitleText()
- * @param bool $recursive Queue jobs for recursive updates?
+ * @return bool false (since 1.25)
+ */
+ public function hasCustomDataUpdates() {
+ wfDeprecated( __METHOD__, '1.25' );
+ return false;
+ }
+
+ /**
+ * @deprecated since 1.25. Instead, store any relevant data using setExtensionData,
+ * and implement Content::getSecondaryDataUpdates() if possible, or use the
+ * 'SecondaryDataUpdates' hook to construct the necessary update objects.
+ *
+ * @note Hard deprecation and removal without long deprecation period, since there are no
+ * known users, but known conceptual issues.
+ *
+ * @todo remove in 1.26
+ *
+ * @param Title $title
+ * @param bool $recursive
*
* @return array An array of instances of DataUpdate
*/
public function getSecondaryDataUpdates( Title $title = null, $recursive = true ) {
- if ( is_null( $title ) ) {
- $title = Title::newFromText( $this->getTitleText() );
- }
-
- $linksUpdate = new LinksUpdate( $title, $this, $recursive );
-
- return array_merge( $this->mSecondaryDataUpdates, array( $linksUpdate ) );
+ wfDeprecated( __METHOD__, '1.25' );
+ return array();
}
/**
$this->mLimitReportData[$key] = $value;
}
+ /**
+ * Check whether the cache TTL was lowered due to dynamic content
+ *
+ * When content is determined by more than hard state (e.g. page edits),
+ * such as template/file transclusions based on the current timestamp or
+ * extension tags that generate lists based on queries, this return true.
+ *
+ * @return bool
+ * @since 1.25
+ */
+ public function hasDynamicContent() {
+ global $wgParserCacheExpireTime;
+
+ return $this->getCacheExpiry() < $wgParserCacheExpireTime;
+ }
+
/**
* Get or set the prevent-clickjacking flag
*
public function __sleep() {
return array_diff(
array_keys( get_object_vars( $this ) ),
- array( 'mSecondaryDataUpdates', 'mParseStartTime' )
+ array( 'mParseStartTime' )
);
}
}