X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcontent%2FAbstractContent.php;h=c98b0ec480602fe01bf4477943a924568e758f6c;hb=ca8aa5a6a621852f0a8ba58df7f2d9a73f4a6764;hp=816572ca01aa734ab2c312536c7e9c94923ed892;hpb=31d0a18d3efd13f025633df1cc5a5be7b058f9a3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/content/AbstractContent.php b/includes/content/AbstractContent.php index 816572ca01..c98b0ec480 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 { @@ -439,7 +446,7 @@ abstract class AbstractContent implements Content { */ public function convert( $toModel, $lossy = '' ) { if ( $this->getModel() === $toModel ) { - //nothing to do, shorten out. + // nothing to do, shorten out. return $this; }