No more lightdb:delete v5

This commit is contained in:
xdrm-brackets 2017-09-14 16:05:52 +02:00
parent 7046d3900c
commit 01ebcc324e
1 changed files with 3 additions and 2 deletions

View File

@ -125,7 +125,8 @@
/* (2) On ajoute les données aux fichier */ /* (2) On ajoute les données aux fichier */
$json_data = json_encode($data); $json_data = json_encode($data);
$this->driver->seek($already_line); $this->driver->seek($already_line);
$this->line++; if( $already_line == $this->line )
$this->line++;
$written = $this->driver->fwrite( $json_data.PHP_EOL ); $written = $this->driver->fwrite( $json_data.PHP_EOL );
// Si erreur d'écriture, on retourne FALSE // Si erreur d'écriture, on retourne FALSE
@ -134,7 +135,7 @@
/* (3) On enregistre l'index */ /* (3) On enregistre l'index */
$this->index[$key] = [ $this->index[$key] = [
'line' => $this->line - 1, 'line' => $already_line - 1,
'hash' => sha1($json_data) 'hash' => sha1($json_data)
]; ];