From 545f167a7bbfad920af26409556691307f4b3d99 Mon Sep 17 00:00:00 2001
From: Damien Finck <damien.finck67+github@gmail.com>
Date: Tue, 27 Dec 2016 15:15:26 +0100
Subject: [PATCH] Fix the check of template dir

---
 admin/check.php | 6 ++++--
 locale/en.json  | 1 +
 locale/fr.json  | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/admin/check.php b/admin/check.php
index d836ca8a..23918795 100644
--- a/admin/check.php
+++ b/admin/check.php
@@ -101,8 +101,10 @@ if (extension_loaded('intl')) {
     $messages[] = new Message('danger', __('Check','You need to enable the PHP Intl extension.'));
 }
 
-// Is template compile dir writable ?
-if (is_writable(ROOT_DIR . COMPILE_DIR)) {
+// Is template compile dir exists and writable ?
+if (!file_exists(ROOT_DIR . COMPILE_DIR)) {
+    $messages[] = new Message('danger', __f('Check','The template compile directory (%s) don\'t exist in "%s". Run composer.', COMPILE_DIR, realpath(ROOT_DIR)));
+} elseif (is_writable(ROOT_DIR . COMPILE_DIR)) {
     $messages[] = new Message('info', __f('Check','The template compile directory (%s) is writable.', realpath(ROOT_DIR . COMPILE_DIR)));
 } else {
     $messages[] = new Message('danger', __f('Check','The template compile directory (%s) is not writable.', realpath(ROOT_DIR . COMPILE_DIR)));
diff --git a/locale/en.json b/locale/en.json
index 141c0e0a..e83df85d 100644
--- a/locale/en.json
+++ b/locale/en.json
@@ -414,6 +414,7 @@
         "PHP version %s is enough (needed at least PHP %s).": "PHP version %s is enough (needed at least PHP %s).",
         "You need to enable the PHP Intl extension.": "You need to enable the PHP Intl extension.",
         "PHP Intl extension is enabled.": "PHP Intl extension is enabled.",
+        "The template compile directory (%s) don't exist in \"%s\". Run composer.": "The template compile directory (%s) don't exist in \"%s\". Run composer.",
         "The template compile directory (%s) is not writable.": "The template compile directory (%s) is not writable.",
         "The template compile directory (%s) is writable.": "The template compile directory (%s) is writable.",
         "The config file directory (%s) is not writable and the config file (%s) dos not exists.": "The config file directory (%s) is not writable and the config file (%s) dos not exists.",
diff --git a/locale/fr.json b/locale/fr.json
index 02d2625d..b16cd1e0 100644
--- a/locale/fr.json
+++ b/locale/fr.json
@@ -417,6 +417,7 @@
         "PHP version %s is enough (needed at least PHP %s).": "Version de PHP %s suffisante (nécessite au moins PHP %s).",
         "You need to enable the PHP Intl extension.": "Vous devez activer l'extension PHP Intl.",
         "PHP Intl extension is enabled.": "L'extension PHP Intl est activée.",
+        "The template compile directory (%s) don't exist in \"%s\". Run composer.": "Le dossier de compilation des templates (%s) n'existe pas dans \"%s\". Exécuter composer.",
         "The template compile directory (%s) is not writable.": "Le dossier de compilation des templates (%s) n'est pas accessible en écriture.",
         "The template compile directory (%s) is writable.": "Le dossier de compilation des templates (%s) est accessible en écriture.",
         "The config file directory (%s) is not writable and the config file (%s) dos not exists.": "Le dossier du fichier de configuration (%s) n'est pas accessible en écriture et le fichier de configuration (%s) n'existe pas.",
-- 
GitLab