Pergunta

I configured a script to run as part of my cron.daily tasks, and tested the script.

My status report says that the cron was correctly run by the script, so I'm happy that that will happen.

However, I went to the available updates page, and it still says that I last checked 17 hours ago - isn't this part of the cron?

Is there a way I can include this in the automated checks and reporting?

Foi útil?

Solução

Looking at the code of update_cron(), I notice that the function checks for updates if there aren't cached data or if the update interval is past.

function update_cron() {
  $frequency = variable_get('update_check_frequency', 1);
  $interval = 60 * 60 * 24 * $frequency;
  // Cron should check for updates if there is no update data cached or if the
  // configured update interval has elapsed.
  if (!_update_cache_get('update_available_releases') || ((time() - variable_get('update_last_check', 0)) > $interval)) {
    update_refresh();
    _update_cron_notify();
  }
}

By default, updates are checked once per day; if you want Drupal checks for updates twice per day, you can change the value of the "update_check_frequency" variable to 0.5.
As the setting page doesn't allow you to set a value that is lower than 1, you can change the value of that variable with variable_get('update_check_frequency', 0.5). Cron tasks needs to be executed at least twice per day, or the trick doesn't work.
You can also invalidate the cache, and force update.module to check for updates the next time the cron tasks run, by visiting the page that lists all the modules and clicking on the "Save" button; alternatively, you can call update_invalidate_cache().

Licenciado em: CC-BY-SA com atribuição
Não afiliado a drupal.stackexchange
scroll top