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

Merge branch 'develop' into 'main'

Merging develop into main

See merge request !6
parents 7bbadb3b bf2491cc
No related branches found
Tags v3.7.19
1 merge request!6Merging develop into main
Pipeline #521822 passed
......@@ -244,11 +244,12 @@ class Handler extends BaseHandler {
$traefik = $this->config->readValue('traefik');
$traefik['usessl'] = 1;
$traefik['ports'] = 443;
$crontabs = $this->config->readValue('crontabs');
if ($this->config->readValue(['backup', 'enable'])) {
$crontabs = $this->config->readValue('crontabs');
$crontabs['www-data'][] = '5 0 * * * cd /var/www/html && /usr/local/bin/drush sql:dump --result-file=/var/backups/mysql/drupal.sql';
$this->config->setValue('crontabs', $crontabs, FALSE);
}
$crontabs['enable'] = (array_sum(array_map('count', $crontabs)) > 0);
$this->config->setValue('crontabs', $crontabs, FALSE);
$overwriteConfig = [
'staging' => !in_array(getenv('PROJECT_BRANCH_SANITIZED'), ['master', 'main'], TRUE),
'docker0' => [
......@@ -325,6 +326,12 @@ class Handler extends BaseHandler {
}
$filename = $this->config->render($template, $template);
$file = $def['dest'] . '/' . $filename;
if (!empty($def['delete'])) {
if ($fs->exists($file)) {
$fs->remove($file);
}
continue;
}
if (($overwrite && empty($def['add2git'])) || !$fs->exists($file)) {
$source = isset($def['source']) && is_file($pluginRoot . '/templates/' . $def['source']) ?
$pluginRoot . '/templates/' . $def['source'] :
......@@ -508,11 +515,19 @@ class Handler extends BaseHandler {
'condition' => $this->config->readValue(['backup', 'enable']),
];
foreach ($this->config->readValue('crontabs') ?? [] as $user => $tasks) {
$files[$user] = [
'source' => 'crontabs/template.twig',
'dest' => $projectRoot . '/crontabs',
'options' => $tasks,
];
if (empty($tasks)) {
$files[$user] = [
'dest' => $projectRoot . '/crontabs',
'delete' => TRUE,
];
}
else {
$files[$user] = [
'source' => 'crontabs/template.twig',
'dest' => $projectRoot . '/crontabs',
'options' => $tasks,
];
}
}
}
return $files;
......
......@@ -101,7 +101,7 @@ services:
{% for subdomain in relatedprojectdomains %}
- '{{ subdomain }}:{{ docker0.ip }}'
{% endfor %}
{% if drupal.live|default(0) %}
{% if crontabs.enable|default(0) %}
cron:
image: 'wodby/drupal-php:{{ php.version }}'
......
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