first commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use SimpleSAML\Locale\Translate;
|
||||
use SimpleSAML\Module;
|
||||
use SimpleSAML\XHTML\Template;
|
||||
|
||||
/**
|
||||
* Hook to add the cron module to the config page.
|
||||
*
|
||||
* @param \SimpleSAML\XHTML\Template &$template The template that we should alter in this hook.
|
||||
*/
|
||||
function cron_hook_configpage(Template &$template): void
|
||||
{
|
||||
$template->data['links'][] = [
|
||||
'href' => Module::getModuleURL('cron/info'),
|
||||
'text' => Translate::noop('Cron module information page'),
|
||||
];
|
||||
|
||||
$template->getLocalization()->addModuleDomain('cron');
|
||||
}
|
23
plugins/simplesaml/lib/modules/cron/hooks/hook_cron.php
Normal file
23
plugins/simplesaml/lib/modules/cron/hooks/hook_cron.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use SimpleSAML\Assert\Assert;
|
||||
use SimpleSAML\Configuration;
|
||||
|
||||
/**
|
||||
* Hook to run a cron job.
|
||||
*
|
||||
* @param array &$croninfo Output
|
||||
*/
|
||||
function cron_hook_cron(array &$croninfo): void
|
||||
{
|
||||
Assert::keyExists($croninfo, 'summary');
|
||||
Assert::keyExists($croninfo, 'tag');
|
||||
|
||||
$cronconfig = Configuration::getConfig('module_cron.php');
|
||||
|
||||
if ($cronconfig->getOptionalBoolean('debug_message', true)) {
|
||||
$croninfo['summary'][] = 'Cron did run tag [' . $croninfo['tag'] . '] at ' . date(DATE_RFC822);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user