Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
UpdateFlaggedRevsStats
0.00% covered (danger)
0.00%
0 / 9
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 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * This file is run daily by the following cron job:
4 * https://gerrit.wikimedia.org/g/operations/puppet/+/production/modules/profile/manifests/mediawiki/maintenance/update_flaggedrev_stats.pp
5 * Do not rename this file without also fixing the file path in Puppet.
6 *
7 * @ingroup Maintenance
8 */
9
10use MediaWiki\Maintenance\Maintenance;
11
12if ( getenv( 'MW_INSTALL_PATH' ) ) {
13    $IP = getenv( 'MW_INSTALL_PATH' );
14} else {
15    $IP = __DIR__ . '/../../..';
16}
17
18require_once "$IP/maintenance/Maintenance.php";
19
20/**
21 * This maintenance script generates the statistics for the page [[Special:ValidationStatistics]].
22 */
23class UpdateFlaggedRevsStats extends Maintenance {
24
25    public function __construct() {
26        parent::__construct();
27        $this->addDescription( "Update FlaggedRevs statistics table" );
28        $this->requireExtension( 'FlaggedRevs' );
29    }
30
31    /**
32     * @inheritDoc
33     */
34    public function execute() {
35        $this->output( sprintf( '%-30s ', 'ValidationStatistics' ) );
36
37        $time1 = microtime( true );
38        FlaggedRevsStats::updateCache();
39        $time2 = microtime( true );
40
41        $elapsed = ( $time2 - $time1 );
42        $this->output( sprintf( "completed in %.2fs\n", $elapsed ) );
43    }
44}
45
46$maintClass = UpdateFlaggedRevsStats::class;
47require_once RUN_MAINTENANCE_IF_MAIN;