To prove patch of the Trac de WordPress

Last update: 26 of April of 2020

Table of contents

Perhaps you are not developer, but that you know to program and you it likes to try if some patches of the code of WordPress can work, reason why is more than reasonable than you collaborate in the Community reviewing if patch that they have been created works and fulfills their assignment.

In order to test these you will need an installation WordPress with Varying Vagrant Vagrants or can create a virtual machine with Subversion. In any case you will have to your disposition the system preparation to be able to apply them and to revert them.

NOTE: this example is based on the manual of VPS with SVN of this site.

To find tickets to try

First it will be to find tickets that they have patch pending of being tried. For it we can make a search in the Trac of tickets with [you have-patch].

To unload the patch

First that we will do it is to go to the folder where we have the installation of our WordPress.

CD /webs/wordpress-svn/

Not to roll the configurations, the first time we will create the folder for the changes.

to mkdir /webs/wordpress-svn/patch/

When we have it, we will enter her and we will unload patch that we want to try.

CD /webs/wordpress-svn/patch/ wget https://core.trac.wordpress.org/raw-attachment/ticket/47912/47912.diff

In order to know direction URL that there are to unload, we will visit a ticket of the Trac and in the zone of attached files we will look at the URL that has the file. As much files can be unloaded .diff as files .patch.

To prove patch of the Trac de WordPress

To apply the patch

Now that already we have unloaded the file, there are it to apply to the present configuration of the WordPress of development. For it we will return to the folder root of the configuration and there we will execute the patch.

CD /webs/wordpress-svn/ patch - p 0 < patch/47912.diff

This will give back a message to us that will tell us what files or changes have taken place. It would have to be something similar to the following thing:

user@wordpress-svn: /webs/wordpress-svn# patch - p 0 < patch/47912.diff patching cases out src/wp-includes/formatting.php Hunk #1 succeeded AT 2273 (offset 3 lines). patching cases out tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php

The normal thing would be to prove the error previously to apply the patch, to apply it, and later to return to execute the same to verify that the system works.

If tests the change, whether works as if it does not do it, he is very recommendable to comment it in the commentaries of the ticket of the Trac.

IMPORTANT: If the patch does not work, it is necessary to return to the ticket of the Trac and to add one keyword that says [needs-refresh] so that the person or responsible people applies an update on the basis of the last code available. Sometimes there is very old code thought twig already obsolete versions and is necessary to update it to the present versions.

To retire all the applied changes

If we have made changes and applied several patches, perhaps we think that it is good idea to revert the changes for future tests. For it we will execute the commando who will do it to us.

CD /webs/wordpress-svn/ svn revert. - R && svn update