DEV Community

Farooq khan
Farooq khan

Posted on • Updated on

How to download , apply, revert patches in wordpress

To download a patch , go to plugin trac history and download it,.
it is also called as development blog or changelog.
Today I’m going to patch aregato autoresponder plugin by using its changelogs.

The new version of aregato diff file santizes the input ,.
The previous version had the bug which will be easily hacked by cross side scripting.

Get the diff file from below link .

https://plugins.trac.wordpress.org/changeset?old_path=%2Fbft-autoresponder&old=1943235&new_path=%2Fbft-autoresponder&new=1943235&sfp_email=&sfph_mail=

Change log is 1943235 .

Scroll to bottom., click on Unified Diff and download the diff file.

Now move the changeset diff file to your wordpress site where bft autoresponder plugin located.

Now I’m going to patch only one file /views/unsubscribe.html.php file.
Move the diff file to

wp-content/plugins/bft-autoresponder/views/

Now put the following command and replace the filename.diff with your diff file name.

=== $ patch -p0 > filename.diff ===
Enter fullscreen mode Exit fullscreen mode

It will run the command and give following lines.

== The text leading up to this was: ==
== ————————– ==
== |Index: /bft-autoresponder/trunk/views/unsubscribe.html.php ==
== |=================================================================== ==
== |— /bft-autoresponder/trunk/views/unsubscribe.html.php (revision 1943234) ==
== |+++ /bft-autoresponder/trunk/views/unsubscribe.html.php (revision 1943235) ==
== ————————– ==
== File to patch: unsubscribe.html.php ==
== patching file unsubscribe.html.php ==
Enter fullscreen mode Exit fullscreen mode

Now check the unsubscribe.html.php file . Line no 3 should be changed .

To revert the patch put the following command.

$patch -p0 -R filename.diff
Enter fullscreen mode Exit fullscreen mode

Top comments (0)