diff options
author | Phie <phie@phie.ovh> | 2019-08-18 00:27:43 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2019-08-18 00:27:43 +0300 |
commit | 91542f984bf6aaa8ff028c9b68e309b26ca7ce6c (patch) | |
tree | 40b9986d3dd0e73e25d3561067473d15e01058f5 | |
parent | 9981f90c000a91463bde33cee4273cda80507ccc (diff) |
fix heavy db
-rwxr-xr-x | lib/Controller/NoteController.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php index 83b8cf0..95b2b63 100755 --- a/lib/Controller/NoteController.php +++ b/lib/Controller/NoteController.php @@ -109,9 +109,14 @@ public function getRecent() { $recents = json_decode($this->getRecentFile()->getContent(),true); + $paths = array(); if($recents['data'] == null) $recents['data'] = array(); + if($recents['metadata'] != null){ //fix an old bug + unset($recents['metadata']); + $this->internalSaveRecent(json_encode($recents)); + } foreach($recents['data'] as $item){ $path = $item['path']; if(array_key_exists('newpath', $item) && $item['newpath'] != null){ @@ -337,8 +342,11 @@ * @NoCSRFRequired */ public function mergeRecentDB() { + if(!$this->CarnetFolder->nodeExists("quickdoc/recentdb/recentnc")) + $lastmod = -1; $myDb = $this->getRecentFile(); - $lastmod = $myDb->getMTime(); + if($lastmod != -1) + $lastmod = $myDb->getMTime(); $hasChanged = false; foreach($this->CarnetFolder->get("quickdoc/recentdb/")->getDirectoryListing() as $inDB){ if($inDB->getName() === $myDb->getName()||$inDB->getMTime()<$lastmod){ @@ -426,7 +434,7 @@ } public function internalPostActions($actions){ - $recent = $this->getRecent(); + $recent = json_decode($this->getRecentFile()->getContent(),true); foreach($actions as $action){ array_push($recent['data'],$action); } |