Agregar plugin WP Debug para diagnóstico sistemático
This commit is contained in:
47
wp-content/plugins/wp-debug/inc/deactivation.php
Normal file
47
wp-content/plugins/wp-debug/inc/deactivation.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Deactivation
|
||||
*
|
||||
* @package WP_Debug
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* WP_Debug_Deactivation class
|
||||
*/
|
||||
class WP_Debug_Deactivation {
|
||||
|
||||
/**
|
||||
* Run deactivation tasks
|
||||
*/
|
||||
public static function deactivate() {
|
||||
// Clean up transients
|
||||
self::cleanup_transients();
|
||||
|
||||
// Flush rewrite rules
|
||||
flush_rewrite_rules();
|
||||
|
||||
// Note: We DO NOT delete logs or database tables
|
||||
// This preserves data in case user reactivates the plugin
|
||||
// User can manually delete via Tools > WP Debug if desired
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up temporary transients
|
||||
*/
|
||||
private static function cleanup_transients() {
|
||||
// Delete temporary transients only
|
||||
delete_transient('wp_debug_temp_data');
|
||||
delete_transient('wp_debug_cache');
|
||||
|
||||
// Clean up expired transients
|
||||
global $wpdb;
|
||||
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_wp_debug_%' AND option_value < UNIX_TIMESTAMP()");
|
||||
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_wp_debug_%' AND option_name NOT IN (SELECT CONCAT('_transient_', SUBSTRING(option_name, 19)) FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_wp_debug_%')");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user