| Server IP : 54.37.205.81 / Your IP : 216.73.216.76 Web Server : nginx/1.22.1 System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64 User : debian ( 1000) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/cwd/wp-content/mu-plugins/ |
Upload File : |
<?php
/*
Plugin Name: CRMI Safety Net (MU)
Description: Disattiva automaticamente il plugin CRMI Rassegna se causa un errore fatale e mostra un avviso in admin.
Version: 1.0.0
Author: CRMI
*/
if (!defined('ABSPATH')) { exit; }
add_action('admin_notices', function () {
$msg = get_option('crmi_mu_last_fatal', '');
if ($msg) {
echo '<div class="notice notice-error"><p><strong>CRMI Safety Net:</strong> ' . esc_html($msg) . '</p></div>';
}
});
register_shutdown_function(function () {
$e = error_get_last();
if (!$e) return;
$fatal_types = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR);
if (!in_array($e['type'], $fatal_types, true)) return;
$file = isset($e['file']) ? $e['file'] : '';
$line = isset($e['line']) ? intval($e['line']) : 0;
$message = isset($e['message']) ? $e['message'] : '';
// Se l'errore proviene da un plugin CRMI della rassegna, disattivalo
$is_crmi = (strpos($file, 'crmi-rassegna') !== false) || (strpos($message, 'crmi-rassegna') !== false);
if (!$is_crmi) return;
if (!function_exists('deactivate_plugins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$active = get_option('active_plugins', array());
$changed = false;
foreach ($active as $idx => $plugin_file) {
if (strpos($plugin_file, 'crmi-rassegna') !== false) {
unset($active[$idx]);
$changed = true;
}
}
if ($changed) {
update_option('active_plugins', array_values($active));
update_option('crmi_mu_last_fatal', sprintf('Il plugin CRMI รจ stato disattivato automaticamente per un errore fatale in %s (linea %d). Messaggio: %s', $file, $line, $message));
}
});