PHP code example of mwstake / mediawiki-component-wikicron

1. Go to this page and download the library: Download mwstake/mediawiki-component-wikicron library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mwstake / mediawiki-component-wikicron example snippets


$GLOBALS['wgExtensionFunctions'][] = static function () {
    /** @var WikiCronManager $cronManager */
    $cronManager = MediaWikiServices::getInstance()->getService( 'MWStake.WikiCronManager' );
    $cronManager->registerCron( 'notify', '*/5 * * * *', new ManagedProcess( [
        'test' => [ 'class' => TestStep::class ]
    ] ) );
};
bash
> php maintenance/wikiCron.php
--------------------------------------------------------------------------------------------------------------
Interval            Cron key                                Enabled   Last run                 Last Status
--------------------------------------------------------------------------------------------------------------
*/5 * * * *         notify                                  Yes       2024-11-08 14:20:57      terminated
--------------------------------------------------------------------------------------------------------------