From f02bcdba5118990c8f31275dab67305a123399a0 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 21 Jul 2018 05:41:19 +0000 Subject: [PATCH] Automatically create a .htaccess when not existing --- src/Worker/Cron.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 644ef6b9d4..bf1b44f55d 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -112,6 +112,13 @@ class Cron Config::set('system', 'last_cron_hourly', time()); } + // Ensure to have a .htaccess file. + // this is a precaution for systems that update automatically + $basepath = $a->get_basepath(); + if (!file_exists($basepath . '/.htaccess')) { + copy($basepath . '/.htaccess-dist', $basepath . '/.htaccess'); + } + // Poll contacts self::pollContacts($parameter, $generation);