11use MediaWiki\MediaWikiServices;
23 public static function newJob( $params ) {
24 $job =
new self( Title::newMainPage(), $params );
39 return new self( Title::newMainPage(), [
'cleargroups' => $messageGroupIds ] );
47 parent::__construct( __CLASS__, $title, $params );
50 public function run() {
51 $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
52 if ( !$lb->waitForReplication() ) {
53 $this->logWarning(
'Continuing despite replication lag' );
56 $params = $this->params;
61 if ( defined(
'MEDIAWIKI_JOB_RUNNER' ) ) {
69 if ( isset( $params[
'purge' ] ) && $params[
'purge' ] ) {
73 if ( isset( $params[
'groupid' ] ) ) {
75 } elseif ( isset( $params[
'cleargroups' ] ) ) {
77 } elseif ( isset( $params[
'languagecode' ] ) ) {
80 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.