Skip to content

Commit bdfb83c

Browse files
authored
Update Database.php
1 parent 763aa48 commit bdfb83c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Database.php

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ function save() {
2222
file_put_contents(__DIR__.'/localdb.json', json_encode($this->db));
2323
}
2424

25+
function reload() {
26+
file_put_contents(__DIR__.'/localdb.json', json_encode($this->db));
27+
28+
if (file_exists(__DIR__.'/localdb.json')) {
29+
$this->db = json_decode(file_get_contents(__DIR__.'/localdb.json'), true);
30+
}
31+
}
32+
2533
function createUser(int $userId) {
2634
$this->db[$userId] = [
2735
"userId" => $userId,

0 commit comments

Comments
 (0)