forked from ZwiiCMS-Team/ZwiiCampus
1.7.09 supprimer un test dans jsondb
This commit is contained in:
parent
63541cf83a
commit
c8c74d9be3
@ -121,17 +121,17 @@ class JsonDb extends \Prowebcraft\Dot
|
|||||||
} else {
|
} else {
|
||||||
if ($this->config['backup']) {
|
if ($this->config['backup']) {
|
||||||
try {
|
try {
|
||||||
|
//todo make backup of database
|
||||||
copy($this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'], $this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'] . '.backup');
|
copy($this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'], $this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'] . '.backup');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
error_log('Erreur de chargement : ' . $e);
|
|
||||||
exit('Erreur de chargement : ' . $e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->data = json_decode(file_get_contents($this->db), true);
|
$this->data = json_decode(file_get_contents($this->db), true);
|
||||||
if (!$this->data === null && json_last_error() !== JSON_ERROR_NONE) {
|
if (!$this->data === null) {
|
||||||
throw new \InvalidArgumentException('Le fichier ' . $this->db
|
throw new \InvalidArgumentException('Database file ' . $this->db
|
||||||
. ' contient des données invalides.');
|
. ' contains invalid json object. Please validate or remove file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
@ -142,14 +142,10 @@ class JsonDb extends \Prowebcraft\Dot
|
|||||||
*/
|
*/
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$v = json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT | JSON_PRETTY_PRINT);
|
$v = json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT );
|
||||||
// $v = json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT);
|
// $v = json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT);
|
||||||
$l = strlen($v);
|
$l = strlen($v);
|
||||||
$t = 0;
|
$t = 0;
|
||||||
if ($v === false) {
|
|
||||||
error_log('Erreur d\'encodage JSON : ' . json_last_error_msg());
|
|
||||||
exit ('Erreur d\'encodage JSON : ' . json_last_error_msg());
|
|
||||||
}
|
|
||||||
while ($t < 5) {
|
while ($t < 5) {
|
||||||
$w = file_put_contents($this->db, $v); // Multi user get a locker
|
$w = file_put_contents($this->db, $v); // Multi user get a locker
|
||||||
if ($w == $l) {
|
if ($w == $l) {
|
||||||
|
@ -51,7 +51,7 @@ class common
|
|||||||
const ACCESS_TIMER = 1800;
|
const ACCESS_TIMER = 1800;
|
||||||
|
|
||||||
// Numéro de version
|
// Numéro de version
|
||||||
const ZWII_VERSION = '1.7.08';
|
const ZWII_VERSION = '1.7.09';
|
||||||
|
|
||||||
// URL autoupdate
|
// URL autoupdate
|
||||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
||||||
|
Loading…
Reference in New Issue
Block a user