X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FHistory.php;h=a58466528050e2efb4aee4dbccb59f3629e42041;hb=HEAD;hp=35ec016a9be27c374dec0e96cbcd0d27e20a119a;hpb=286757ab29660916f6b66d1fc0ad3b53aef337c8;p=github%2Fshaarli%2FShaarli.git diff --git a/application/History.php b/application/History.php index 35ec016a..d230f39d 100644 --- a/application/History.php +++ b/application/History.php @@ -1,5 +1,12 @@ addEvent(self::CREATED, $link['id']); + $this->addEvent(self::CREATED, $link->getId()); } /** * Add Event: update existing link. * - * @param array $link Link data. + * @param Bookmark $link Link data. */ public function updateLink($link) { - $this->addEvent(self::UPDATED, $link['id']); + $this->addEvent(self::UPDATED, $link->getId()); } /** * Add Event: delete existing link. * - * @param array $link Link data. + * @param Bookmark $link Link data. */ public function deleteLink($link) { - $this->addEvent(self::DELETED, $link['id']); + $this->addEvent(self::DELETED, $link->getId()); } /** @@ -130,7 +137,7 @@ class History /** * Add Event: bulk import. * - * Note: we don't store links add/update one by one since it can have a huge impact on performances. + * Note: we don't store bookmarks add/update one by one since it can have a huge impact on performances. */ public function importLinks() { @@ -166,11 +173,11 @@ class History */ protected function check() { - if (! is_file($this->historyFilePath)) { + if (!is_file($this->historyFilePath)) { FileUtils::writeFlatDB($this->historyFilePath, []); } - if (! is_writable($this->historyFilePath)) { + if (!is_writable($this->historyFilePath)) { throw new Exception(t('History file isn\'t readable or writable')); } } @@ -191,7 +198,7 @@ class History */ protected function write() { - $comparaison = new DateTime('-'. $this->retentionTime . ' seconds'); + $comparaison = new DateTime('-' . $this->retentionTime . ' seconds'); foreach ($this->history as $key => $value) { if ($value['datetime'] < $comparaison) { unset($this->history[$key]);