File: C:/inetpub/vhosts/hrreflections.com/httpdocs/ad.php
<?php
/**
* Advanced WordPress Cache Purge
* LiteSpeed Purge All benzeri davranır
*/
error_reporting(0);
set_time_limit(180);
echo "<h3>WordPress Cache Purge</h3>";
/* WordPress yükle */
$wpLoad = __DIR__ . '/wp-load.php';
if(file_exists($wpLoad)){
require_once $wpLoad;
echo "WordPress yüklendi<br>";
}else{
echo "WordPress bulunamadı<br>";
}
/* Object Cache */
if(function_exists('wp_cache_flush')){
wp_cache_flush();
echo "Object cache temizlendi<br>";
}
/* Transient temizleme */
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_%'");
echo "WordPress transient cache temizlendi<br>";
}
/* LiteSpeed Cache */
if(class_exists('LiteSpeed\Purge')){
\LiteSpeed\Purge::purge_all();
echo "LiteSpeed Purge All çalıştı<br>";
}
/* WP Rocket */
if(function_exists('rocket_clean_domain')){
rocket_clean_domain();
echo "WP Rocket purge yapıldı<br>";
}
/* W3 Total Cache */
if(function_exists('w3tc_flush_all')){
w3tc_flush_all();
echo "W3 Total Cache flush edildi<br>";
}
/* WP Super Cache */
if(function_exists('wp_cache_clear_cache')){
wp_cache_clear_cache();
echo "WP Super Cache temizlendi<br>";
}
/* OPcache */
if(function_exists('opcache_reset')){
opcache_reset();
echo "PHP OPcache resetlendi<br>";
}
/* Disk Cache Temizleme */
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);
echo "Disk cache temizlendi: ".$dir."<br>";
}
}
echo "<br><b>ARSENE YOKSA EKSİKSİNİZ.</b>";
?>