<?php
/**
 * Clear PHP OPcache
 * This script helps clear PHP's opcache to ensure updated files are loaded
 */

// Clear opcache if available
if (function_exists('opcache_reset')) {
    opcache_reset();
    echo "✅ OPcache cleared successfully!\n";
} else {
    echo "ℹ️ OPcache is not enabled or not available.\n";
}

// Clear realpath cache
clearstatcache(true);
echo "✅ Realpath cache cleared successfully!\n";

// Clear session if needed
if (isset($_GET['clear_session'])) {
    session_start();
    session_destroy();
    echo "✅ Session cleared successfully!\n";
}

echo "\n📝 All caches have been cleared. Please refresh your browser and try again.\n";
?>

