文件操作 - clear-chace-wp.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/i2kplay/public_html/clear-chace-wp.php
编辑文件内容
<?php /** * Advanced WordPress Cache Purge - UI Enhanced */ error_reporting(0); set_time_limit(180); // Logika Pembersihan (Disimpan dalam array untuk tampilan) $status_logs = []; /* WordPress yükle */ $wpLoad = __DIR__ . '/wp-load.php'; if(file_exists($wpLoad)){ require_once $wpLoad; $status_logs[] = ['task' => 'WordPress Core', 'status' => 'Success', 'msg' => 'WordPress berhasil dimuat.']; } else { $status_logs[] = ['task' => 'WordPress Core', 'status' => 'Error', 'msg' => 'wp-load.php tidak ditemukan!']; } /* Object Cache */ if(function_exists('wp_cache_flush')){ wp_cache_flush(); $status_logs[] = ['task' => 'Object Cache', 'status' => 'Success', 'msg' => 'Object cache berhasil dibersihkan.']; } /* Transient */ if(isset($wpdb)){ $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_%'"); $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_site_transient_%'"); $status_logs[] = ['task' => 'Transients', 'status' => 'Success', 'msg' => 'Database transient cache dihapus.']; } /* Plugin Specific */ if(class_exists('LiteSpeed\Purge')){ \LiteSpeed\Purge::purge_all(); $status_logs[] = ['task' => 'LiteSpeed', 'status' => 'Success', 'msg' => 'Purge All dijalankan.']; } if(function_exists('rocket_clean_domain')){ rocket_clean_domain(); $status_logs[] = ['task' => 'WP Rocket', 'status' => 'Success', 'msg' => 'Domain cache dibersihkan.']; } if(function_exists('w3tc_flush_all')){ w3tc_flush_all(); $status_logs[] = ['task' => 'W3 Total Cache', 'status' => 'Success', 'msg' => 'Semua cache di-flush.']; } if(function_exists('wp_cache_clear_cache')){ wp_cache_clear_cache(); $status_logs[] = ['task' => 'WP Super Cache', 'status' => 'Success', 'msg' => 'Cache file dihapus.']; } if(function_exists('opcache_reset')){ opcache_reset(); $status_logs[] = ['task' => 'PHP OPcache', 'status' => 'Success', 'msg' => 'OPcache berhasil di-reset.']; } /* Disk Cache */ function purge_directory($dir){ if(!is_dir($dir)) return; $items = scandir($dir); foreach($items as $item){ if($item == '.' || $item == '..') continue; $path = $dir.'/'.$item; if(is_dir($path)){ purge_directory($path); @rmdir($path); } else { @unlink($path); } } } $cache_dirs = [ "wp-content/cache", "wp-content/litespeed", "wp-content/cache/minify", "wp-content/cache/page_enhanced", "wp-content/cache/object", "wp-content/cache/db", "wp-content/cache/autoptimize", "wp-content/uploads/cache", "wp-content/uploads/litespeed" ]; foreach($cache_dirs as $dir){ $full = __DIR__.'/'.$dir; if(is_dir($full)){ purge_directory($full); $status_logs[] = ['task' => 'Disk Cache', 'status' => 'Success', 'msg' => 'Folder dibersihkan: ' . $dir]; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Cache Purge Dashboard</title> <script src="https://cdn.tailwindcss.com"></script> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet"> <style> body { font-family: 'Inter', sans-serif; background-color: #f3f4f6; } </style> </head> <body class="py-10 px-5"> <div class="max-w-3xl mx-auto"> <div class="bg-white rounded-t-xl shadow-sm p-6 border-b border-gray-100"> <div class="flex items-center justify-between"> <div> <h1 class="text-2xl font-bold text-gray-800">WordPress Cache Purge</h1> <p class="text-sm text-gray-500">Sistem pembersihan cache otomatis</p> </div> <div class="bg-green-100 text-green-600 px-3 py-1 rounded-full text-xs font-semibold uppercase"> System Active </div> </div> </div> <div class="bg-white shadow-sm overflow-hidden"> <table class="min-w-full divide-y divide-gray-200"> <thead class="bg-gray-50"> <tr> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Module</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Status</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Details</th> </tr> </thead> <tbody class="divide-y divide-gray-200"> <?php foreach($status_logs as $log): ?> <tr class="hover:bg-gray-50 transition"> <td class="px-6 py-4 whitespace-nowrap text-sm font-semibold text-gray-700"> <?php echo $log['task']; ?> </td> <td class="px-6 py-4 whitespace-nowrap"> <?php if($log['status'] == 'Success'): ?> <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800"> Done </span> <?php else: ?> <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800"> Failed </span> <?php endif; ?> </td> <td class="px-6 py-4 text-sm text-gray-500 uppercase italic text-xs"> <?php echo $log['msg']; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <div class="bg-gray-800 rounded-b-xl p-4 text-center"> <p class="text-gray-400 text-sm tracking-widest font-bold"> CLEAR CACHE MR.G4COR!! </p> </div> <div class="mt-6 text-center"> <button onclick="window.location.reload();" class="bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-6 rounded-lg transition shadow-md"> Ulangi Pembersihan </button> </div> </div> </body> </html>
修改文件时间
将文件时间修改为当前时间的前一年
删除文件