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