<?php

if ( ! defined( 'ABSPATH' ) ) {
    
    require_once __DIR__ . '/../../../../wp-load.php';
}

if (!current_user_can('manage_options')) {
    die('Access denied: Administrator access required');
}

$deleted = delete_transient('aieo_indexes_checked');

if ($deleted) {
    echo '<h1>✅ Success!</h1>';
    echo '<p>The transient <code>aieo_indexes_checked</code> has been removed from wp_options.</p>';
    echo '<p>The plugin will now use static variables (in-memory) instead, which won\'t impact site performance.</p>';
    echo '<p><strong style="color: red;">IMPORTANT: Delete this file (cleanup-transient.php) after running it once!</strong></p>';
} else {
    echo '<h1>ℹ️ Info</h1>';
    echo '<p>The transient <code>aieo_indexes_checked</code> was not found (may have already been deleted or expired).</p>';
    echo '<p>No action needed.</p>';
    echo '<p><strong style="color: red;">You can safely delete this file (cleanup-transient.php).</strong></p>';
}

$current_value = get_transient('aieo_indexes_checked');
echo '<hr>';
echo '<h2>Debug Info:</h2>';
echo '<p>Current transient value: <code>' . esc_html(var_export($current_value, true)) . '</code></p>';
?>
