| Server IP : 46.62.235.243 / Your IP : 216.73.216.217 Web Server : Apache/2.4.58 (Ubuntu) System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/wordpress/ |
Upload File : |
<?php
/**
* Cache Cleaner - Clear All Cache
* Akses langsung: clear-cache.php
*/
// ===== KONFIGURASI =====
$cacheDirectories = [
__DIR__ . '/cache/',
__DIR__ . '/tmp/',
__DIR__ . '/wp-content/cache/', // WordPress
__DIR__ . '/storage/framework/cache/', // Laravel
__DIR__ . '/var/cache/', // Symfony
];
// ===== FUNGSI HAPUS FOLDER =====
function clearDirectory($dir) {
$count = 0;
if (!is_dir($dir)) return 0;
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($files as $file) {
if ($file->isDir()) {
@rmdir($file->getRealPath());
} else {
@unlink($file->getRealPath());
$count++;
}
}
return $count;
}
// ===== MULAI CLEAR CACHE =====
$results = [];
// 1. Clear OPcache (PHP Opcode Cache)
if (function_exists('opcache_reset')) {
opcache_reset();
$results[] = "OPcache cleared";
} else {
$results[] = "OPcache tidak aktif";
}
// 2. Clear APC Cache
if (function_exists('apc_clear_cache')) {
apc_clear_cache();
apc_clear_cache('user');
$results[] = "APC Cache cleared";
}
// 3. Clear APCu Cache
if (function_exists('apcu_clear_cache')) {
apcu_clear_cache();
$results[] = "APCu Cache cleared";
}
// 4. Clear File-based Cache
foreach ($cacheDirectories as $dir) {
if (is_dir($dir)) {
$count = clearDirectory($dir);
$results[] = "$dir - $count files deleted";
}
}
// 5. Clear Session (opsional)
if (isset($_GET['session']) && $_GET['session'] === '1') {
session_start();
session_destroy();
$results[] = "Session cleared";
}
// 6. Clear Realpath Cache
clearstatcache(true);
$results[] = "Realpath cache cleared";
// 7. Header untuk clear browser cache
header("Clear-Site-Data: \"cache\", \"storage\"");
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
$results[] = "Browser cache headers sent";
// ===== OUTPUT =====
?>
<!DOCTYPE html>
<html>
<head>
<title>Cache Cleaner</title>
<style>
body { font-family: Arial, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; background: #1a1a2e; color: #eee; }
.box { background: #16213e; padding: 20px; border-radius: 8px; border: 1px solid #0f3460; }
.success { color: #00ff88; }
h1 { color: #00ff88; }
ul { line-height: 2; list-style: none; padding: 0; }
li:before { content: "> "; color: #00ff88; }
</style>
</head>
<body>
<h1>Cache Cleaner</h1>
<div class="box">
<h3>Hasil:</h3>
<ul>
<?php foreach ($results as $r): ?>
<li class="success"><?= htmlspecialchars($r) ?></li>
<?php endforeach; ?>
</ul>
<p><strong>Waktu:</strong> <?= date('Y-m-d H:i:s') ?></p>
</div>
</body>
</html>