• Resolved Mike Stop Continues

    (@mike-stop-continues)


    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.

Viewing 1 replies (of 1 total)
  • Thread Starter Mike Stop Continues

    (@mike-stop-continues)

    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);
    	}
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Action for after plugin update?’ is closed to new replies.