Removed .gitignore files and changed code to create directories

This commit is contained in:
sud0nick
2018-01-07 23:16:42 -05:00
parent 84b4e75af9
commit 0ff56091b1
13 changed files with 372 additions and 250 deletions

View File

@@ -54,6 +54,9 @@ class Papers extends Module
{
public function route() {
switch ($this->request->action) {
case 'init':
$this->init();
break;
case 'checkDepends':
$this->checkDepends();
break;
@@ -104,6 +107,38 @@ class Papers extends Module
break;
}
}
private function init() {
if (!file_exists(__LOGS__)) {
if (!mkdir(__LOGS__, 0755, true)) {
$this->respond(false, "Failed to create logs directory");
return false;
}
}
if (!file_exists(__DOWNLOAD__)) {
if (!mkdir(__DOWNLOAD__, 0755, true)) {
Papers::logError("Failed init", "Failed to initialize because the 'download' directory structure could not be created");
$this->respond(false);
return false;
}
}
if (!file_exists(__SSLSTORE__)) {
if (!mkdir(__SSLSTORE__, 0755, true)) {
Papers::logError("Failed init", "Failed to initialize because the 'ssl store' directory structure could not be created");
$this->respond(false);
return false;
}
}
if (!file_exists(__SSHSTORE__)) {
if (!mkdir(__SSHSTORE__, 0755, true)) {
Papers::logError("Failed init", "Failed to initialize because the 'ssh store' directory structure could not be created");
$this->respond(false);
return false;
}
}
}
private function checkDepends() {
$retData = array();
exec(__SCRIPTS__ . "checkDepends.sh", $retData);