|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!defined('ABSPATH')) exit; |
|
|
|
|
|
function hf_trigger_sync($reason) { |
|
|
|
|
|
|
|
|
$flag = '/var/www/html/wp-content/uploads/hf_sync_needed'; |
|
|
|
|
|
file_put_contents($flag, $reason . "\n", FILE_APPEND); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_action('activated_plugin', function($plugin) { |
|
|
hf_trigger_sync("Plugin activated: $plugin"); |
|
|
}); |
|
|
|
|
|
add_action('deactivated_plugin', function($plugin) { |
|
|
hf_trigger_sync("Plugin deactivated: $plugin"); |
|
|
}); |
|
|
|
|
|
add_action('upgrader_process_complete', function($upgrader, $args) { |
|
|
if (!isset($args['type'])) return; |
|
|
|
|
|
$type = $args['type']; |
|
|
|
|
|
if ($type === 'plugin') { |
|
|
hf_trigger_sync("Plugin installed/updated"); |
|
|
} |
|
|
if ($type === 'theme') { |
|
|
hf_trigger_sync("Theme installed/updated"); |
|
|
} |
|
|
}, 10, 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_action('switch_theme', function($new_theme) { |
|
|
hf_trigger_sync("Theme switched: $new_theme"); |
|
|
}); |
|
|
|