X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrush%2Fdrush%2Flib%2FDrush%2FUpdateService%2FStatusInfoDrupal7.php;fp=vendor%2Fdrush%2Fdrush%2Flib%2FDrush%2FUpdateService%2FStatusInfoDrupal7.php;h=0e6ae6eb46c37e7bbfe79880a7f881da07f7a271;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/drush/drush/lib/Drush/UpdateService/StatusInfoDrupal7.php b/vendor/drush/drush/lib/Drush/UpdateService/StatusInfoDrupal7.php new file mode 100644 index 000000000..0e6ae6eb4 --- /dev/null +++ b/vendor/drush/drush/lib/Drush/UpdateService/StatusInfoDrupal7.php @@ -0,0 +1,109 @@ +update_check_disabled = $conf['update_check_disabled']; + $conf['update_check_disabled'] = $check_disabled; + } + } + + /** + * {@inheritdoc} + */ + function afterGetStatus(&$update_info, $projects, $check_disabled) { + // Restore Drupal settings. + if (!is_null($check_disabled)) { + global $conf; + $conf['update_check_disabled'] = $this->update_check_disabled; + unset($this->update_check_disabled); + } + + // update.module sets a different project type + // for disabled projects. Here we normalize it. + if ($check_disabled) { + foreach ($update_info as $key => $project) { + if (in_array($project['project_type'], array('module-disabled', 'theme-disabled'))) { + $update_info[$key]['project_type'] = substr($project['project_type'], 0, strpos($project['project_type'], '-')); + } + } + } + } + + /** + * Obtains release info for all installed projects via update.module. + * + * @see update_get_available(). + * @see update_manual_status(). + */ + protected function getAvailableReleases() { + // Force to invalidate some caches that are only cleared + // when visiting update status report page. This allow to detect changes in + // .info files. + _update_cache_clear('update_project_data'); + _update_cache_clear('update_project_projects'); + + // From update_get_available(): Iterate all projects and create a fetch task + // for those we have no information or is obsolete. + $available = _update_get_cached_available_releases(); + + module_load_include('inc', 'update', 'update.compare'); + $update_projects = update_get_projects(); + + foreach ($update_projects as $key => $project) { + if (empty($available[$key])) { + update_create_fetch_task($project); + continue; + } + if ($project['info']['_info_file_ctime'] > $available[$key]['last_fetch']) { + $available[$key]['fetch_status'] = UPDATE_FETCH_PENDING; + } + if (empty($available[$key]['releases'])) { + $available[$key]['fetch_status'] = UPDATE_FETCH_PENDING; + } + if (!empty($available[$key]['fetch_status']) && $available[$key]['fetch_status'] == UPDATE_FETCH_PENDING) { + update_create_fetch_task($project); + } + } + + // Set a batch to process all pending tasks. + $batch = array( + 'operations' => array( + array('update_fetch_data_batch', array()), + ), + 'finished' => 'update_fetch_data_finished', + 'file' => drupal_get_path('module', 'update') . '/update.fetch.inc', + ); + batch_set($batch); + drush_backend_batch_process(); + + // Clear any error set by a failed update fetch task. This avoid rollbacks. + drush_clear_error(); + + // Calculate update status data. + $available = _update_get_cached_available_releases(); + return $available; + } +} +