summaryrefslogtreecommitdiff
path: root/includes/content/AbstractContent.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-06-04 07:31:04 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-06-04 07:58:39 +0200
commitf6d65e533c62f6deb21342d4901ece24497b433e (patch)
treef28adf0362d14bcd448f7b65a7aaf38650f923aa /includes/content/AbstractContent.php
parentc27b2e832fe25651ef2410fae85b41072aae7519 (diff)
Update to MediaWiki 1.25.1
Diffstat (limited to 'includes/content/AbstractContent.php')
-rw-r--r--includes/content/AbstractContent.php27
1 files changed, 18 insertions, 9 deletions
diff --git a/includes/content/AbstractContent.php b/includes/content/AbstractContent.php
index 9d257a6a..6542d7df 100644
--- a/includes/content/AbstractContent.php
+++ b/includes/content/AbstractContent.php
@@ -204,13 +204,13 @@ abstract class AbstractContent implements Content {
* Returns a list of DataUpdate objects for recording information about this
* Content in some secondary data store.
*
- * This default implementation calls
- * $this->getParserOutput( $content, $title, null, null, false ),
- * and then calls getSecondaryDataUpdates( $title, $recursive ) on the
- * resulting ParserOutput object.
+ * This default implementation returns a LinksUpdate object and calls the
+ * SecondaryDataUpdates hook.
*
* Subclasses may override this to determine the secondary data updates more
* efficiently, preferably without the need to generate a parser output object.
+ * They should however make sure to call SecondaryDataUpdates to give extensions
+ * a chance to inject additional updates.
*
* @since 1.21
*
@@ -224,12 +224,19 @@ abstract class AbstractContent implements Content {
* @see Content::getSecondaryDataUpdates()
*/
public function getSecondaryDataUpdates( Title $title, Content $old = null,
- $recursive = true, ParserOutput $parserOutput = null ) {
+ $recursive = true, ParserOutput $parserOutput = null
+ ) {
if ( $parserOutput === null ) {
$parserOutput = $this->getParserOutput( $title, null, null, false );
}
- return $parserOutput->getSecondaryDataUpdates( $title, $recursive );
+ $updates = array(
+ new LinksUpdate( $title, $parserOutput, $recursive )
+ );
+
+ Hooks::run( 'SecondaryDataUpdates', array( $title, $old, $recursive, $parserOutput, &$updates ) );
+
+ return $updates;
}
/**
@@ -386,7 +393,7 @@ abstract class AbstractContent implements Content {
*
* @see Content::prepareSave
*/
- public function prepareSave( WikiPage $page, $flags, $baseRevId, User $user ) {
+ public function prepareSave( WikiPage $page, $flags, $parentRevId, User $user ) {
if ( $this->isValid() ) {
return Status::newGood();
} else {
@@ -446,7 +453,7 @@ abstract class AbstractContent implements Content {
$lossy = ( $lossy === 'lossy' ); // string flag, convert to boolean for convenience
$result = false;
- wfRunHooks( 'ConvertContent', array( $this, $toModel, $lossy, &$result ) );
+ Hooks::run( 'ConvertContent', array( $this, $toModel, $lossy, &$result ) );
return $result;
}
@@ -480,7 +487,7 @@ abstract class AbstractContent implements Content {
$po = new ParserOutput();
- if ( wfRunHooks( 'ContentGetParserOutput',
+ if ( Hooks::run( 'ContentGetParserOutput',
array( $this, $title, $revId, $options, $generateHtml, &$po ) ) ) {
// Save and restore the old value, just in case something is reusing
@@ -491,6 +498,8 @@ abstract class AbstractContent implements Content {
$options->setRedirectTarget( $oldRedir );
}
+ Hooks::run( 'ContentAlterParserOutput', array( $this, $title, $po ) );
+
return $po;
}