• Resolved regexaurus

    (@regexaurus)


    Some time ago, I reworked wp-cron, as described here. Basically, I added this to wp-config.php, to disable wp-cron defaults:

    define(‘DISABLE_WP_CRON’, true);

    and set up a job in crontab, that calls wp-cli every 20 minutes, to trigger wp-cron jobs.

    Yesterday, I installed and configured Easy Updates Manager (basic/free). However, updates are not installing automatically as expected. While trying to troubleshoot, I noticed this on the Description tab when clicking the View details link for the Easy Updates Manager plugin.

    Now, I think Easy Updates Manager (basic/free) automatic updates should work with the way I reworked wp-cron. I don’t think I need the webhook feature (highlighted above) for this to work? I would appreciate your input. Thank you!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi,

    Yes, you don’t need the webhook feature in order to get auto-update to work, webhook feature is meant to be an wp-cron.php alternative where in some isolated server settings, ones may can’t access and use cron-job or are unable to change wp-config.php, etc. You said, you added DISABLE_WP_CRON to your wp-config.php file and set a job in crontab that calls WP-CLI every 20 minutes? Do you mean you set something like */20 * * * * /path-to-your-wp-cli-bin/wp cron event run --due-now in the crontab? If yes, then I will let the development team know about this so that they can investigate, meanwhile, how about using wp-cron.php in the crontab instead of wp-cli, have you tried that? so, basically you just need to use wget and add in a crontab like */5 * * * * wget --quiet -O /dev/null https://example.com/wp-cron.php?doing_wp_cron Notice that your cronjob will need to directly access the wp-cron.php file and doing_wp_cron as the argument.

    Thanks
    Anthon

    Thread Starter regexaurus

    (@regexaurus)

    Yes, I had added this job in crontab:

    */20 * * * * cd /home/username/siteroot; wp cron event run –due-now > /dev/null 2>&1

    But automatic updates haven’t been working. I took your suggestion and switched to calling wp-cron.php instead (using curl instead of wget):

    */20 * * * * curl https://www.example.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

    The website is hosted on DreamPress. I was reviewing access.log and happened to notice entries like this:

    [02/Feb/2023:07:00:02 -0800] "GET /wp-cron.php?doing_wp_cron HTTP/1.1" 200 242 "-" "DreamPress wp-cron/1.0"

    These entries appear every 15 minutes. Looking into this, I found this DreamHost/DreamPress Knowledgebase article: Disabling WP-CRON to Improve Overall Site Performance And from that article:

    I’m also seeing access.log entries corresponding to my crontab job for curl / wp-cron.php. But automatic updates are still not working…

    • This reply was modified 2 years, 1 month ago by regexaurus.

    Hi,

    Could you try the Force automatic updates tool on the Advanced tab, click on the Force updates button and see if you can get some of your plugins/themes/translations updated.

    Thanks
    Anthon

    Thread Starter regexaurus

    (@regexaurus)

    I installed WP Crontrol to see if it would show anything possibly useful/helpful. All appears normal as best as I can tell, and a web search seems to suggest MPSUM_Disable_Updates->maybe_auto_update() is specific to Easy Updates Manager.

    Thread Starter regexaurus

    (@regexaurus)

    @anthoniusalfred I did a Force updates as requested, and saw a message, “Force update checks have been initialized”, but as I had before I tried forcing updates, I still have 4 plugins that all indicate, “There is a new version of plugin name available.”

    Hi

    Apologies for the delay as I needed to pass this onto the development team to consult with them about the issue. They say if it’s possible for you to access the file management tool of your website, could you take a look if there’s a file or directory named .git or .svn or .hg or .bzr in the root directory of your website, and in your wp-content directory, and in wp-content/plugins and in wp-content/themes ?

    Thanks
    Anthon

    Thread Starter regexaurus

    (@regexaurus)

    Sorry for my even slower response.
    Yes, there is a .git directory in site root. It appears to be created and used by DreamPress one-click staging, which I enabled for the site some time ago.
    There are no .git, .svn, .hg, or .bzr directories in wp-content, wp-content/plugins, or wp-content/themes.

    Hi,

    Yes, that’s what prevents your plugins from getting auto-updated. By default, Automatic Updater API doesn’t do plugins, themes and translations auto-updating when you have .git, .svn, .gh and/or .bzr folders in your site root because it considers that the filesystem location in which the .git folder is resided is currently managed by a version control system (in your case it’s DreamPress one-click staging), which means any changes including plugins, themes and translations updating should be made in your staging site first and then once you’re happy, you can push the changes to your live site. By the way, the .git folder you’ve seen before, is it in your staging site or live site?

    Thanks
    Anthon

    Thread Starter regexaurus

    (@regexaurus)

    The production site has a .git directory in site root. The staging site has a .git file in site root which contains a single line:

    gitdir: /path/to/subdirectory/of/.git/on/production/site

    Hi,

    Thanks for giving us the information, I’ve passed it onto the development team so that they can have a discussion on how to handle this issue in future releases of EUM. In the meantime, since your staging site has the .git folder in the site root, there’s a WP filter named automatic_updates_is_vcs_checkout that you can use to bypass the VCS check. The below code snippet can be added into a new PHP file which then be placed in your wp-content/mu-plugins directory. Also, you might want to create a file named .gitignore in your site root and in that file add a new line that points to full path of the mu-plugin file you created, so that when pushing your changes from the staging to the production site, the mu-plugin file will be ignored.

    add_filter('automatic_updates_is_vcs_checkout', '__return_false', 11);

    The code will let automatic updates run even if your site is managed by a version control system, but we don’t recommend for the code to be used in your production site.

    Thanks
    Anthon

    Thread Starter regexaurus

    (@regexaurus)

    Thank you much. Very helpful! ??

    • This reply was modified 2 years, 1 month ago by regexaurus.
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Do I need premium to call wp-cron from cron / crontab?’ is closed to new replies.