aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/History.php13
-rw-r--r--application/NetscapeBookmarkUtils.php1
-rw-r--r--application/api/controllers/ApiController.php2
3 files changed, 11 insertions, 5 deletions
diff --git a/application/History.php b/application/History.php
index 35ec016a..8074a017 100644
--- a/application/History.php
+++ b/application/History.php
@@ -1,4 +1,9 @@
1<?php 1<?php
2namespace Shaarli;
3
4use DateTime;
5use Exception;
6use FileUtils;
2 7
3/** 8/**
4 * Class History 9 * Class History
@@ -141,7 +146,7 @@ class History
141 * Save a new event and write it in the history file. 146 * Save a new event and write it in the history file.
142 * 147 *
143 * @param string $status Event key, should be defined as constant. 148 * @param string $status Event key, should be defined as constant.
144 * @param mixed $id Event item identifier (e.g. link ID). 149 * @param mixed $id Event item identifier (e.g. link ID).
145 */ 150 */
146 protected function addEvent($status, $id = null) 151 protected function addEvent($status, $id = null)
147 { 152 {
@@ -166,11 +171,11 @@ class History
166 */ 171 */
167 protected function check() 172 protected function check()
168 { 173 {
169 if (! is_file($this->historyFilePath)) { 174 if (!is_file($this->historyFilePath)) {
170 FileUtils::writeFlatDB($this->historyFilePath, []); 175 FileUtils::writeFlatDB($this->historyFilePath, []);
171 } 176 }
172 177
173 if (! is_writable($this->historyFilePath)) { 178 if (!is_writable($this->historyFilePath)) {
174 throw new Exception(t('History file isn\'t readable or writable')); 179 throw new Exception(t('History file isn\'t readable or writable'));
175 } 180 }
176 } 181 }
@@ -191,7 +196,7 @@ class History
191 */ 196 */
192 protected function write() 197 protected function write()
193 { 198 {
194 $comparaison = new DateTime('-'. $this->retentionTime . ' seconds'); 199 $comparaison = new DateTime('-' . $this->retentionTime . ' seconds');
195 foreach ($this->history as $key => $value) { 200 foreach ($this->history as $key => $value) {
196 if ($value['datetime'] < $comparaison) { 201 if ($value['datetime'] < $comparaison) {
197 unset($this->history[$key]); 202 unset($this->history[$key]);
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php
index 84dd2b20..c0c007ea 100644
--- a/application/NetscapeBookmarkUtils.php
+++ b/application/NetscapeBookmarkUtils.php
@@ -2,6 +2,7 @@
2 2
3use Psr\Log\LogLevel; 3use Psr\Log\LogLevel;
4use Shaarli\Config\ConfigManager; 4use Shaarli\Config\ConfigManager;
5use Shaarli\History;
5use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser; 6use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser;
6use Katzgrau\KLogger\Logger; 7use Katzgrau\KLogger\Logger;
7 8
diff --git a/application/api/controllers/ApiController.php b/application/api/controllers/ApiController.php
index 9edefcf6..47e0e178 100644
--- a/application/api/controllers/ApiController.php
+++ b/application/api/controllers/ApiController.php
@@ -30,7 +30,7 @@ abstract class ApiController
30 protected $linkDb; 30 protected $linkDb;
31 31
32 /** 32 /**
33 * @var \History 33 * @var \Shaarli\History
34 */ 34 */
35 protected $history; 35 protected $history;
36 36