function update_get_available

Same name and namespace in other branches
  1. 11.x core/modules/update/update.module \update_get_available()
  2. 10 core/modules/update/update.module \update_get_available()
  3. 9 core/modules/update/update.module \update_get_available()
  4. 8.9.x core/modules/update/update.module \update_get_available()
  5. 7.x modules/update/update.module \update_get_available()

Tries to get update information and refreshes it when necessary.

In addition to checking the lifetime, this function also ensures that there are no .info.yml files for installed modules or themes that have a newer modification timestamp than the last time we checked for available update data. If any .info.yml file was modified, it almost certainly means a new version of something was installed. Without fresh available update data, the logic in \Drupal\update\UpdateManagerInterface::calculateProjectData() will be wrong and produce confusing, bogus results.

Parameters

bool $refresh: (optional) Boolean to indicate if this method should refresh automatically if there's no data. Defaults to FALSE.

Return value

array Array of data about available releases, keyed by project shortname.

Deprecated

in drupal:11.5.0 and is removed from drupal:13.0.0. Use \Drupal\update\UpdateManagerInterface::getAvailable() instead.

See also

\Drupal\update\UpdateManagerInterface::refreshUpdateData()

\Drupal\update\UpdateManagerInterface::getProjects()

https://www.drupal.org/node/3592959

File

core/modules/update/update.module, line 54

Code

function update_get_available($refresh = FALSE) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use \\Drupal\\update\\UpdateManagerInterface::getAvailable() instead. See https://www.drupal.org/node/3592959', E_USER_DEPRECATED);
  return \Drupal::service(UpdateManagerInterface::class)->getAvailable($refresh);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.