<?php
+
namespace Shaarli;
use DateTime;
use Exception;
+use Shaarli\Bookmark\Bookmark;
+use Shaarli\Helper\FileUtils;
/**
* Class History
* - UPDATED: link updated
* - DELETED: link deleted
* - SETTINGS: the settings have been updated through the UI.
- * - IMPORT: bulk links import
+ * - IMPORT: bulk bookmarks import
*
* Note: new events are put at the beginning of the file and history array.
*/
/**
* @var string Action key: a new link has been created.
*/
- const CREATED = 'CREATED';
+ public const CREATED = 'CREATED';
/**
* @var string Action key: a link has been updated.
*/
- const UPDATED = 'UPDATED';
+ public const UPDATED = 'UPDATED';
/**
* @var string Action key: a link has been deleted.
*/
- const DELETED = 'DELETED';
+ public const DELETED = 'DELETED';
/**
* @var string Action key: settings have been updated.
*/
- const SETTINGS = 'SETTINGS';
+ public const SETTINGS = 'SETTINGS';
/**
* @var string Action key: a bulk import has been processed.
*/
- const IMPORT = 'IMPORT';
+ public const IMPORT = 'IMPORT';
/**
* @var string History file path.
/**
* Add Event: new link.
*
- * @param array $link Link data.
+ * @param Bookmark $link Link data.
*/
public function addLink($link)
{
- $this->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());
}
/**
/**
* 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()
{