Commit 1da68509 authored by Matt Glaman's avatar Matt Glaman

Merge pull request #144 from mglaman/2325349-distro-update-manager

Issue #2325349 by caschbre: Use the new Distribution Update Status Ma…
parents 0cedbc40 95b381e4
......@@ -66,6 +66,7 @@ dependencies[] = commerce_tax_ui
; Install contribs.
dependencies[] = chosen
dependencies[] = crumbs
dependencies[] = distro_update
dependencies[] = module_filter
dependencies[] = image_delta_formatter
dependencies[] = taxonomy_menu
......
......@@ -1255,3 +1255,10 @@ function commerce_kickstart_update_7223() {
function commerce_kickstart_update_7224() {
module_enable(array('admin_views'));
}
/**
* Enable the Distribution Update Status Manager module.
*/
function commerce_kickstart_update_7225() {
module_enable(array('distro_update'));
}
......@@ -148,91 +148,6 @@ function commerce_kickstart_system_info_alter(&$info, $file, $type) {
}
}
/**
* Implements hook_update_projects_alter().
*/
function commerce_kickstart_update_projects_alter(&$projects) {
// Enable update status for the Commerce Kickstart profile.
$modules = system_rebuild_module_data();
// The module object is shared in the request, so we need to clone it here.
$kickstart = clone $modules['commerce_kickstart'];
$kickstart->info['hidden'] = FALSE;
_update_process_info_list($projects, array('commerce_kickstart' => $kickstart), 'module', TRUE);
}
/**
* Implements hook_update_status_alter().
*
* Disable reporting of projects that are in the distribution, but only
* if they have not been updated manually.
*
* Projects with insecure / revoked / unsupported releases are only shown
* after two days, which gives enough time to prepare a new Kickstart release
* which the users can install and solve the problem.
*/
function commerce_kickstart_update_status_alter(&$projects) {
$bad_statuses = array(
UPDATE_NOT_SECURE,
UPDATE_REVOKED,
UPDATE_NOT_SUPPORTED,
);
$make_filepath = drupal_get_path('module', 'commerce_kickstart') . '/drupal-org.make';
if (!file_exists($make_filepath)) {
return;
}
$make_info = drupal_parse_info_file($make_filepath);
foreach ($projects as $project_name => $project_info) {
// Never unset the drupal project to avoid hitting an error with
// _update_requirement_check(). See http://drupal.org/node/1875386.
if ($project_name == 'drupal' || !isset($project_info['releases']) || !isset($project_info['recommended'])) {
continue;
}
// Hide Kickstart projects, they have no update status of their own.
if (strpos($project_name, 'commerce_kickstart_') !== FALSE) {
unset($projects[$project_name]);
}
// Hide bad releases (insecure, revoked, unsupported) if they are younger
// than two days (giving Kickstart time to prepare an update).
elseif (isset($project_info['status']) && in_array($project_info['status'], $bad_statuses)) {
$two_days_ago = strtotime('2 days ago');
if ($project_info['releases'][$project_info['recommended']]['date'] < $two_days_ago) {
unset($projects[$project_name]);
}
}
// Hide projects shipped with Kickstart if they haven't been manually
// updated.
elseif (isset($make_info['projects'][$project_name])) {
$version = $make_info['projects'][$project_name]['version'];
if (strpos($version, 'dev') !== FALSE || (DRUPAL_CORE_COMPATIBILITY . '-' . $version == $project_info['info']['version'])) {
unset($projects[$project_name]);
}
}
}
}
/**
* Implements hook_form_FORM_ID_alter().
*
* Disable the update for Commerce Kickstart.
*/
function commerce_kickstart_form_update_manager_update_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['projects']['#options']) && isset($form['projects']['#options']['commerce_kickstart'])) {
if (count($form['projects']['#options']) > 1) {
unset($form['projects']['#options']['commerce_kickstart']);
}
else {
unset($form['projects']);
// Hide Download button if there's no other (disabled) projects to update.
if (!isset($form['disabled_projects'])) {
$form['actions']['#access'] = FALSE;
}
$form['message']['#markup'] = t('All of your projects are up to date.');
}
}
}
/**
* Provides a list of Crumbs plugins and their weights.
*/
......
......@@ -143,6 +143,7 @@ projects[chosen][download][type] = git
projects[chosen][download][revision] = e7a0d22
projects[chosen][download][branch] = 7.x-2.x
projects[admin_views][version] = 1.5
projects[distro_update][version] = 1.0-beta4
; Internationalization
projects[variable][version] = 2.5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment