12use MediaWiki\MediaWikiServices;
24 public static function newJob( $params ) {
25 $job =
new self( Title::newMainPage(), $params );
40 return new self( Title::newMainPage(), [
'cleargroups' => $messageGroupIds ] );
48 parent::__construct( __CLASS__, $title, $params );
51 public function run() {
52 $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
53 if ( !$lb->waitForReplication() ) {
54 $this->logWarning(
'Continuing despite replication lag' );
57 $params = $this->params;
62 if ( defined(
'MEDIAWIKI_JOB_RUNNER' ) ) {
68 MessageGroups::singleton()->clearProcessCache();
70 if ( isset( $params[
'purge' ] ) && $params[
'purge' ] ) {
74 if ( isset( $params[
'groupid' ] ) ) {
76 } elseif ( isset( $params[
'cleargroups' ] ) ) {
78 } elseif ( isset( $params[
'languagecode' ] ) ) {
81 throw new InvalidArgumentException(
'No groupid or languagecode or cleargroup provided' );
Job for rebuilding message group stats.
static newRefreshGroupsJob(array $messageGroupIds)
Force updating of message group stats for given groups.
__construct( $title, $params=[])
static clearGroup( $id, int $flags=0)
Recalculate stats for given group(s).
static forLanguage( $code, $flags=0)
Returns stats for all groups in given language.
const FLAG_IMMEDIATE_WRITES
Do not defer updates. Meant for jobs like MessageGroupStatsRebuildJob.
const FLAG_NO_CACHE
Ignore cached values. Useful for updating stale values.
static forGroup( $id, $flags=0)
Returns stats for all languages in given group.