Support » Plugins » Hacks » Detect begin and end of an automatic update

  • I’m developing a plugin that manage filesystem’s write permission (it’s called AutoCHMOD). The problem is that when the protection is enabled no one can write on the disk (you can choose some directory to remain writeable, obviously) so automatic updates won’t run. My idea was to detect the very beginning of the update, re-enable writings, let the update run and re-disable writings afterward. I’ve searched technical documentation about the update process but I wasn’t able to find it, so I’ve searched through the code and I’ve found the class WP_Automatic_Updater, method run(), that seems to be the core. After some check there is an update_option(), then it try to do the update, then there’s a delete_option().
    My idea was to use actions ‘update_option_auto_updater.lock’ and ‘delete_option_auto_updater.lock’: I thought the first will be called BEFORE write permission check and new version availlability, and the last is called anyway there has been changes or not. The problem is that I’ve installed my plugin in some sites that haven’t been upgraded from 3.8 to 3.8.1 yesterday, and today no one has been upgraded yet. I’ve checked also the homepages to eventually fire the cron event.
    I don’t know how to try further: any suggestion? How can I detect the begin and the end of an automatic update?

  • The topic ‘Detect begin and end of an automatic update’ is closed to new replies.