Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
IncomingLinkCount
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 doJob
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace CirrusSearch\Job;
4
5use CirrusSearch\Updater;
6use MediaWiki\Title\Title;
7
8/**
9 * Updates link counts to page when it is newly linked or unlinked.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 * http://www.gnu.org/copyleft/gpl.html
25 */
26class IncomingLinkCount extends CirrusTitleJob {
27    public function __construct( Title $title, array $params ) {
28        parent::__construct( $title, $params );
29    }
30
31    /**
32     * @return bool
33     */
34    protected function doJob() {
35        // Load the titles and filter out any that no longer exist.
36        $updater = Updater::build( $this->getSearchConfig(), $this->params['cluster'] ?? null );
37        // We're intentionally throwing out whether or not this job succeeds.
38        // We're logging it but we're not retrying.
39        $updater->updateLinkedArticles( [ $this->getTitle() ] );
40        return true;
41    }
42}