From 6e27659f57d672454ef96901abaa93facdefb4e8 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 5 Apr 2012 17:08:54 +0200 Subject: [PATCH] make SecondaryDataUpdate even more abstract changeset 2: fixed parameter documentation for SecondaryDataUpdate and SecondaryDBDataUpdate Change-Id: I88b2bc96afd1f2f0b5e381d8977f20b6c4d4a97b --- includes/LinksUpdate.php | 29 +++++++++++++++++++++++-- includes/SecondaryDBDataUpdate.php | 10 +++------ includes/SecondaryDataUpdate.php | 35 +----------------------------- 3 files changed, 31 insertions(+), 43 deletions(-) diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index 8c5e61d89a..6c864c1384 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -24,7 +24,10 @@ class LinksUpdate extends SecondaryDBDataUpdate { /**@{{ * @private */ - var $mLinks, //!< Map of title strings to IDs for the links in the document + var $mId, //!< Page ID of the article linked from + $mTitle, //!< Title object of the article linked from + $mParserOutput, //!< Whether to queue jobs for recursive update + $mLinks, //!< Map of title strings to IDs for the links in the document $mImages, //!< DB keys of the images used, in the array key only $mTemplates, //!< Map of title strings to IDs for the template references, including broken ones $mExternals, //!< URLs of external links, array key only @@ -42,12 +45,17 @@ class LinksUpdate extends SecondaryDBDataUpdate { * @param $recursive Boolean: queue jobs for recursive updates? */ function __construct( $title, $parserOutput, $recursive = true ) { + parent::__construct( ); + if ( !is_object( $title ) ) { throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " . "Please see Article::editUpdates() for an invocation example.\n" ); } - parent::__construct( $title, $parserOutput ); + $this->mTitle = $title; + $this->mId = $title->getArticleID(); + + $this->mParserOutput = $parserOutput; $this->mLinks = $parserOutput->getLinks(); $this->mImages = $parserOutput->getImages(); @@ -743,6 +751,23 @@ class LinksUpdate extends SecondaryDBDataUpdate { return $arr; } + /** + * Return the title object of the page being updated + * @return Title + */ + public function getTitle() { + return $this->mTitle; + } + + /** + * Returns parser output + * @since 1.19 + * @return ParserOutput + */ + public function getParserOutput() { + return $this->mParserOutput; + } + /** * Return the list of images used as generated by the parser * @return array diff --git a/includes/SecondaryDBDataUpdate.php b/includes/SecondaryDBDataUpdate.php index 7ff18fa78e..1adb9a3524 100644 --- a/includes/SecondaryDBDataUpdate.php +++ b/includes/SecondaryDBDataUpdate.php @@ -31,15 +31,11 @@ abstract class SecondaryDBDataUpdate extends SecondaryDataUpdate { /** * Constructor - * - * @param $title Title of the page we're updating - * @param $parserOutput ParserOutput: output from a full parse of this page - * @param $recursive Boolean: queue jobs for recursive updates? - */ - public function __construct( Title $title, ParserOutput $parserOutput ) { + **/ + public function __construct( ) { global $wgAntiLockFlags; - parent::__construct( $title, $parserOutput ); + parent::__construct( ); if ( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) { $this->mOptions = array(); diff --git a/includes/SecondaryDataUpdate.php b/includes/SecondaryDataUpdate.php index 69f6cb1a6a..6527c2d4e9 100644 --- a/includes/SecondaryDataUpdate.php +++ b/includes/SecondaryDataUpdate.php @@ -22,26 +22,10 @@ */ abstract class SecondaryDataUpdate { - /**@{{ - * @private - */ - var $mId, //!< Page ID of the article linked from - $mTitle, //!< Title object of the article linked from - $mParserOutput; //!< Whether to queue jobs for recursive updates - /**@}}*/ - /** * Constructor - * - * @param $title Title of the page we're updating - * @param $parserOutput ParserOutput: output from a full parse of this page - * @param $recursive Boolean: queue jobs for recursive updates? */ - public function __construct( Title $title, ParserOutput $parserOutput) { - $this->mTitle = $title; - $this->mId = $title->getArticleID(); - - $this->mParserOutput = $parserOutput; + public function __construct( ) { } /** @@ -49,21 +33,4 @@ abstract class SecondaryDataUpdate { */ public abstract function doUpdate(); - /** - * Return the title object of the page being updated - * @return Title - */ - public function getTitle() { - return $this->mTitle; - } - - /** - * Returns parser output - * @since 1.19 - * @return ParserOutput - */ - public function getParserOutput() { - return $this->mParserOutput; - } - } -- 2.20.1