• I have a number of word press sites and use Git to control the sauce code for them, each site is an independent repo.

    I’ve been looking for a way to register a callback run after every plug-in and core update to commit these changes into the repository. However I have not fund a clear answer on how to do so. It would neet to run:

    git add .
    git commit -a -m ‘auto update info’

    As it is with having to remember to do this manually, I keep clobbering updated systems whenever I commit on my development system and push it to the live server.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Robert – the main problem you’re going to have is firing your git update script.

    Anyhow, the action you’re looking for is automatic_updates_complete The class that’s fired for an automatic update is WP_Automatic_Updater::run() and is located in wp-admin/includes/class-wp-upgrader.php

    I’m not entirely sure how you want to run a server command through PHP but I know you can via exec() or shell_exec()

    Have you considered automated deployments? There are services out there that will push changed code to your server via FTP instead of you having to worry about git hooks.

    I personally use DeployBot because I have my repos pre-hosted on BitBucket, but we use Beanstalk at work daily, which is more of an all-in-one solution.

    Thread Starter Robert Hickman

    (@robert-hickman)

    Thanks, automatic_updates_complete looks like what I was looking for.

    Calling to command line applications from PHP is not difficult, and I already use this for other things, like converting ABC music notation into images, the main problem was the hook.

    I’m running on a VPS and have code in place for managing the git repositories, which has been doing it’s job fine for the past 5 years, in combination with SSH. For me it beats FTP as SSH is more secure, much faster when dealing with many files, and git provides a easy way to roll back if an update breaks something. As of right now, changing this work-flow would be a lot of work with no great benefit.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hook post all core and plugin updates’ is closed to new replies.