Skip to content
Snippets Groups Projects
Commit 3c38a5b7 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fixes for modules/cron

parent ef7925f1
No related branches found
No related tags found
No related merge requests found
<?php <?php
/** /**
* Hook to add the cron module to the config page. * Hook to add the cron module to the config page.
* *
* @param \SimpleSAML\XHTML\Template &$template The template that we should alter in this hook. * @param \SimpleSAML\XHTML\Template &$template The template that we should alter in this hook.
* @return void
*/ */
function cron_hook_configpage(\SimpleSAML\XHTML\Template &$template) function cron_hook_configpage(\SimpleSAML\XHTML\Template &$template)
{ {
$template->data['links']['cron'] = [ $template->data['links']['cron'] = [
......
<?php <?php
/** /**
* Hook to run a cron job. * Hook to run a cron job.
* *
* @param array &$croninfo Output * @param array &$croninfo Output
* @return void
*/ */
function cron_hook_cron(&$croninfo) function cron_hook_cron(&$croninfo)
{ {
assert(is_array($croninfo)); assert(is_array($croninfo));
......
<?php <?php
/** /**
* Hook to add the modinfo module to the frontpage. * Hook to add the modinfo module to the frontpage.
* *
* @param array &$links The links on the frontpage, split into sections. * @param array &$links The links on the frontpage, split into sections.
* @return void
*/ */
function cron_hook_frontpage(&$links) function cron_hook_frontpage(&$links)
{ {
assert(is_array($links)); assert(is_array($links));
......
<?php <?php
namespace SimpleSAML\Module\cron; namespace SimpleSAML\Module\cron;
/** /**
* Handles interactions with SSP's cron system/hooks. * Handles interactions with SSP's cron system/hooks.
...@@ -27,13 +27,12 @@ class Cron ...@@ -27,13 +27,12 @@ class Cron
/** /**
* Invoke the cron hook for the given tag * Invoke the cron hook for the given tag
* @param $tag string The tag to use. Must be valid in the cronConfig * @param string $tag The tag to use. Must be valid in the cronConfig
* @return array the tag, and summary information from the run. * @return array the tag, and summary information from the run.
* @throws Exception If an invalid tag specified * @throws Exception If an invalid tag specified
*/ */
public function runTag($tag) public function runTag($tag)
{ {
if (!$this->isValidTag($tag)) { if (!$this->isValidTag($tag)) {
throw new \Exception("Invalid cron tag '$tag''"); throw new \Exception("Invalid cron tag '$tag''");
} }
...@@ -53,6 +52,10 @@ class Cron ...@@ -53,6 +52,10 @@ class Cron
return $croninfo; return $croninfo;
} }
/**
* @param string $tag
* @return bool
*/
public function isValidTag($tag) public function isValidTag($tag)
{ {
if (!is_null($this->cronconfig->getValue('allowed_tags'))) { if (!is_null($this->cronconfig->getValue('allowed_tags'))) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment