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(1y ago)240.2k↓17.8%2[2 PRs](https://github.com/hallowelt/mwstake-mediawiki-component-runjobstrigger/pulls)GPL-3.0-onlyPHPCI passing

Since Apr 9Pushed 7mo ago3 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 3d 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

45

—

FairBetter than 91% of packages

Maintenance58

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

367d 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

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[october/rain

October Rain Library

1601.7M83](/packages/october-rain)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k16.4k79](/packages/elgg-elgg)[mediawiki/maps

Adds various mapping features to MediaWiki

84152.3k3](/packages/mediawiki-maps)[civicrm/civicrm-drupal-8

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

19251.4k3](/packages/civicrm-civicrm-drupal-8)

PHPackages © 2026

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