Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
PopulateSiteStatsTask
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 3
20
0.00% covered (danger)
0.00%
0 / 1
 getName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDependencies
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace MediaWiki\Installer\Task;
4
5use MediaWiki\Status\Status;
6
7/**
8 * Insert an initial row into the site_stats table
9 *
10 * @internal For use by the installer
11 */
12class PopulateSiteStatsTask extends Task {
13    public function getName() {
14        return 'stats';
15    }
16
17    public function getDependencies() {
18        return 'tables';
19    }
20
21    public function execute(): Status {
22        $status = $this->getConnection( ITaskContext::CONN_CREATE_TABLES );
23        if ( !$status->isOK() ) {
24            return $status;
25        }
26        $status->getDB()->newInsertQueryBuilder()
27            ->insertInto( 'site_stats' )
28            ->ignore()
29            ->row( [
30                'ss_row_id' => 1,
31                'ss_total_edits' => 0,
32                'ss_good_articles' => 0,
33                'ss_total_pages' => 0,
34                'ss_users' => 0,
35                'ss_active_users' => 0,
36                'ss_images' => 0,
37            ] )
38            ->caller( __METHOD__ )
39            ->execute();
40
41        return Status::newGood();
42    }
43}