check if connection error

This commit is contained in:
Ibnu Maksum
2023-09-13 10:07:58 +07:00
parent ee2e67f490
commit 4bbb98fb98
2 changed files with 24 additions and 10 deletions

View File

@ -21,7 +21,12 @@ if ($admin['user_type'] != 'Admin') {
$cache = File::pathFixer('system/cache/plugin_repository.json');
if (file_exists($cache) && time() - filemtime($cache) < (24 * 60 * 60)) {
$json = json_decode(file_get_contents($cache), true);
$txt = file_get_contents($cache);
$json = json_decode($txt, true);
if(empty($json['plugins']) && empty($json['payment_gateway'])){
unlink($cache);
r2(U . 'dashboard', 'd', $txt);
}
} else {
$data = Http::getData($plugin_repository);
file_put_contents($cache, $data);