Revert "API ISsues fixes pluigna dn app, plugin v udapte 1.4.0"
This reverts commit a361dea528.
This commit is contained in:
@@ -756,42 +756,8 @@ 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'));
|
||||
@@ -800,4 +766,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'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user