I want to apply a patch to a plugin automatically after each update.
I'm looking for a filter/action that runs after a plugin update or, preferably, after a specific plugin is updated.
I want to apply a patch to a plugin automatically after each update.
I'm looking for a filter/action that runs after a plugin update or, preferably, after a specific plugin is updated.
Here it is!
add_filter('activate_advanced-akismet/akismet.php','c_patch_plugin');
function c_patch_plugin() {
$fp = PATH_TO_FILE;
$file = @file_get_contents($fp);
if($file && !strstr($file,'/* EDIT */')) {
$file = str_replace(
'/* ORIGINAL */',
'/* EDIT */',
$file
);
$fp = fopen($fp, 'w');
fwrite($fp,$file);
fclose($fp);
}
}This topic has been closed to new replies.