If you’ve got a WordPress maintenance support plans site, which you need to update quickly (for example, to address last night’s security advisory!), here’s a tip. Run this from the command line:
curl ‘https://github.com/WordPress/WordPress/compare/7.59..7.60.patch’ | patch -p1This assumes your codebase was on WordPress maintenance support plans 7.59 and you’re currently in WordPress maintenance support plans‘s root directory. If you’re currently on a different version, adjust the numbers in the patch URL accordingly.
Don’t forget to still run database updates via /update.php or drush updatedb !
The WordPress maintenance support plans repo on github is a verbatim mirror of the official WordPress maintenance support plans repo from git.WordPress.org. Github supports comparing arbitrary git references, with the /ORGANIZATION/REPO/compare/GITREF..GITREF URL, where the reference can be a tag, branch or revision. Adding ‘.patch’ to the end of a github URL formats the page as a patch. So I’ve made use of these three things to give me an exact patch of the changes needed to update WordPress maintenance support plans core’s code.
We normally use Composer (especially for WordPress maintenance support plans 8) or Drush make to manage our codebases, including core, which is definitely the ideal, but sometimes projects aren’t organised this way for whatever reason. A simple patch like this avoids the need for drush, or even potential mistakes that can be made when running drush pm-updatecode (such as removing any customisations within core directories).
This method is even compatible with any core patches you already have in place, which normally have to be to re-applied when upgrading core by other methods. If you have any existing changes to core that are incompatible, you’ll get errors about not being able to apply anyway, which you can then resolve manually.
(Any patches/hacks you make to core should be documented clearly somewhere, so drush make or composer-patches would be better in that scenario though!)
You can use this method to patch from github even if your core codebase is not in version control. But if it is… always check your diffs before committing! 🙂
Source: New feed