17 lines
411 B
PHP
17 lines
411 B
PHP
<?php
|
|
session_start();
|
|
if (empty($_SESSION['is_admin'])) exit(json_encode(['error'=>'Not authorized']));
|
|
|
|
$cacheDir = __DIR__.'/../../cache';
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
if(!is_dir($cacheDir)){
|
|
echo json_encode(['error'=>'Cache folder not found']); exit;
|
|
}
|
|
|
|
$files = glob($cacheDir.'/*');
|
|
foreach($files as $f){ if(is_file($f)) unlink($f); }
|
|
|
|
echo json_encode(['message'=>'Cache cleared']);
|