MediaWiki master
PopulateSiteStatsTask.php
Go to the documentation of this file.
1<?php
2
4
6
14 public function getName() {
15 return 'stats';
16 }
17
19 public function getDependencies() {
20 return 'tables';
21 }
22
23 public function execute(): Status {
24 $status = $this->getConnection( ITaskContext::CONN_CREATE_TABLES );
25 if ( !$status->isOK() ) {
26 return $status;
27 }
28 $status->getDB()->newInsertQueryBuilder()
29 ->insertInto( 'site_stats' )
30 ->ignore()
31 ->row( [
32 'ss_row_id' => 1,
33 'ss_total_edits' => 0,
34 'ss_good_articles' => 0,
35 'ss_total_pages' => 0,
36 'ss_users' => 0,
37 'ss_active_users' => 0,
38 'ss_images' => 0,
39 ] )
40 ->caller( __METHOD__ )
41 ->execute();
42
43 return Status::newGood();
44 }
45}
Insert an initial row into the site_stats table.
getDependencies()
Get a list of names or aliases of tasks that must be done prior to this task.to override string|strin...
getName()
Get the symbolic name of the task.string
Base class for installer tasks.
Definition Task.php:24
getConnection(string $type)
Connect to the database for a specified purpose.
Definition Task.php:200
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:44
Dependency bundle and execution context for installer tasks.