public static function Project::getInstance

8.0.x Project.php public static Project::getInstance(array $request, $cache_duration = ReleaseInfo::CACHE_LIFETIME)
7.x Project.php public static Project::getInstance(array $request, $cache_duration = ReleaseInfo::CACHE_LIFETIME)
master Project.php public static Project::getInstance(array $request, $cache_duration = ReleaseInfo::CACHE_LIFETIME)

Downloads release info xml from update service.

Parameters

array $request: A request array.

int $cache_duration: Cache lifetime.

Return value

\Drush\UpdateService\Project

1 call to Project::getInstance()
ReleaseInfo::get in lib/Drush/UpdateService/ReleaseInfo.php
Returns a project's release info from the update service.

File

lib/Drush/UpdateService/Project.php, line 69

Namespace

Drush\UpdateService

Class

Project
Representation of a project's release info from the update service.

Code

public static function getInstance(array $request, $cache_duration = ReleaseInfo::CACHE_LIFETIME) {
  $url = self::buildFetchUrl($request);
  drush_log(dt('Downloading release history from !url', array('!url' => $url)));

  $path = drush_download_file($url, drush_tempnam($request['name']), $cache_duration);
  $xml = simplexml_load_file($path);
  if (!$xml) {
    $error = dt('Failed to get available update data from !url', array('!url' => $url));
    return drush_set_error('DRUSH_RELEASE_INFO_ERROR', $error);
  }

  return new Project($xml);
}