aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/History.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-05-07 17:40:17 +0200
committerGitHub <noreply@github.com>2017-05-07 17:40:17 +0200
commitb4189928f84758e1589715dfe04e2d966a4f3b88 (patch)
treef17b8fa91fe8244fed7a913d64ce3220551916ff /application/History.php
parenta4af59f47103a3f9c903eeddb1e30ab9cb7344f0 (diff)
parentb86aeccf6a99a9617c66cded7252a33b1df560cd (diff)
downloadShaarli-b4189928f84758e1589715dfe04e2d966a4f3b88.tar.gz
Shaarli-b4189928f84758e1589715dfe04e2d966a4f3b88.tar.zst
Shaarli-b4189928f84758e1589715dfe04e2d966a4f3b88.zip
Merge pull request #858 from ArthurHoaro/api/history-entries
Add history entries for API endpoint
Diffstat (limited to 'application/History.php')
-rw-r--r--application/History.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/application/History.php b/application/History.php
index f93b0356..116b9264 100644
--- a/application/History.php
+++ b/application/History.php
@@ -135,7 +135,7 @@ class History
135 135
136 $item = [ 136 $item = [
137 'event' => $status, 137 'event' => $status,
138 'datetime' => (new DateTime())->format(DateTime::ATOM), 138 'datetime' => new DateTime(),
139 'id' => $id !== null ? $id : '', 139 'id' => $id !== null ? $id : '',
140 ]; 140 ];
141 $this->history = array_merge([$item], $this->history); 141 $this->history = array_merge([$item], $this->history);
@@ -177,7 +177,7 @@ class History
177 { 177 {
178 $comparaison = new DateTime('-'. $this->retentionTime . ' seconds'); 178 $comparaison = new DateTime('-'. $this->retentionTime . ' seconds');
179 foreach ($this->history as $key => $value) { 179 foreach ($this->history as $key => $value) {
180 if (DateTime::createFromFormat(DateTime::ATOM, $value['datetime']) < $comparaison) { 180 if ($value['datetime'] < $comparaison) {
181 unset($this->history[$key]); 181 unset($this->history[$key]);
182 } 182 }
183 } 183 }