Drupal - Get list of available updates

As far as I'm concerned there are three ways you can achieve this:

  1. You can use the Drupal UI /admin/reports/updates
  2. You can use Drush drush ups
  3. You can use a Third Party Service Drupal Status.

I wrote an article that explains how to integrate multiple Drupal website with Drupal Status.


Assuming you need this info programatically, you may be looking for update_calculate_project_data():

Calculates the current update status of all projects on the site.

The results of this function are expensive to compute, especially on sites with lots of modules or themes, since it involves a lot of comparisons and other operations. Therefore, we cache the results into the {cache_update} table using the 'update_project_data' cache ID. However, since this is not the data about available updates fetched from the network, it is ok to invalidate it somewhat quickly. If we keep this data for very long, site administrators are more likely to see incorrect results if they upgrade to a newer version of a module or theme but do not visit certain pages that automatically clear this cache.

The return value is:

An array of installed projects with current update status information.

update_calculate_project_data() requires an argument of all the available/enabled modules.

Running this...

module_load_include('inc', 'update', 'update.report');
$available = update_get_available(TRUE);
$data = update_calculate_project_data($available);

... will leave $data as an array of all available/enabled modules, with their corresponding existing_version, recommended, and latest_version info. If only the modules with updates are necessary, they can be filtered out by comparing those versions.


Did you look here /admin/reports/updates?

Tags:

Updating

7