improved installer
This commit is contained in:
@@ -221,8 +221,8 @@ class Manager
|
||||
{
|
||||
$fileContent = $this->getContents($path);
|
||||
|
||||
$savedDataArray= $this->getArrayData($fileContent);
|
||||
$newDataArray= $this->getArrayData($content);
|
||||
$savedDataArray = Utils\Json::getArrayData($fileContent);
|
||||
$newDataArray = Utils\Json::getArrayData($content);
|
||||
|
||||
$data= Utils\Util::merge($savedDataArray, $newDataArray);
|
||||
if ($isJSON) {
|
||||
@@ -245,8 +245,8 @@ class Manager
|
||||
{
|
||||
$fileContent = $this->getContents($path);
|
||||
|
||||
$savedDataArray= $this->getArrayData($fileContent);
|
||||
$newDataArray= $this->getArrayData($content);
|
||||
$savedDataArray = Utils\Json::getArrayData($fileContent);
|
||||
$newDataArray = Utils\Json::getArrayData($content);
|
||||
|
||||
if ($onlyFirstLevel) {
|
||||
foreach($newDataArray as $key => $val) {
|
||||
@@ -288,7 +288,7 @@ class Manager
|
||||
return false;
|
||||
}
|
||||
|
||||
$currentDataArray = $this->getArrayData($currentData);
|
||||
$currentDataArray = Utils\Json::getArrayData($currentData);
|
||||
|
||||
$unsettedData = Utils\Util::unsetInArray($currentDataArray, $unsets);
|
||||
|
||||
@@ -505,27 +505,6 @@ class Manager
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/** //TODO remove
|
||||
* Get an array data (if JSON convert to array)
|
||||
*
|
||||
* @param mixed $data - can be JSON, array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArrayData($data)
|
||||
{
|
||||
if (is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
else if (Utils\Json::isJSON($data)) {
|
||||
return Utils\Json::decode($data, true);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a filename without the file extension
|
||||
*
|
||||
|
||||
@@ -35,21 +35,29 @@ class SystemHelper
|
||||
|
||||
protected $modRewriteUrl = '/api/v1/Metadata';
|
||||
|
||||
protected $writableDir = 'data';
|
||||
protected $systemConfig = 'data/config.php';
|
||||
|
||||
|
||||
public function initWritable()
|
||||
{
|
||||
if (is_writable($this->writableDir)) {
|
||||
return true;
|
||||
$pathInfo = pathinfo($this->systemConfig);
|
||||
|
||||
if (!is_writable($pathInfo['dirname'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (!@touch($this->systemConfig)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getWritableDir()
|
||||
public function getSystemDir()
|
||||
{
|
||||
return $this->writableDir;
|
||||
$pathInfo = pathinfo($this->systemConfig);
|
||||
|
||||
return $pathInfo['dirname'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ require_once 'core/SystemHelper.php';
|
||||
$systemHelper = new SystemHelper();
|
||||
|
||||
if (!$systemHelper->initWritable()) {
|
||||
$dir = $systemHelper->getWritableDir();
|
||||
$dir = $systemHelper->getSystemDir();
|
||||
|
||||
$message = $langs['Bad init Permission'];
|
||||
$message = str_replace('{*}', $dir, $message);
|
||||
|
||||
Reference in New Issue
Block a user