From 01ebcc324e2114146eb95045fde00b3ba6bdc4fb Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 14 Sep 2017 16:05:52 +0200 Subject: [PATCH] No more lightdb:delete v5 --- build/lightdb/core/lightdb.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/lightdb/core/lightdb.php b/build/lightdb/core/lightdb.php index 434a86a..758ad85 100644 --- a/build/lightdb/core/lightdb.php +++ b/build/lightdb/core/lightdb.php @@ -125,7 +125,8 @@ /* (2) On ajoute les données aux fichier */ $json_data = json_encode($data); $this->driver->seek($already_line); - $this->line++; + if( $already_line == $this->line ) + $this->line++; $written = $this->driver->fwrite( $json_data.PHP_EOL ); // Si erreur d'écriture, on retourne FALSE @@ -134,7 +135,7 @@ /* (3) On enregistre l'index */ $this->index[$key] = [ - 'line' => $this->line - 1, + 'line' => $already_line - 1, 'hash' => sha1($json_data) ];