Permissions maybe fixed
This commit is contained in:
parent
2611aa2c1b
commit
6dcfd35d31
@ -110,7 +110,7 @@ class Configuration {
|
||||
?>", false);
|
||||
}
|
||||
|
||||
return file_put_contents($path, $code);
|
||||
return @file_put_contents($path, $code);
|
||||
}
|
||||
|
||||
public function delete($className) {
|
||||
@ -121,6 +121,24 @@ class Configuration {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function checkPermissions() {
|
||||
$classes = array(
|
||||
\Configuration\Database::class,
|
||||
\Configuration\Mail::class,
|
||||
\Configuration\JWT::class
|
||||
);
|
||||
|
||||
$files = array();
|
||||
foreach($classes as $class) {
|
||||
$file = getClassPath($class);
|
||||
if(!is_writeable($file)) {
|
||||
$files[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
|
@ -62,19 +62,10 @@ namespace Documents\Install {
|
||||
const FINISH_INSTALLATION = 5;
|
||||
|
||||
//
|
||||
private $configDirectory;
|
||||
private $databaseConfiguration;
|
||||
private $mailConfiguration;
|
||||
private $jwtConfiguration;
|
||||
private $errorString;
|
||||
|
||||
function __construct($document) {
|
||||
parent::__construct($document);
|
||||
|
||||
$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 = "";
|
||||
}
|
||||
|
||||
@ -139,25 +130,14 @@ namespace Documents\Install {
|
||||
$success = true;
|
||||
$failedRequirements = array();
|
||||
|
||||
$writeableFiles = array(
|
||||
$this->configDirectory,
|
||||
$this->databaseConfiguration,
|
||||
$this->mailConfiguration,
|
||||
$this->jwtConfiguration,
|
||||
);
|
||||
|
||||
foreach($writeableFiles as $file) {
|
||||
if(!is_writeable($file)) {
|
||||
$unwriteableFiles = \Configuration\Configuration::checkPermissions();
|
||||
if(!empty($unwriteableFiles)) {
|
||||
foreach($unwriteableFiles as $file) {
|
||||
$failedRequirements[] = "<b>$file</b> is not writeable. Try running <b>chmod 600</b>";
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_writeable($this->configDirectory)) {
|
||||
$failedRequirements[] = "<b>$this->configDirectory</b> is not writeable. Try running <b>chmod 600</b>";
|
||||
$success = false;
|
||||
}
|
||||
|
||||
if(version_compare(PHP_VERSION, '7.1', '<')) {
|
||||
$failedRequirements[] = "PHP Version <b>>= 7.1</b> is required. Got: <b>" . PHP_VERSION . "</b>";
|
||||
$success = false;
|
||||
|
@ -6,10 +6,6 @@ function getClassPath($class, $suffix=true) {
|
||||
return "core/$path$suffix.php";
|
||||
}
|
||||
|
||||
function getWebRoot() {
|
||||
return dirname(__FILE__);
|
||||
}
|
||||
|
||||
function createError($msg) {
|
||||
return json_encode(array("success" => false, "msg" => $msg));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user