diff --git a/.gitignore b/.gitignore index d83683c..e24d832 100755 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ logs # Specific config/baikal.yaml +config/.htaccess Specific/INSTALL_DISABLED # Composer stuff diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index bceed49..4e892fa 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -117,20 +117,18 @@ class Initialize extends \Flake\Core\Controller { } protected function createHtaccessFilesIfNeeded() { - if (!file_exists(PROJECT_PATH_DOCUMENTROOT . ".htaccess")) { - @copy(PROJECT_PATH_CORERESOURCES . "System/htaccess-documentroot", PROJECT_PATH_DOCUMENTROOT . ".htaccess"); + $this->copyResourceFile("System/htaccess-documentroot", PROJECT_PATH_DOCUMENTROOT . ".htaccess"); + $this->copyResourceFile("System/htaccess-deny-all", PROJECT_PATH_SPECIFIC . ".htaccess"); + $this->copyResourceFile("System/htaccess-deny-all", PROJECT_PATH_CONFIG . ".htaccess"); + } + + private function copyResourceFile($template, $destination) { + if (!file_exists($destination)) { + @copy(PROJECT_PATH_CORERESOURCES . $template, $destination); } - if (!file_exists(PROJECT_PATH_DOCUMENTROOT . ".htaccess")) { - throw new \Exception("Unable to create " . PROJECT_PATH_DOCUMENTROOT . ".htaccess; you may try to create it manually by copying " . PROJECT_PATH_CORERESOURCES . "System/htaccess-documentroot"); - } - - if (!file_exists(PROJECT_PATH_SPECIFIC . ".htaccess")) { - @copy(PROJECT_PATH_CORERESOURCES . "System/htaccess-specific", PROJECT_PATH_SPECIFIC . ".htaccess"); - } - - if (!file_exists(PROJECT_PATH_SPECIFIC . ".htaccess")) { - throw new \Exception("Unable to create " . PROJECT_PATH_SPECIFIC . ".htaccess; you may try to create it manually by copying " . PROJECT_PATH_CORERESOURCES . "System/htaccess-specific"); + if (!file_exists($destination)) { + throw new \Exception("Unable to create " . $destination . "; you may try to create it manually by copying " . PROJECT_PATH_CORERESOURCES . $template); } } } diff --git a/Core/Resources/System/htaccess-specific b/Core/Resources/System/htaccess-deny-all similarity index 100% rename from Core/Resources/System/htaccess-specific rename to Core/Resources/System/htaccess-deny-all