diff --git a/core/Documents/Install.class.php b/core/Documents/Install.class.php
index 7873113..e2dd071 100644
--- a/core/Documents/Install.class.php
+++ b/core/Documents/Install.class.php
@@ -4,7 +4,7 @@ namespace Documents {
class Install extends \Elements\Document {
public function __construct($user) {
parent::__construct($user, Install\Head::class, Install\Body::class);
- $this->databseRequired = false;
+ $this->databaseRequired = false;
}
}
}
@@ -63,15 +63,18 @@ namespace Documents\Install {
//
private $configDirectory;
- private $databaseScript;
+ private $databaseConfiguration;
+ private $mailConfiguration;
+ private $jwtConfiguration;
private $errorString;
function __construct($document) {
parent::__construct($document);
- // TODO: make better
- $this->configDirectory = getWebRoot() . '/core/Configuration';
- $this->databaseScript = getWebRoot() . '/core/Configuration/database.sql';
+ $this->configDirectory = getWebRoot() . '/core/Configuration';
+ $this->databaseConfiguration = getWebRoot() . '/core/Configuration/Database.class.php';
+ $this->mailConfiguration = getWebRoot() . '/core/Configuration/Mail.class.php';
+ $this->jwtConfiguration = getWebRoot() . '/core/Configuration/JWT.class.php';
$this->errorString = "";
}
@@ -136,13 +139,22 @@ namespace Documents\Install {
$success = true;
$failedRequirements = array();
- if(!is_writeable($this->configDirectory)) {
- $failedRequirements[] = "$this->configDirectory is not writeable. Try running chmod 600";
- $success = false;
+ $writeableFiles = array(
+ $this->configDirectory,
+ $this->databaseConfiguration,
+ $this->mailConfiguration,
+ $this->jwtConfiguration,
+ );
+
+ foreach($writeableFiles as $file) {
+ if(!is_writeable($file)) {
+ $failedRequirements[] = "$file is not writeable. Try running chmod 600";
+ $success = false;
+ }
}
- if(!is_readable($this->databaseScript)) {
- $failedRequirements[] = "$this->databaseScript is not readable.";
+ if(!is_writeable($this->configDirectory)) {
+ $failedRequirements[] = "$this->configDirectory is not writeable. Try running chmod 600";
$success = false;
}
diff --git a/core/Elements/Document.class.php b/core/Elements/Document.class.php
index 0bfa7dd..b662324 100644
--- a/core/Elements/Document.class.php
+++ b/core/Elements/Document.class.php
@@ -7,13 +7,13 @@ abstract class Document {
protected $head;
protected $body;
protected $user;
- protected $databseRequired;
+ protected $databaseRequired;
public function __construct($user, $headClass, $bodyClass) {
$this->head = new $headClass($this);
$this->body = new $bodyClass($this);
$this->user = $user;
- $this->databseRequired = true;
+ $this->databaseRequired = true;
}
public function getHead() { return $this->head; }
@@ -55,7 +55,7 @@ abstract class Document {
function getCode() {
- if ($this->databseRequired) {
+ if ($this->databaseRequired) {
$sql = $this->user->getSQL();
if (is_null($sql)) {
die("Database is not configured yet.");