Introducing abstract base classes for LinksUpdate, so we can nicely handle updates...
[lhc/web/wiklou.git] / includes / SecondaryDataUpdate.php
1 <?php
2 /**
3 * See docs/deferred.txt
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * Abstract base class for update jobs that do something with some secondary
21 * data extracted from article.
22 */
23 abstract class SecondaryDataUpdate {
24
25 /**@{{
26 * @private
27 */
28 var $mId, //!< Page ID of the article linked from
29 $mTitle, //!< Title object of the article linked from
30 $mParserOutput; //!< Whether to queue jobs for recursive updates
31 /**@}}*/
32
33 /**
34 * Constructor
35 *
36 * @param $title Title of the page we're updating
37 * @param $parserOutput ParserOutput: output from a full parse of this page
38 * @param $recursive Boolean: queue jobs for recursive updates?
39 */
40 public function __construct( Title $title, ParserOutput $parserOutput) {
41 $this->mTitle = $title;
42 $this->mId = $title->getArticleID();
43
44 $this->mParserOutput = $parserOutput;
45 }
46
47 /**
48 * Update link tables with outgoing links from an updated article
49 */
50 public abstract function doUpdate();
51
52 /**
53 * Return the title object of the page being updated
54 * @return Title
55 */
56 public function getTitle() {
57 return $this->mTitle;
58 }
59
60 /**
61 * Returns parser output
62 * @since 1.19
63 * @return ParserOutput
64 */
65 public function getParserOutput() {
66 return $this->mParserOutput;
67 }
68
69 }