diff --git a/dbjson.php b/dbjson.php index c03884b..05a5f22 100644 --- a/dbjson.php +++ b/dbjson.php @@ -73,7 +73,7 @@ class dbjson $this->db[$collection]["content"][$uniqueKey] = array_merge ( array ("_id"=>$uniqueKey), $document); - $this->writeDB ($this->db); + $this->writeDB (); $this->lockUN (); return 1; } @@ -97,7 +97,7 @@ class dbjson array ("_id"=>$uniqueKey), $document); } - $this->writeDB ($this->db); + $this->writeDB (); $this->db = null; $this->lockUN (); return count ($documents); @@ -197,7 +197,7 @@ class dbjson $this->db[$collection]["content"][$key])) unset ($this->db[$collection]["content"][$key][$field]); } - $this->writeDB ($this->db); + $this->writeDB (); $this->lockUN (); $this->db = null; return count ($keys); @@ -223,7 +223,7 @@ class dbjson $replace = array_merge ($replace, $document); $this->db[$collection]["content"][$key] = $replace; } - $this->writeDB ($this->db); + $this->writeDB (); $this->lockUN (); $this->db = null; return count ($keys); @@ -245,7 +245,7 @@ class dbjson reset ($keys); $key = key ($keys); unset ($this->db[$collection]["content"][$key]); - $this->writeDB ($this->db); + $this->writeDB (); $this->lockUN (); $this->db = null; return 1; @@ -265,7 +265,7 @@ class dbjson $keys = $this->filter ($collection, $filter); foreach ($keys as $key) unset ($this->db[$collection]["content"][$key]); - $this->writeDB ($this->db); + $this->writeDB (); $this->lockUN (); $this->db = null; return count ($keys); @@ -417,8 +417,8 @@ class dbjson * @param $data array The database to store * @return bool True if the recording is OK, false if there is a problem */ - private function writeDB ($data) + private function writeDB () { - return !! file_put_contents ($this->dbfile, json_encode ($data)); + return !! file_put_contents ($this->dbfile, json_encode ($this->db)); } }