Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
LocalCacheUpdateJob | |
0.00% |
0 / 11 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
run | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | /** |
3 | * This program is free software: you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation, either version 3 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | */ |
16 | |
17 | namespace MediaWiki\GlobalUserPage; |
18 | |
19 | use HTMLFileCache; |
20 | use Job; |
21 | use MediaWiki\MediaWikiServices; |
22 | use MediaWiki\Title\Title; |
23 | |
24 | /** |
25 | * A job that runs on local wikis to purge squid and possibly |
26 | * queue local HTMLCacheUpdate jobs |
27 | */ |
28 | class LocalCacheUpdateJob extends Job { |
29 | /** |
30 | * @param Title $title |
31 | * @param array $params Should have 'username' and 'touch' keys |
32 | */ |
33 | public function __construct( Title $title, array $params ) { |
34 | parent::__construct( 'LocalGlobalUserPageCacheUpdateJob', $title, $params ); |
35 | } |
36 | |
37 | public function run() { |
38 | $title = Title::makeTitleSafe( NS_USER, $this->params['username'] ); |
39 | // We want to purge the cache of the accompanying page so the tabs change colors |
40 | $other = $title->getOtherPage(); |
41 | $hcu = MediaWikiServices::getInstance()->getHtmlCacheUpdater(); |
42 | $hcu->purgeTitleUrls( $title, $hcu::PURGE_INTENT_TXROUND_REFLECTED ); |
43 | $hcu->purgeTitleUrls( $other, $hcu::PURGE_INTENT_TXROUND_REFLECTED ); |
44 | HTMLFileCache::clearFileCache( $title ); |
45 | HTMLFileCache::clearFileCache( $other ); |
46 | if ( $this->params['touch'] ) { |
47 | $title->touchLinks(); |
48 | } |
49 | return true; |
50 | } |
51 | } |