Create htaccess file for config folder
This commit is contained in:
parent
8119428a63
commit
0833d0e0c1
3 changed files with 11 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,6 +3,7 @@ logs
|
||||||
|
|
||||||
# Specific
|
# Specific
|
||||||
config/baikal.yaml
|
config/baikal.yaml
|
||||||
|
config/.htaccess
|
||||||
Specific/INSTALL_DISABLED
|
Specific/INSTALL_DISABLED
|
||||||
|
|
||||||
# Composer stuff
|
# Composer stuff
|
||||||
|
|
|
@ -117,20 +117,18 @@ class Initialize extends \Flake\Core\Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createHtaccessFilesIfNeeded() {
|
protected function createHtaccessFilesIfNeeded() {
|
||||||
if (!file_exists(PROJECT_PATH_DOCUMENTROOT . ".htaccess")) {
|
$this->copyResourceFile("System/htaccess-documentroot", PROJECT_PATH_DOCUMENTROOT . ".htaccess");
|
||||||
@copy(PROJECT_PATH_CORERESOURCES . "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")) {
|
if (!file_exists($destination)) {
|
||||||
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");
|
throw new \Exception("Unable to create " . $destination . "; you may try to create it manually by copying " . PROJECT_PATH_CORERESOURCES . $template);
|
||||||
}
|
|
||||||
|
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue