Skip to content
Snippets Groups Projects
Commit 51f42583 authored by jurgenhaas's avatar jurgenhaas
Browse files

Merge branch '2838-cronjobs-per-host' into 'master'

#2838 added filtering of cronjobs by host

See merge request ansible-roles/drupal!9
parents 2e341013 5c6f7085
No related branches found
No related tags found
1 merge request!9#2838 added filtering of cronjobs by host
......@@ -38,6 +38,25 @@ foreach ($input_files as $input_file) {
continue;
}
// Make sure to only use cronjobs for this host.
$host = gethostname();
foreach ($input_file_decoded as $key => $cronjob) {
// Make sure we have a valid entry.
if (!is_array($cronjob) || !isset($cronjob['host'])) {
continue;
}
// Remove non matching entries.
if ($host && $cronjob['host'] !== $host) {
unset($input_file_decoded[$key]);
continue;
}
// Remove the "host" key as this is not a valid cron key.
unset($input_file_decoded[$key]['host']);
}
// Merge the decoded file contents to the result.
$crontab_definitions = array_merge($crontab_definitions, $input_file_decoded);
}
......
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