I am using the following filter to run a function that generates a CSS file after a plugin gets updated. Currently the CSS gets generated when any plugin gets updated. Is there a simple way to limit this running to a particular plugin?
add_filter('upgrader_post_install', 'generate_my_css', 100, 0);
function generate_my_css() {
$ss_dir = get_stylesheet_directory();
$pi_dir = plugin_dir_path( __FILE__ );
ob_start();
require($pi_dir . 'includes/css/mycss.php');
$css = ob_get_clean();
file_put_contents($ss_dir . '/css/mycss.css', $css, LOCK_EX);
}
Ideally the above code would live in the plugin that was being updated but could just as easily live in the functions.php