API ISsues fixes pluigna dn app, plugin v udapte 1.4.0

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-13 04:42:58 +00:00
parent a91e22895b
commit a361dea528
9 changed files with 728 additions and 27 deletions

View File

@@ -756,8 +756,42 @@ class Igny8Admin {
public function sanitize_post_status($value) {
$allowed = array('draft', 'publish');
return in_array($value, $allowed, true) ? $value : 'draft';
}
}
}
/**
* Clear update cache via AJAX
*
* Fixes the double-update notification bug by clearing WordPress update transients
* and forcing a fresh update check.
*/
public static function clear_update_cache_ajax() {
// Verify nonce
if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'igny8_clear_cache')) {
wp_send_json_error(array('message' => 'Invalid security token'));
return;
}
// Check user permissions
if (!current_user_can('manage_options')) {
wp_send_json_error(array('message' => 'Insufficient permissions'));
return;
}
// Delete the update_plugins transient to force a fresh check
delete_site_transient('update_plugins');
// Also clear any cached update info
wp_cache_delete('igny8_update_check', 'igny8');
// Clear WordPress object cache
wp_cache_flush();
// Log for debugging
error_log('IGNY8: Update cache cleared manually by admin');
wp_send_json_success(array(
'message' => 'Update cache cleared successfully. WordPress will check for updates on next page load.'
));
}}
// Register AJAX handlers
add_action('wp_ajax_igny8_test_connection', array('Igny8Admin', 'test_connection'));
@@ -766,4 +800,4 @@ add_action('wp_ajax_igny8_sync_taxonomies', array('Igny8Admin', 'sync_taxonomies
add_action('wp_ajax_igny8_sync_from_igny8', array('Igny8Admin', 'sync_from_igny8'));
add_action('wp_ajax_igny8_collect_site_data', array('Igny8Admin', 'collect_site_data'));
add_action('wp_ajax_igny8_get_stats', array('Igny8Admin', 'get_stats'));
add_action('wp_ajax_igny8_clear_update_cache', array('Igny8Admin', 'clear_update_cache_ajax'));