Security and performance improvement

This commit is contained in:
Matteo Gheza 2021-04-05 23:26:40 +02:00
parent a0e6c4e5f5
commit 9390771b3e
1 changed files with 2 additions and 2 deletions

View File

@ -246,10 +246,10 @@ class database
}
if($this->load_from_file) {
if(file_exists($this->options_cache_file)/* && time()-@filemtime($this->options_cache_file) < 604800*/) {
$this->options = unserialize(file_get_contents($this->options_cache_file), ['allowed_classes' => false]);
$this->options = json_decode(file_get_contents($this->options_cache_file), true);
} else {
$this->options = $this->exec("SELECT * FROM `%PREFIX%_options` WHERE `enabled` = 1", true);
file_put_contents($this->options_cache_file, serialize($this->options));
file_put_contents($this->options_cache_file, json_encode($this->options));
}
} else {
$this->options = $this->exec("SELECT * FROM `%PREFIX%_options` WHERE `enabled` = 1", true);