aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/History.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/application/History.php b/application/History.php
index c06067df..f93b0356 100644
--- a/application/History.php
+++ b/application/History.php
@@ -70,6 +70,15 @@ class History
70 if ($retentionTime !== null) { 70 if ($retentionTime !== null) {
71 $this->retentionTime = $retentionTime; 71 $this->retentionTime = $retentionTime;
72 } 72 }
73 }
74
75 /**
76 * Initialize: read history file.
77 *
78 * Allow lazy loading (don't read the file if it isn't necessary).
79 */
80 protected function initialize()
81 {
73 $this->check(); 82 $this->check();
74 $this->read(); 83 $this->read();
75 } 84 }
@@ -120,6 +129,10 @@ class History
120 */ 129 */
121 protected function addEvent($status, $id = null) 130 protected function addEvent($status, $id = null)
122 { 131 {
132 if ($this->history === null) {
133 $this->initialize();
134 }
135
123 $item = [ 136 $item = [
124 'event' => $status, 137 'event' => $status,
125 'datetime' => (new DateTime())->format(DateTime::ATOM), 138 'datetime' => (new DateTime())->format(DateTime::ATOM),
@@ -178,6 +191,10 @@ class History
178 */ 191 */
179 public function getHistory() 192 public function getHistory()
180 { 193 {
194 if ($this->history === null) {
195 $this->initialize();
196 }
197
181 return $this->history; 198 return $this->history;
182 } 199 }
183} 200}