PHPackages                             mwstake/mediawiki-component-runjobstrigger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. mwstake/mediawiki-component-runjobstrigger

ActiveLibrary[Queues &amp; Workers](/categories/queues)

mwstake/mediawiki-component-runjobstrigger
==========================================

Provides background tasks infrastructure based on MediaWikis `maintenance/runJobs.php`

3.0.0(10mo ago)237.9k↓10.3%2[2 PRs](https://github.com/hallowelt/mwstake-mediawiki-component-runjobstrigger/pulls)GPL-3.0-onlyPHPCI passing

Since Apr 9Pushed 5mo ago4 watchersCompare

[ Source](https://github.com/hallowelt/mwstake-mediawiki-component-runjobstrigger)[ Packagist](https://packagist.org/packages/mwstake/mediawiki-component-runjobstrigger)[ RSS](/packages/mwstake-mediawiki-component-runjobstrigger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (7)Versions (14)Used By (0)

MediaWiki Stakeholders Group - Components
-----------------------------------------

[](#mediawiki-stakeholders-group---components)

RunJobsTrigger for MediaWiki
============================

[](#runjobstrigger-for-mediawiki)

Provides an infrastructure to execute background tasks based on MediaWiki's `maintenance/runJobs.php`.

**This code is meant to be used within the MediaWiki framework. Do not attempt to use it outside of MediaWiki.**

Prerequisites
-------------

[](#prerequisites)

MediaWiki's [`maintenance/runJobs.php` script](https://www.mediawiki.org/wiki/Manual:RunJobs.php) must be run periodically by a serverside process (*e.g.* in a cronjob on Linux or Scheduled Task on Windows).

The frequency of that job determines the minimum frequency at which handlers can be invoked. It is recommended to invoke `maintenance/runJobs.php` every 15 minutes at a minimum.

Compatibility
-------------

[](#compatibility)

- `3.0.x` -&gt; MediaWiki 1.43
- `2.0.x` -&gt; MediaWiki 1.39
- `2.0.x` -&gt; MediaWiki 1.35

Use in a MediaWiki extension
----------------------------

[](#use-in-a-mediawiki-extension)

Require this component in the `composer.json` of your extension:

```
{
	"require": {
		"mwstake/mediawiki-component-runjobstrigger": "~3"
	}
}
```

Since 2.0 explicit initialization is required. This can be achived by

- either adding `"callback": "mwsInitComponents"` to your `extension.json`/`skin.json`
- or calling `mwsInitComponents();` within you extensions/skins custom `callback` method

See also [`mwstake/mediawiki-componentloader`](https://github.com/hallowelt/mwstake-mediawiki-componentloader).

### Implement a handler

[](#implement-a-handler)

Create a class that implements `MWStake\MediaWiki\Component\RunJobsTrigger\IHandler`. For convenience, you may want to implement a subclass of the abstract base class `MWStake\MediaWiki\Component\RunJobsTrigger\Handler`

In the `getInterval` method you can return any object that implements `MWStake\MediaWiki\Component\RunJobsTrigger\Interval`. There are a few predefined intevals available:

- `MWStake\MediaWiki\Component\RunJobsTrigger\Interval\OnceADay`
- `MWStake\MediaWiki\Component\RunJobsTrigger\Interval\OnceAWeek`
- `MWStake\MediaWiki\Component\RunJobsTrigger\Interval\OnceEveryHour`
- `MWStake\MediaWiki\Component\RunJobsTrigger\Interval\TwiceADay`

### Register a handler

[](#register-a-handler)

There are two ways to register a handler:

1. Using the `mwsgRunJobsTriggerHandlerRegistry` GlobalVars configuraton
2. Using the hook `MWStakeRunJobsTriggerRegisterHandlers`

In both cases, an [ObjectFactory specification](https://www.mediawiki.org/wiki/ObjectFactory) must be provided.

*Example 1: GlobalVars*

```
$GLOBALS['mwsgRunJobsTriggerHandlerRegistry']['my-own-handler'] = [
    'class' => '\\MediaWiki\Extension\\MyExt\\MyHandler',
    'services' => [ 'MainConfig' ]
];
```

*Example 2: Hookhandler*

```
$GLOBALS['wgHooks']['MWStakeRunJobsTriggerRegisterHandlers'][] = function( &$handlers ) {
    $handlers["my-own-handler"] = [
        'class' => '\\MediaWiki\Extension\\MyExt\\MyHandler',
        'services' => [ 'MainConfig' ]
    ];
    return true;
};
```

Configuration
-------------

[](#configuration)

- `mwsgRunJobsTriggerRunnerWorkingDir`: Where to store data during execution. Defaults to the [operating system's temp dir](https://php.net/sys_get_temp_dir).
- `mwsgRunJobsTriggerOptions`: Timing options for particular handlers.
- `mwsgRunJobsTriggerHandlerRegistry`: Add your own trigger handlers.

Configuration examples
----------------------

[](#configuration-examples)

### Using MediaWiki’s temporary directory to store data during execution

[](#using-mediawikis-temporary-directory-to-store-data-during-execution)

Suppose an administrator wants to ensure that they can ensure any temporary files are created in MediaWiki’s temporary directory rather than somewhere else. They could do this by adding the following to their `LocalSettings.php`:

```
$GLOBALS['mwsgRunJobsTriggerRunnerWorkingDir'] = $wgTmpDirectory;
```

### Changing the timing options

[](#changing-the-timing-options)

A wiki administrator could add the following to their `LocalSettings.php` to have `OnceAWeek` tasks run on Friday instead of Sunday (by default):

```
$GLOBALS['mwsgRunJobsTriggerOptions']['*']['once-a-week-day'] = 'friday';
```

Debugging
---------

[](#debugging)

A debug log can be enabled by adding

```
$GLOBALS['wgDebugLogGroups']['runjobs-trigger-runner'] = "/tmp/runjobs-trigger-runner.log";
```

to your `LocalSettings.php` file

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance63

Regular maintenance activity

Popularity32

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~140 days

Recently: every ~114 days

Total

12

Last Release

320d ago

Major Versions

1.0.x-dev → 2.0.02022-02-07

2.0.4 → 3.0.02025-07-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/e39dfe9d3120de240053c4283e905254e8774d3278da25ad79974a8742c55192?d=identicon)[osnard](/maintainers/osnard)

![](https://www.gravatar.com/avatar/161c38b5448b71865cf0652b6974ed489dd3683b5d6e1814973cea6cb66c8f1d?d=identicon)[dsavuljesku](/maintainers/dsavuljesku)

---

Top Contributors

[![HamishSlater](https://avatars.githubusercontent.com/u/26261210?v=4)](https://github.com/HamishSlater "HamishSlater (8 commits)")[![osnard](https://avatars.githubusercontent.com/u/1201528?v=4)](https://github.com/osnard "osnard (2 commits)")[![hexmode](https://avatars.githubusercontent.com/u/43581?v=4)](https://github.com/hexmode "hexmode (1 commits)")[![it-spiderman](https://avatars.githubusercontent.com/u/13665198?v=4)](https://github.com/it-spiderman "it-spiderman (1 commits)")[![mrglaser](https://avatars.githubusercontent.com/u/2071387?v=4)](https://github.com/mrglaser "mrglaser (1 commits)")

### Embed Badge

![Health badge](/badges/mwstake-mediawiki-component-runjobstrigger/health.svg)

```
[![Health](https://phpackages.com/badges/mwstake-mediawiki-component-runjobstrigger/health.svg)](https://phpackages.com/packages/mwstake-mediawiki-component-runjobstrigger)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[humanmade/cavalcade

A better wp-cron. Horizontally scalable, works perfectly with multisite.

538286.9k4](/packages/humanmade-cavalcade)[react/async

Async utilities and fibers for ReactPHP

2228.8M171](/packages/react-async)[react/promise-stream

The missing link between Promise-land and Stream-land for ReactPHP

11512.9M45](/packages/react-promise-stream)[illuminate/bus

The Illuminate Bus package.

6043.8M409](/packages/illuminate-bus)[fotografde/cakephp-sms

SMS Plugin for CakePHP

1273.2k](/packages/fotografde-cakephp-sms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
