1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

Merge pull request #6376 from lionel-rowe/ticket/16977

[ticket/16977] Fix cron-job img tag layout and accessibility
This commit is contained in:
Marc Alexander
2022-04-10 21:21:47 +02:00
12 changed files with 64 additions and 25 deletions

View File

@@ -31,6 +31,11 @@ class wrapper
*/
protected $task;
/**
* @var \phpbb\template\template
*/
protected $template;
/**
* Constructor.
*
@@ -38,11 +43,13 @@ class wrapper
*
* @param task $task The cron task to wrap.
* @param helper $routing_helper Routing helper for route generation
* @param \phpbb\template\template $template
*/
public function __construct(task $task, helper $routing_helper)
public function __construct(task $task, helper $routing_helper, $template)
{
$this->task = $task;
$this->routing_helper = $routing_helper;
$this->template = $template;
}
/**
@@ -92,6 +99,23 @@ class wrapper
return $this->routing_helper->route('phpbb_cron_run', $params);
}
/**
* Returns HTML for an invisible `img` tag that can be displayed on page
* load to trigger a request to the relevant cron task endpoint.
*
* @return string HTML to render to trigger cron task
*/
public function get_html_tag()
{
$this->template->set_filenames([
'cron_html_tag' => 'cron.html',
]);
$this->template->assign_var('CRON_TASK_URL', $this->get_url());
return $this->template->assign_display('cron_html_tag');
}
/**
* Forwards all other method calls to the wrapped task implementation.
*