Commit f54e75f5 authored by anton.shloma's avatar anton.shloma

remvove update module

parent 1aef7dc3
...@@ -877,21 +877,9 @@ function system_requirements($phase) { ...@@ -877,21 +877,9 @@ function system_requirements($phase) {
if ($phase == 'runtime') { if ($phase == 'runtime') {
// Check for update status module. // Check for update status module.
if (!\Drupal::moduleHandler()->moduleExists('update')) {
$requirements['update status'] = [
'value' => t('Not enabled'),
'severity' => REQUIREMENT_WARNING,
'description' => t('Update notifications are not enabled. It is <strong>highly recommended</strong> that you enable the Update Manager module from the <a href=":module">module administration page</a> in order to stay up-to-date on new releases. For more information, <a href=":update">Update status handbook page</a>.', [
':update' => 'https://www.drupal.org/documentation/modules/update',
':module' => \Drupal::url('system.modules_list'),
]),
];
}
else {
$requirements['update status'] = [ $requirements['update status'] = [
'value' => t('Enabled'), 'value' => t('Enabled'),
]; ];
}
$requirements['update status']['title'] = t('Update notifications'); $requirements['update status']['title'] = t('Update notifications');
if (Settings::get('rebuild_access')) { if (Settings::get('rebuild_access')) {
......
/**
* @file
* Styles used by the Update Manager module.
*/
.project-update__title {
font-weight: bold;
font-size: 110%;
}
.project-update__status {
float: right; /* LTR */
font-size: 110%;
}
[dir="rtl"] .project-update__status {
float: left;
}
.project-update__status--not-supported {
float: left; /* LTR */
}
[dir="rtl"] .project-update__status--not-supported {
float: right;
}
.project-update__status--security-error {
font-weight: bold;
color: #970f00;
}
.project-update__status-icon {
padding-left: 0.5em; /* LTR */
}
[dir="rtl"] .project-update__status-icon {
padding-left: 0;
padding-right: 0.5em;
}
.project-update__details {
padding: 1em 1em 0.25em 1em;
}
.project-update__version {
padding: 1em 0;
}
.project-update__version-date {
white-space: nowrap;
}
.project-update__version-details {
padding-right: 0.5em; /* LTR */
}
[dir="rtl"] .project-update__version-details {
padding-left: 0.5em;
direction: ltr; /* Version numbers should always be LTR. */
}
.project-update__version-links {
text-align: right; /* LTR */
padding-right: 1em; /* LTR */
list-style-type: none;
}
[dir="rtl"] .project-update__version-links {
text-align: left;
padding-left: 1em;
}
.project-update__version--recommended-strong .project-update__version-title {
font-weight: bold;
}
id: update_settings
label: Update configuration
migration_tags:
- Drupal 6
- Drupal 7
- Configuration
source:
plugin: variable
variables:
- update_max_fetch_attempts
- update_fetch_url
- update_notification_threshold
- update_notify_emails
- update_check_frequency
source_module: update
process:
'fetch/max_attempts': update_max_fetch_attempts
'fetch/url': update_fetch_url
'notification/threshold': update_notification_threshold
'notification/emails': update_notify_emails
'check/interval_days': update_check_frequency
destination:
plugin: config
config_name: update.settings
<?php
namespace Drupal\update\Access;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Routing\Access\AccessInterface;
use Drupal\Core\Site\Settings;
/**
* Determines whether allow authorized operations is set.
*/
class UpdateManagerAccessCheck implements AccessInterface {
/**
* Settings Service.
*
* @var \Drupal\Core\Site\Settings
*/
protected $settings;
/**
* Constructs a UpdateManagerAccessCheck object.
*
* @param \Drupal\Core\Site\Settings $settings
* The read-only settings container.
*/
public function __construct(Settings $settings) {
$this->settings = $settings;
}
/**
* Checks access.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public function access() {
// Uncacheable because the access result depends on a Settings key-value
// pair, and can therefore change at any time.
return AccessResult::allowedIf($this->settings->get('allow_authorize_operations', TRUE))->setCacheMaxAge(0);
}
}
<?php
namespace Drupal\update\Controller;
use Drupal\update\UpdateManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Controller\ControllerBase;
/**
* Controller routines for update routes.
*/
class UpdateController extends ControllerBase {
/**
* Update manager service.
*
* @var \Drupal\update\UpdateManagerInterface
*/
protected $updateManager;
/**
* Constructs update status data.
*
* @param \Drupal\update\UpdateManagerInterface $update_manager
* Update Manager Service.
*/
public function __construct(UpdateManagerInterface $update_manager) {
$this->updateManager = $update_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('update.manager')
);
}
/**
* Returns a page about the update status of projects.
*
* @return array
* A build array with the update status of projects.
*/
public function updateStatus() {
$build = [
'#theme' => 'update_report',
];
if ($available = update_get_available(TRUE)) {
$this->moduleHandler()->loadInclude('update', 'compare.inc');
$build['#data'] = update_calculate_project_data($available);
}
return $build;
}
/**
* Manually checks the update status without the use of cron.
*/
public function updateStatusManually() {
$this->updateManager->refreshUpdateData();
$batch = [
'operations' => [
[[$this->updateManager, 'fetchDataBatch'], []],
],
'finished' => 'update_fetch_data_finished',
'title' => t('Checking available update data'),
'progress_message' => t('Trying to check available update data ...'),
'error_message' => t('Error checking available update data.'),
];
batch_set($batch);
return batch_process('admin/reports/updates');
}
}
<?php
namespace Drupal\update\Form;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\FileTransfer\Local;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Updater\Updater;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
/**
* Configure update settings for this site.
*
* @internal
*/
class UpdateManagerInstall extends FormBase {
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* The root location under which installed projects will be saved.
*
* @var string
*/
protected $root;
/**
* The site path.
*
* @var string
*/
protected $sitePath;
/**
* Constructs a new UpdateManagerInstall.
*
* @param string $root
* The root location under which installed projects will be saved.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param string $site_path
* The site path.
*/
public function __construct($root, ModuleHandlerInterface $module_handler, $site_path) {
$this->root = $root;
$this->moduleHandler = $module_handler;
$this->sitePath = $site_path;
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'update_manager_install_form';
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('update.root'),
$container->get('module_handler'),
$container->get('site.path')
);
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$this->moduleHandler->loadInclude('update', 'inc', 'update.manager');
if (!_update_manager_check_backends($form, 'install')) {
return $form;
}
$form['help_text'] = [
'#prefix' => '<p>',
'#markup' => $this->t('You can find <a href=":module_url">modules</a> and <a href=":theme_url">themes</a> on <a href=":drupal_org_url">drupal.org</a>. The following file extensions are supported: %extensions.', [
':module_url' => 'https://www.drupal.org/project/modules',
':theme_url' => 'https://www.drupal.org/project/themes',
':drupal_org_url' => 'https://www.drupal.org',
'%extensions' => archiver_get_extensions(),
]),
'#suffix' => '</p>',
];
$form['project_url'] = [
'#type' => 'url',
'#title' => $this->t('Install from a URL'),
'#description' => $this->t('For example: %url', ['%url' => 'https://ftp.drupal.org/files/projects/name.tar.gz']),
];
$form['information'] = [
'#prefix' => '<strong>',
'#markup' => $this->t('Or'),
'#suffix' => '</strong>',
];
$form['project_upload'] = [
'#type' => 'file',
'#title' => $this->t('Upload a module or theme archive to install'),
'#description' => $this->t('For example: %filename from your local computer', ['%filename' => 'name.tar.gz']),
];
$form['actions'] = ['#type' => 'actions'];
$form['actions']['submit'] = [
'#type' => 'submit',
'#button_type' => 'primary',
'#value' => $this->t('Install'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$all_files = $this->getRequest()->files->get('files', []);
if (!($form_state->getValue('project_url') xor !empty($all_files['project_upload']))) {
$form_state->setErrorByName('project_url', $this->t('You must either provide a URL or upload an archive file to install.'));
}
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$local_cache = NULL;
$all_files = $this->getRequest()->files->get('files', []);
if ($form_state->getValue('project_url')) {
$local_cache = update_manager_file_get($form_state->getValue('project_url'));
if (!$local_cache) {
$this->messenger()->addError($this->t('Unable to retrieve Drupal project from %url.', ['%url' => $form_state->getValue('project_url')]));
return;
}
}
elseif (!empty($all_files['project_upload'])) {
$validators = ['file_validate_extensions' => [archiver_get_extensions()]];
if (!($finfo = file_save_upload('project_upload', $validators, NULL, 0, FILE_EXISTS_REPLACE))) {
// Failed to upload the file. file_save_upload() calls
// \Drupal\Core\Messenger\MessengerInterface::addError() on failure.
return;
}
$local_cache = $finfo->getFileUri();
}
$directory = _update_manager_extract_directory();
try {
$archive = update_manager_archive_extract($local_cache, $directory);
}
catch (\Exception $e) {
$this->messenger()->addError($e->getMessage());
return;
}
$files = $archive->listContents();
if (!$files) {
$this->messenger()->addError($this->t('Provided archive contains no files.'));
return;
}
// Unfortunately, we can only use the directory name to determine the
// project name. Some archivers list the first file as the directory (i.e.,
// MODULE/) and others list an actual file (i.e., MODULE/README.TXT).
$project = strtok($files[0], '/\\');
$archive_errors = $this->moduleHandler->invokeAll('verify_update_archive', [$project, $local_cache, $directory]);
if (!empty($archive_errors)) {
$this->messenger()->addError(array_shift($archive_errors));
// @todo: Fix me in D8: We need a way to set multiple errors on the same
// form element and have all of them appear!
if (!empty($archive_errors)) {
foreach ($archive_errors as $error) {
$this->messenger()->addError($error);
}
}
return;
}
// Make sure the Updater registry is loaded.
drupal_get_updaters();
$project_location = $directory . '/' . $project;
try {
$updater = Updater::factory($project_location, $this->root);
}
catch (\Exception $e) {
$this->messenger()->addError($e->getMessage());
return;
}
try {
$project_title = Updater::getProjectTitle($project_location);
}
catch (\Exception $e) {
$this->messenger()->addError($e->getMessage());
return;
}
if (!$project_title) {
$this->messenger()->addError($this->t('Unable to determine %project name.', ['%project' => $project]));
}
if ($updater->isInstalled()) {
$this->messenger()->addError($this->t('%project is already installed.', ['%project' => $project_title]));
return;
}
$project_real_location = \Drupal::service('file_system')->realpath($project_location);
$arguments = [
'project' => $project,
'updater_name' => get_class($updater),
'local_url' => $project_real_location,
];
// This process is inherently difficult to test therefore use a state flag.
$test_authorize = FALSE;
if (drupal_valid_test_ua()) {
$test_authorize = \Drupal::state()->get('test_uploaders_via_prompt', FALSE);
}
// If the owner of the directory we extracted is the same as the owner of
// our configuration directory (e.g. sites/default) where we're trying to
// install the code, there's no need to prompt for FTP/SSH credentials.
// Instead, we instantiate a Drupal\Core\FileTransfer\Local and invoke
// update_authorize_run_install() directly.
if (fileowner($project_real_location) == fileowner($this->sitePath) && !$test_authorize) {
$this->moduleHandler->loadInclude('update', 'inc', 'update.authorize');
$filetransfer = new Local($this->root);
$response = call_user_func_array('update_authorize_run_install', array_merge([$filetransfer], $arguments));
if ($response instanceof Response) {
$form_state->setResponse($response);
}
}
// Otherwise, go through the regular workflow to prompt for FTP/SSH
// credentials and invoke update_authorize_run_install() indirectly with
// whatever FileTransfer object authorize.php creates for us.
else {
// The page title must be passed here to ensure it is initially used when
// authorize.php loads for the first time with the FTP/SSH credentials
// form.
system_authorized_init('update_authorize_run_install', __DIR__ . '/../../update.authorize.inc', $arguments, $this->t('Update manager'));
$form_state->setRedirectUrl(system_authorized_get_url());
}
}
}
<?php
namespace Drupal\update\Form;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\State\StateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Configure update settings for this site.
*
* @internal
*/
class UpdateManagerUpdate extends FormBase {
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* The Drupal state storage service.
*
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* Constructs a new UpdateManagerUpdate object.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\State\StateInterface $state
* The state service.
*/
public function __construct(ModuleHandlerInterface $module_handler, StateInterface $state) {
$this->moduleHandler = $module_handler;
$this->state = $state;
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'update_manager_update_form';
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('module_handler'),
$container->get('state')
);
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$this->moduleHandler->loadInclude('update', 'inc', 'update.manager');
$last_markup = [
'#theme' => 'update_last_check',
'#last' => $this->state->get('update.last_check') ?: 0,
];
$form['last_check'] = [
'#markup' => \Drupal::service('renderer')->render($last_markup),
];
if (!_update_manager_check_backends($form, 'update')) {
return $form;
}
$available = update_get_available(TRUE);
if (empty($available)) {
$form['message'] = [
'#markup' => $this->t('There was a problem getting update information. Try again later.'),
];
return $form;
}
$form['#attached']['library'][] = 'update/drupal.update.admin';
// This will be a nested array. The first key is the kind of project, which
// can be either 'enabled', 'disabled', 'manual' (projects which require
// manual updates, such as core). Then, each subarray is an array of
// projects of that type, indexed by project short name, and containing an
// array of data for cells in that project's row in the appropriate table.
$projects = [];
// This stores the actual download link we're going to update from for each
// project in the form, regardless of if it's enabled or disabled.
$form['project_downloads'] = ['#tree' => TRUE];
$this->moduleHandler->loadInclude('update', 'inc', 'update.compare');
$project_data = update_calculate_project_data($available);
foreach ($project_data as $name => $project) {
// Filter out projects which are up to date already.
if ($project['status'] == UPDATE_CURRENT) {
continue;
}
// The project name to display can vary based on the info we have.
if (!empty($project['title'])) {
if (!empty($project['link'])) {
$project_name = $this->l($project['title'], Url::fromUri($project['link']));
}
else {
$project_name = $project['title'];
}
}
elseif (!empty($project['info']['name'])) {
$project_name = $project['info']['name'];
}
else {
$project_name = $name;
}
if ($project['project_type'] == 'theme' || $project['project_type'] == 'theme-disabled') {
$project_name .= ' ' . $this->t('(Theme)');
}
if (empty($project['recommended'])) {
// If we don't know what to recommend they upgrade to, we should skip
// the project entirely.
continue;
}
$recommended_release = $project['releases'][$project['recommended']];
$recommended_version = '{{ release_version }} (<a href="{{ release_link }}" title="{{ project_title }}">{{ release_notes }}</a>)';
if ($recommended_release['version_major'] != $project['existing_major']) {
$recommended_version .= '<div title="{{ major_update_warning_title }}" class="update-major-version-warning">{{ major_update_warning_text }}</div>';
}
$recommended_version = [
'#type' => 'inline_template',
'#template' => $recommended_version,
'#context' => [
'release_version' => $recommended_release['version'],
'release_link' => $recommended_release['release_link'],
'project_title' => $this->t('Release notes for @project_title', ['@project_title' => $project['title']]),
'major_update_warning_title' => $this->t('Major upgrade warning'),
'major_update_warning_text' => $this->t('This update is a major version update which means that it may not be backwards compatible with your currently running version. It is recommended that you read the release notes and proceed at your own risk.'),
'release_notes' => $this->t('Release notes'),
],
];
// Create an entry for this project.
$entry = [
'title' => $project_name,
'installed_version' => $project['existing_version'],
'recommended_version' => ['data' => $recommended_version],
];
switch ($project['status']) {
case UPDATE_NOT_SECURE:
case UPDATE_REVOKED:
$entry['title'] .= ' ' . $this->t('(Security update)');
$entry['#weight'] = -2;
$type = 'security';
break;
case UPDATE_NOT_SUPPORTED:
$type = 'unsupported';
$entry['title'] .= ' ' . $this->t('(Unsupported)');
$entry['#weight'] = -1;
break;
case UPDATE_UNKNOWN:
case UPDATE_NOT_FETCHED:
case UPDATE_NOT_CHECKED:
case UPDATE_NOT_CURRENT:
$type = 'recommended';
break;
default:
// Jump out of the switch and onto the next project in foreach.
continue 2;
}
// Use the project title for the tableselect checkboxes.
$entry['title'] = [
'data' => [
'#title' => $entry['title'],
'#markup' => $entry['title'],
],
];
$entry['#attributes'] = ['class' => ['update-' . $type]];
// Drupal core needs to be upgraded manually.
$needs_manual = $project['project_type'] == 'core';
if ($needs_manual) {
// There are no checkboxes in the 'Manual updates' table so it will be
// rendered by '#theme' => 'table', not '#theme' => 'tableselect'. Since
// the data formats are incompatible, we convert now to the format
// expected by '#theme' => 'table'.
unset($entry['#weight']);
$attributes = $entry['#attributes'];
unset($entry['#attributes']);
$entry = [
'data' => $entry,
] + $attributes;
}
else {
$form['project_downloads'][$name] = [
'#type' => 'value',
'#value' => $recommended_release['download_link'],
];
}
// Based on what kind of project this is, save the entry into the
// appropriate subarray.
switch ($project['project_type']) {
case 'core':
// Core needs manual updates at this time.
$projects['manual'][$name] = $entry;
break;
case 'module':
case 'theme':
$projects['enabled'][$name] = $entry;
break;
case 'module-disabled':
case 'theme-disabled':
$projects['disabled'][$name] = $entry;
break;
}
}
if (empty($projects)) {
$form['message'] = [
'#markup' => $this->t('All of your projects are up to date.'),
];
return $form;
}
$headers = [
'title' => [
'data' => $this->t('Name'),
'class' => ['update-project-name'],
],
'installed_version' => $this->t('Installed version'),
'recommended_version' => $this->t('Recommended version'),
];
if (!empty($projects['enabled'])) {
$form['projects'] = [
'#type' => 'tableselect',
'#header' => $headers,
'#options' => $projects['enabled'],
];
if (!empty($projects['disabled'])) {
$form['projects']['#prefix'] = '<h2>' . $this->t('Enabled') . '</h2>';
}
}
if (!empty($projects['disabled'])) {
$form['disabled_projects'] = [
'#type' => 'tableselect',
'#header' => $headers,
'#options' => $projects['disabled'],
'#weight' => 1,
'#prefix' => '<h2>' . $this->t('Disabled') . '</h2>',
];
}
// If either table has been printed yet, we need a submit button and to
// validate the checkboxes.
if (!empty($projects['enabled']) || !empty($projects['disabled'])) {
$form['actions'] = ['#type' => 'actions'];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Download these updates'),
];
}
if (!empty($projects['manual'])) {
$prefix = '<h2>' . $this->t('Manual updates required') . '</h2>';
$prefix .= '<p>' . $this->t('Automatic updates of Drupal core are not supported at this time.') . '</p>';
$form['manual_updates'] = [
'#type' => 'table',
'#header' => $headers,
'#rows' => $projects['manual'],
'#prefix' => $prefix,
'#weight' => 120,
];
}
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
if (!$form_state->isValueEmpty('projects')) {
$enabled = array_filter($form_state->getValue('projects'));
}
if (!$form_state->isValueEmpty('disabled_projects')) {
$disabled = array_filter($form_state->getValue('disabled_projects'));
}
if (empty($enabled) && empty($disabled)) {
$form_state->setErrorByName('projects', $this->t('You must select at least one project to update.'));
}
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->moduleHandler->loadInclude('update', 'inc', 'update.manager');
$projects = [];
foreach (['projects', 'disabled_projects'] as $type) {
if (!$form_state->isValueEmpty($type)) {
$projects = array_merge($projects, array_keys(array_filter($form_state->getValue($type))));
}
}
$operations = [];
foreach ($projects as $project) {
$operations[] = [
'update_manager_batch_project_get',
[
$project,
$form_state->getValue(['project_downloads', $project]),
],
];
}
$batch = [
'title' => $this->t('Downloading updates'),
'init_message' => $this->t('Preparing to download selected updates'),
'operations' => $operations,
'finished' => 'update_manager_download_batch_finished',
'file' => drupal_get_path('module', 'update') . '/update.manager.inc',
];
batch_set($batch);
}
}
<?php
namespace Drupal\update\Form;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\FileTransfer\Local;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\State\StateInterface;
use Drupal\Core\Updater\Updater;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
/**
* Configure update settings for this site.
*
* @internal
*/
class UpdateReady extends FormBase {
/**
* The root location under which updated projects will be saved.
*
* @var string
*/
protected $root;
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* The state key value store.
*
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* The Site path.
*
* @var string
*/
protected $sitePath;
/**
* Constructs a new UpdateReady object.
*
* @param string $root
* The root location under which updated projects will be saved.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The object that manages enabled modules in a Drupal installation.
* @param \Drupal\Core\State\StateInterface $state
* The state key value store.
* @param string $site_path
* The site path.
*/
public function __construct($root, ModuleHandlerInterface $module_handler, StateInterface $state, $site_path) {
$this->root = $root;
$this->moduleHandler = $module_handler;
$this->state = $state;
$this->sitePath = $site_path;
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'update_manager_update_ready_form';
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('update.root'),
$container->get('module_handler'),
$container->get('state'),
$container->get('site.path')
);
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$this->moduleHandler->loadInclude('update', 'inc', 'update.manager');
if (!_update_manager_check_backends($form, 'update')) {
return $form;
}
$form['backup'] = [
'#prefix' => '<strong>',
'#markup' => $this->t('Back up your database and site before you continue. <a href=":backup_url">Learn how</a>.', [':backup_url' => 'https://www.drupal.org/node/22281']),
'#suffix' => '</strong>',
];
$form['maintenance_mode'] = [
'#title' => $this->t('Perform updates with site in maintenance mode (strongly recommended)'),
'#type' => 'checkbox',
'#default_value' => TRUE,
];
$form['actions'] = ['#type' => 'actions'];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Continue'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// Store maintenance_mode setting so we can restore it when done.
$_SESSION['maintenance_mode'] = $this->state->get('system.maintenance_mode');
if ($form_state->getValue('maintenance_mode') == TRUE) {
$this->state->set('system.maintenance_mode', TRUE);
}
if (!empty($_SESSION['update_manager_update_projects'])) {
// Make sure the Updater registry is loaded.
drupal_get_updaters();
$updates = [];
$directory = _update_manager_extract_directory();
$projects = $_SESSION['update_manager_update_projects'];
unset($_SESSION['update_manager_update_projects']);
$project_real_location = NULL;
foreach ($projects as $project => $url) {
$project_location = $directory . '/' . $project;
$updater = Updater::factory($project_location, $this->root);
$project_real_location = \Drupal::service('file_system')->realpath($project_location);
$updates[] = [
'project' => $project,
'updater_name' => get_class($updater),
'local_url' => $project_real_location,
];
}
// If the owner of the last directory we extracted is the same as the
// owner of our configuration directory (e.g. sites/default) where we're
// trying to install the code, there's no need to prompt for FTP/SSH
// credentials. Instead, we instantiate a Drupal\Core\FileTransfer\Local
// and invoke update_authorize_run_update() directly.
if (fileowner($project_real_location) == fileowner($this->sitePath)) {
$this->moduleHandler->loadInclude('update', 'inc', 'update.authorize');
$filetransfer = new Local($this->root);
$response = update_authorize_run_update($filetransfer, $updates);
if ($response instanceof Response) {
$form_state->setResponse($response);
}
}
// Otherwise, go through the regular workflow to prompt for FTP/SSH
// credentials and invoke update_authorize_run_update() indirectly with
// whatever FileTransfer object authorize.php creates for us.
else {
// The page title must be passed here to ensure it is initially used
// when authorize.php loads for the first time with the FTP/SSH
// credentials form.
system_authorized_init('update_authorize_run_update', __DIR__ . '/../../update.authorize.inc', [$updates], $this->t('Update manager'));
$form_state->setRedirectUrl(system_authorized_get_url());
}
}
}
}
<?php
namespace Drupal\update\Tests;
@trigger_error(__NAMESPACE__ . '\UpdateTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\update\Functional\UpdateTestBase', E_USER_DEPRECATED);
use Drupal\Core\DrupalKernel;
use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
/**
* Defines some shared functions used by all update tests.
*
* The overarching methodology of these tests is we need to compare a given
* state of installed modules and themes (e.g., version, project grouping,
* timestamps, etc) against a current state of what the release history XML
* files we fetch say is available. We have dummy XML files (in the
* core/modules/update/tests directory) that describe various scenarios of
* what's available for different test projects, and we have dummy .info file
* data (specified via hook_system_info_alter() in the update_test helper
* module) describing what's currently installed. Each test case defines a set
* of projects to install, their current state (via the
* 'update_test_system_info' variable) and the desired available update data
* (via the 'update_test_xml_map' variable), and then performs a series of
* assertions that the report matches our expectations given the specific
* initial state and availability scenario.
*
* @deprecated Scheduled for removal in Drupal 9.0.0.
* Use \Drupal\Tests\update\Functional\UpdateTestBase instead.
*/
abstract class UpdateTestBase extends WebTestBase {
protected function setUp() {
parent::setUp();
// Change the root path which Update Manager uses to install and update
// projects to be inside the testing site directory. See
// \Drupal\update\UpdateRootFactory::get() for equivalent changes to the
// test child site.
$request = \Drupal::request();
$update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request);
$this->container->set('update.root', $update_root);
\Drupal::setContainer($this->container);
// Create the directories within the root path within which the Update
// Manager will install projects.
foreach (drupal_get_updaters() as $updater_info) {
$updater = $updater_info['class'];
$install_directory = $update_root . '/' . $updater::getRootDirectoryRelativePath();
if (!is_dir($install_directory)) {
mkdir($install_directory);
}
}
}
/**
* Refreshes the update status based on the desired available update scenario.
*
* @param $xml_map
* Array that maps project names to availability scenarios to fetch. The key
* '#all' is used if a project-specific mapping is not defined.
* @param $url
* (optional) A string containing the URL to fetch update data from.
* Defaults to 'update-test'.
*
* @see \Drupal\update_test\Controller\UpdateTestController::updateTest()
*/
protected function refreshUpdateStatus($xml_map, $url = 'update-test') {
// Tell the Update Manager module to fetch from the URL provided by
// update_test module.
$this->config('update.settings')->set('fetch.url', Url::fromUri('base:' . $url, ['absolute' => TRUE])->toString())->save();
// Save the map for UpdateTestController::updateTest() to use.
$this->config('update_test.settings')->set('xml_map', $xml_map)->save();
// Manually check the update status.
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Check manually'));
}
/**
* Runs a series of assertions that are applicable to all update statuses.
*/
protected function standardTests() {
$this->assertRaw('<h3>' . t('Drupal core') . '</h3>');
$this->assertRaw(\Drupal::l(t('Drupal'), Url::fromUri('http://example.com/project/drupal')), 'Link to the Drupal project appears.');
$this->assertNoText(t('No available releases found'));
}
}
<?php
namespace Drupal\update;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\RequestException;
/**
* Fetches project information from remote locations.
*/
class UpdateFetcher implements UpdateFetcherInterface {
use DependencySerializationTrait;
/**
* URL to check for updates, if a given project doesn't define its own.
*/
const UPDATE_DEFAULT_URL = 'http://updates.drupal.org/release-history';
/**
* The fetch url configured in the update settings.
*
* @var string
*/
protected $fetchUrl;
/**
* The update settings
*
* @var \Drupal\Core\Config\Config
*/
protected $updateSettings;
/**
* The HTTP client to fetch the feed data with.
*
* @var \GuzzleHttp\ClientInterface
*/
protected $httpClient;
/**
* Constructs a UpdateFetcher.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \GuzzleHttp\ClientInterface $http_client
* A Guzzle client object.
*/
public function __construct(ConfigFactoryInterface $config_factory, ClientInterface $http_client) {
$this->fetchUrl = $config_factory->get('update.settings')->get('fetch.url');
$this->httpClient = $http_client;
$this->updateSettings = $config_factory->get('update.settings');
}
/**
* {@inheritdoc}
*/
public function fetchProjectData(array $project, $site_key = '') {
$url = $this->buildFetchUrl($project, $site_key);
$data = '';
try {
$data = (string) $this->httpClient
->get($url, ['headers' => ['Accept' => 'text/xml']])
->getBody();
}
catch (RequestException $exception) {
watchdog_exception('update', $exception);
}
return $data;
}
/**
* {@inheritdoc}
*/
public function buildFetchUrl(array $project, $site_key = '') {
$name = $project['name'];
$url = $this->getFetchBaseUrl($project);
$url .= '/' . $name . '/' . \Drupal::CORE_COMPATIBILITY;
// Only append usage information if we have a site key and the project is
// enabled. We do not want to record usage statistics for disabled projects.
if (!empty($site_key) && (strpos($project['project_type'], 'disabled') === FALSE)) {
// Append the site key.
$url .= (strpos($url, '?') !== FALSE) ? '&' : '?';
$url .= 'site_key=';
$url .= rawurlencode($site_key);
// Append the version.
if (!empty($project['info']['version'])) {
$url .= '&version=';
$url .= rawurlencode($project['info']['version']);
}
// Append the list of modules or themes enabled.
$list = array_keys($project['includes']);
$url .= '&list=';
$url .= rawurlencode(implode(',', $list));
}
return $url;
}
/**
* {@inheritdoc}
*/
public function getFetchBaseUrl($project) {
if (isset($project['info']['project status url'])) {
$url = $project['info']['project status url'];
}
else {
$url = $this->fetchUrl;
if (empty($url)) {
$url = static::UPDATE_DEFAULT_URL;
}
}
return $url;
}
}
<?php
namespace Drupal\update;
/**
* Fetches project information from remote locations.
*/
interface UpdateFetcherInterface {
/**
* Project's status cannot be checked.
*/
const NOT_CHECKED = -1;
/**
* No available update data was found for project.
*/
const UNKNOWN = -2;
/**
* There was a failure fetching available update data for this project.
*/
const NOT_FETCHED = -3;
/**
* We need to (re)fetch available update data for this project.
*/
const FETCH_PENDING = -4;
/**
* Returns the base of the URL to fetch available update data for a project.
*
* @param array $project
* The array of project information from
* \Drupal\Update\UpdateManager::getProjects().
*
* @return string
* The base of the URL used for fetching available update data. This does
* not include the path elements to specify a particular project, version,
* site_key, etc.
*/
public function getFetchBaseUrl($project);
/**
* Retrieves the project information.
*
* @param array $project
* The array of project information from
* \Drupal\Update\UpdateManager::getProjects().
* @param string $site_key
* (optional) The anonymous site key hash. Defaults to an empty string.
*
* @return string
* The project information fetched as string. Empty string upon failure.
*/
public function fetchProjectData(array $project, $site_key = '');
/**
* Generates the URL to fetch information about project updates.
*
* This figures out the right URL to use, based on the project's .info.yml
* file and the global defaults. Appends optional query arguments when the
* site is configured to report usage stats.
*
* @param array $project
* The array of project information from
* \Drupal\Update\UpdateManager::getProjects().
* @param string $site_key
* (optional) The anonymous site key hash. Defaults to an empty string.
*
* @return string
* The URL for fetching information about updates to the specified project.
*
* @see \Drupal\update\UpdateProcessor::fetchData()
* @see \Drupal\update\UpdateProcessor::processFetchTask()
* @see \Drupal\update\UpdateManager::getProjects()
*/
public function buildFetchUrl(array $project, $site_key = '');
}
<?php
namespace Drupal\update;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Utility\ProjectInfo;
/**
* Default implementation of UpdateManagerInterface.
*/
class UpdateManager implements UpdateManagerInterface {
use DependencySerializationTrait;
use StringTranslationTrait;
/**
* The update settings
*
* @var \Drupal\Core\Config\Config
*/
protected $updateSettings;
/**
* Module Handler Service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Update Processor Service.
*
* @var \Drupal\update\UpdateProcessorInterface
*/
protected $updateProcessor;
/**
* An array of installed and enabled projects.
*
* @var array
*/
protected $projects;
/**
* The key/value store.
*
* @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
*/
protected $keyValueStore;
/**
* Update available releases key/value store.
*
* @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
*/
protected $availableReleasesTempStore;
/**
* The theme handler.
*
* @var \Drupal\Core\Extension\ThemeHandlerInterface
*/
protected $themeHandler;
/**
* Constructs a UpdateManager.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The Module Handler service
* @param \Drupal\update\UpdateProcessorInterface $update_processor
* The Update Processor service.
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation
* The translation service.
* @param \Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value_expirable_factory
* The expirable key/value factory.
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler.
*/
public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, UpdateProcessorInterface $update_processor, TranslationInterface $translation, KeyValueFactoryInterface $key_value_expirable_factory, ThemeHandlerInterface $theme_handler) {
$this->updateSettings = $config_factory->get('update.settings');
$this->moduleHandler = $module_handler;
$this->updateProcessor = $update_processor;
$this->stringTranslation = $translation;
$this->keyValueStore = $key_value_expirable_factory->get('update');
$this->themeHandler = $theme_handler;
$this->availableReleasesTempStore = $key_value_expirable_factory->get('update_available_releases');
$this->projects = [];
}
/**
* {@inheritdoc}
*/
public function refreshUpdateData() {
// Since we're fetching new available update data, we want to clear
// of both the projects we care about, and the current update status of the
// site. We do *not* want to clear the cache of available releases just yet,
// since that data (even if it's stale) can be useful during
// \Drupal\Update\UpdateManager::getProjects(); for example, to modules
// that implement hook_system_info_alter() such as cvs_deploy.
$this->keyValueStore->delete('update_project_projects');
$this->keyValueStore->delete('update_project_data');
$projects = $this->getProjects();
// Now that we have the list of projects, we should also clear the available
// release data, since even if we fail to fetch new data, we need to clear
// out the stale data at this point.
$this->availableReleasesTempStore->deleteAll();
foreach ($projects as $project) {
$this->updateProcessor->createFetchTask($project);
}
}
/**
* {@inheritdoc}
*/
public function getProjects() {
if (empty($this->projects)) {
// Retrieve the projects from storage, if present.
$this->projects = $this->projectStorage('update_project_projects');
if (empty($this->projects)) {
// Still empty, so we have to rebuild.
$module_data = system_rebuild_module_data();
$theme_data = $this->themeHandler->rebuildThemeData();
$project_info = new ProjectInfo();
$project_info->processInfoList($this->projects, $module_data, 'module', TRUE);
$project_info->processInfoList($this->projects, $theme_data, 'theme', TRUE);
if ($this->updateSettings->get('check.disabled_extensions')) {
$project_info->processInfoList($this->projects, $module_data, 'module', FALSE);
$project_info->processInfoList($this->projects, $theme_data, 'theme', FALSE);
}
// Allow other modules to alter projects before fetching and comparing.
$this->moduleHandler->alter('update_projects', $this->projects);
// Store the site's project data for at most 1 hour.
$this->keyValueStore->setWithExpire('update_project_projects', $this->projects, 3600);
}
}
return $this->projects;
}
/**
* {@inheritdoc}
*/
public function projectStorage($key) {
$projects = [];
// On certain paths, we should clear the data and recompute the projects for
// update status of the site to avoid presenting stale information.
$route_names = [
'update.theme_update',
'system.modules_list',
'system.theme_install',
'update.module_update',
'update.module_install',
'update.status',
'update.report_update',
'update.report_install',
'update.settings',
'system.status',
'update.manual_status',
'update.confirmation_page',
'system.themes_page',
];
if (in_array(\Drupal::routeMatch()->getRouteName(), $route_names)) {
$this->keyValueStore->delete($key);
}
else {
$projects = $this->keyValueStore->get($key, []);
}
return $projects;
}
/**
* {@inheritdoc}
*/
public function fetchDataBatch(&$context) {
if (empty($context['sandbox']['max'])) {
$context['finished'] = 0;
$context['sandbox']['max'] = $this->updateProcessor->numberOfQueueItems();
$context['sandbox']['progress'] = 0;
$context['message'] = $this->t('Checking available update data ...');
$context['results']['updated'] = 0;
$context['results']['failures'] = 0;
$context['results']['processed'] = 0;
}
// Grab another item from the fetch queue.
for ($i = 0; $i < 5; $i++) {
if ($item = $this->updateProcessor->claimQueueItem()) {
if ($this->updateProcessor->processFetchTask($item->data)) {
$context['results']['updated']++;
$context['message'] = $this->t('Checked available update data for %title.', ['%title' => $item->data['info']['name']]);
}
else {
$context['message'] = $this->t('Failed to check available update data for %title.', ['%title' => $item->data['info']['name']]);
$context['results']['failures']++;
}
$context['sandbox']['progress']++;
$context['results']['processed']++;
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
$this->updateProcessor->deleteQueueItem($item);
}
else {
// If the queue is currently empty, we're done. It's possible that
// another thread might have added new fetch tasks while we were
// processing this batch. In that case, the usual 'finished' math could
// get confused, since we'd end up processing more tasks that we thought
// we had when we started and initialized 'max' with numberOfItems(). By
// forcing 'finished' to be exactly 1 here, we ensure that batch
// processing is terminated.
$context['finished'] = 1;
return;
}
}
}
}
<?php
namespace Drupal\update;
/**
* Manages project update information.
*/
interface UpdateManagerInterface {
/**
* Project is missing security update(s).
*/
const NOT_SECURE = 1;
/**
* Current release has been unpublished and is no longer available.
*/
const REVOKED = 2;
/**
* Current release is no longer supported by the project maintainer.
*/
const NOT_SUPPORTED = 3;
/**
* Project has a new release available, but it is not a security release.
*/
const NOT_CURRENT = 4;
/**
* Project is up to date.
*/
const CURRENT = 5;
/**
* Fetches an array of installed and enabled projects.
*
* This is only responsible for generating an array of projects (taking into
* account projects that include more than one module or theme). Other
* information like the specific version and install type (official release,
* dev snapshot, etc) is handled later in update_process_project_info() since
* that logic is only required when preparing the status report, not for
* fetching the available release data.
*
* This array is fairly expensive to construct, since it involves a lot of
* disk I/O, so we store the results. However, since this is not the data
* about available updates fetched from the network, it is acceptable 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 data.
*
* @return array
* An associative array of currently enabled projects keyed by the
* machine-readable project short name. Each project contains:
* - name: The machine-readable project short name.
* - info: An array with values from the main .info.yml file for this
* project.
* - name: The human-readable name of the project.
* - package: The package that the project is grouped under.
* - version: The version of the project.
* - project: The Drupal.org project name.
* - datestamp: The date stamp of the project's main .info.yml file.
* - _info_file_ctime: The maximum file change time for all of the
* .info.yml
* files included in this project.
* - datestamp: The date stamp when the project was released, if known.
* - includes: An associative array containing all projects included with
* this project, keyed by the machine-readable short name with the
* human-readable name as value.
* - project_type: The type of project. Allowed values are 'module' and
* 'theme'.
* - project_status: This indicates if the project is enabled and will
* always be TRUE, as the function only returns enabled projects.
*
* @see update_process_project_info()
* @see update_calculate_project_data()
* @see \Drupal\update\UpdateManager::projectStorage()
*/
public function getProjects();
/**
* Processes a step in batch for fetching available update data.
*
* @param array $context
* Reference to an array used for Batch API storage.
*/
public function fetchDataBatch(&$context);
/**
* Clears out all the available update data and initiates re-fetching.
*/
public function refreshUpdateData();
/**
* Retrieves update storage data or empties it.
*
* Two very expensive arrays computed by this module are the list of all
* installed modules and themes (and .info.yml data, project associations,
* etc), and the current status of the site relative to the currently
* available releases. These two arrays are stored and used whenever possible.
* The data is cleared whenever the administrator visits the status report,
* available updates report, or the module or theme administration pages,
* since we should always recompute the most current values on any of those
* pages.
*
* Note: while both of these arrays are expensive to compute (in terms of disk
* I/O and some fairly heavy CPU processing), neither of these is the actual
* data about available updates that we have to fetch over the network from
* updates.drupal.org. That information is stored in the
* 'update_available_releases' collection -- it needs to persist longer than 1
* hour and never get invalidated just by visiting a page on the site.
*
* @param string $key
* The key of data to return. Valid options are 'update_project_data' and
* 'update_project_projects'.
*
* @return array
* The stored value of the $projects array generated by
* update_calculate_project_data() or
* \Drupal\Update\UpdateManager::getProjects(), or an empty array when the
* storage is cleared.
* array when the storage is cleared.
*/
public function projectStorage($key);
}
<?php
namespace Drupal\update;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
use Drupal\Core\State\StateInterface;
use Drupal\Core\PrivateKey;
use Drupal\Core\Queue\QueueFactory;
/**
* Process project update information.
*/
class UpdateProcessor implements UpdateProcessorInterface {
/**
* The update settings
*
* @var \Drupal\Core\Config\Config
*/
protected $updateSettings;
/**
* The UpdateFetcher service.
*
* @var \Drupal\update\UpdateFetcherInterface
*/
protected $updateFetcher;
/**
* The update fetch queue.
*
* @var \Drupal\Core\Queue\QueueInterface
*/
protected $fetchQueue;
/**
* Update key/value store
*
* @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
*/
protected $tempStore;
/**
* Update Fetch Task Store
*
* @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface
*/
protected $fetchTaskStore;
/**
* Update available releases store
*
* @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
*/
protected $availableReleasesTempStore;
/**
* Array of release history URLs that we have failed to fetch
*
* @var array
*/
protected $failed;
/**
* The state service.
*
* @var \Drupal\Core\State\StateInterface
*/
protected $stateStore;
/**
* The private key.
*
* @var \Drupal\Core\PrivateKey
*/
protected $privateKey;
/**
* Constructs a UpdateProcessor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Queue\QueueFactory $queue_factory
* The queue factory
* @param \Drupal\update\UpdateFetcherInterface $update_fetcher
* The update fetcher service
* @param \Drupal\Core\State\StateInterface $state_store
* The state service.
* @param \Drupal\Core\PrivateKey $private_key
* The private key factory service.
* @param \Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value_factory
* The key/value factory.
* @param \Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value_expirable_factory
* The expirable key/value factory.
*/
public function __construct(ConfigFactoryInterface $config_factory, QueueFactory $queue_factory, UpdateFetcherInterface $update_fetcher, StateInterface $state_store, PrivateKey $private_key, KeyValueFactoryInterface $key_value_factory, KeyValueFactoryInterface $key_value_expirable_factory) {
$this->updateFetcher = $update_fetcher;
$this->updateSettings = $config_factory->get('update.settings');
$this->fetchQueue = $queue_factory->get('update_fetch_tasks');
$this->tempStore = $key_value_expirable_factory->get('update');
$this->fetchTaskStore = $key_value_factory->get('update_fetch_task');
$this->availableReleasesTempStore = $key_value_expirable_factory->get('update_available_releases');
$this->stateStore = $state_store;
$this->privateKey = $private_key;
$this->fetchTasks = [];
$this->failed = [];
}
/**
* {@inheritdoc}
*/
public function createFetchTask($project) {
if (empty($this->fetchTasks)) {
$this->fetchTasks = $this->fetchTaskStore->getAll();
}
if (empty($this->fetchTasks[$project['name']])) {
$this->fetchQueue->createItem($project);
$this->fetchTaskStore->set($project['name'], $project);
$this->fetchTasks[$project['name']] = REQUEST_TIME;
}
}
/**
* {@inheritdoc}
*/
public function fetchData() {
$end = time() + $this->updateSettings->get('fetch.timeout');
while (time() < $end && ($item = $this->fetchQueue->claimItem())) {
$this->processFetchTask($item->data);
$this->fetchQueue->deleteItem($item);
}
}
/**
* {@inheritdoc}
*/
public function processFetchTask($project) {
global $base_url;
// This can be in the middle of a long-running batch, so REQUEST_TIME won't
// necessarily be valid.
$request_time_difference = time() - REQUEST_TIME;
if (empty($this->failed)) {
// If we have valid data about release history XML servers that we have
// failed to fetch from on previous attempts, load that.
$this->failed = $this->tempStore->get('fetch_failures');
}
$max_fetch_attempts = $this->updateSettings->get('fetch.max_attempts');
$success = FALSE;
$available = [];
$site_key = Crypt::hmacBase64($base_url, $this->privateKey->get());
$fetch_url_base = $this->updateFetcher->getFetchBaseUrl($project);
$project_name = $project['name'];
if (empty($this->failed[$fetch_url_base]) || $this->failed[$fetch_url_base] < $max_fetch_attempts) {
$data = $this->updateFetcher->fetchProjectData($project, $site_key);
}
if (!empty($data)) {
$available = $this->parseXml($data);
// @todo: Purge release data we don't need. See
// https://www.drupal.org/node/238950.
if (!empty($available)) {
// Only if we fetched and parsed something sane do we return success.
$success = TRUE;
}
}
else {
$available['project_status'] = 'not-fetched';
if (empty($this->failed[$fetch_url_base])) {
$this->failed[$fetch_url_base] = 1;
}
else {
$this->failed[$fetch_url_base]++;
}
}
$frequency = $this->updateSettings->get('check.interval_days');
$available['last_fetch'] = REQUEST_TIME + $request_time_difference;
$this->availableReleasesTempStore->setWithExpire($project_name, $available, $request_time_difference + (60 * 60 * 24 * $frequency));
// Stash the $this->failed data back in the DB for the next 5 minutes.
$this->tempStore->setWithExpire('fetch_failures', $this->failed, $request_time_difference + (60 * 5));
// Whether this worked or not, we did just (try to) check for updates.
$this->stateStore->set('update.last_check', REQUEST_TIME + $request_time_difference);
// Now that we processed the fetch task for this project, clear out the
// record for this task so we're willing to fetch again.
$this->fetchTaskStore->delete($project_name);
return $success;
}
/**
* Parses the XML of the Drupal release history info files.
*
* @param string $raw_xml
* A raw XML string of available release data for a given project.
*
* @return array
* Array of parsed data about releases for a given project, or NULL if there
* was an error parsing the string.
*/
protected function parseXml($raw_xml) {
try {
$xml = new \SimpleXMLElement($raw_xml);
}
catch (\Exception $e) {
// SimpleXMLElement::__construct produces an E_WARNING error message for
// each error found in the XML data and throws an exception if errors
// were detected. Catch any exception and return failure (NULL).
return NULL;
}
// If there is no valid project data, the XML is invalid, so return failure.
if (!isset($xml->short_name)) {
return NULL;
}
$data = [];
foreach ($xml as $k => $v) {
$data[$k] = (string) $v;
}
$data['releases'] = [];
if (isset($xml->releases)) {
foreach ($xml->releases->children() as $release) {
$version = (string) $release->version;
$data['releases'][$version] = [];
foreach ($release->children() as $k => $v) {
$data['releases'][$version][$k] = (string) $v;
}
$data['releases'][$version]['terms'] = [];
if ($release->terms) {
foreach ($release->terms->children() as $term) {
if (!isset($data['releases'][$version]['terms'][(string) $term->name])) {
$data['releases'][$version]['terms'][(string) $term->name] = [];
}
$data['releases'][$version]['terms'][(string) $term->name][] = (string) $term->value;
}
}
}
}
return $data;
}
/**
* {@inheritdoc}
*/
public function numberOfQueueItems() {
return $this->fetchQueue->numberOfItems();
}
/**
* {@inheritdoc}
*/
public function claimQueueItem() {
return $this->fetchQueue->claimItem();
}
/**
* {@inheritdoc}
*/
public function deleteQueueItem($item) {
return $this->fetchQueue->deleteItem($item);
}
}
<?php
namespace Drupal\update;
/**
* Processor of project update information.
*/
interface UpdateProcessorInterface {
/**
* Claims an item in the update fetch queue for processing.
*
* @return bool|\stdClass
* On success we return an item object. If the queue is unable to claim an
* item it returns false.
*
* @see \Drupal\Core\Queue\QueueInterface::claimItem()
*/
public function claimQueueItem();
/**
* Attempts to drain the queue of tasks for release history data to fetch.
*/
public function fetchData();
/**
* Adds a task to the queue for fetching release history data for a project.
*
* We only create a new fetch task if there's no task already in the queue for
* this particular project (based on 'update_fetch_task' key-value
* collection).
*
* @param array $project
* Associative array of information about a project as created by
* \Drupal\Update\UpdateManager::getProjects(), including keys such as
* 'name' (short name), and the 'info' array with data from a .info.yml
* file for the project.
*
* @see \Drupal\update\UpdateManager::getProjects()
* @see update_get_available()
* @see \Drupal\update\UpdateManager::refreshUpdateData()
* @see \Drupal\update\UpdateProcessor::fetchData()
* @see \Drupal\update\UpdateProcessor::processFetchTask()
*/
public function createFetchTask($project);
/**
* Processes a task to fetch available update data for a single project.
*
* Once the release history XML data is downloaded, it is parsed and saved in
* an entry just for that project.
*
* @param array $project
* Associative array of information about the project to fetch data for.
*
* @return bool
* TRUE if we fetched parsable XML, otherwise FALSE.
*/
public function processFetchTask($project);
/**
* Retrieves the number of items in the update fetch queue.
*
* @return int
* An integer estimate of the number of items in the queue.
*
* @see \Drupal\Core\Queue\QueueInterface::numberOfItems()
*/
public function numberOfQueueItems();
/**
* Deletes a finished item from the update fetch queue.
*
* @param \stdClass $item
* The item returned by \Drupal\Core\Queue\QueueInterface::claimItem().
*
* @see \Drupal\Core\Queue\QueueInterface::deleteItem()
*/
public function deleteQueueItem($item);
}
<?php
namespace Drupal\update;
use Drupal\Core\DrupalKernelInterface;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* Gets the root path used by the Update Manager to install or update projects.
*/
class UpdateRootFactory {
/**
* The Drupal kernel.
*
* @var \Drupal\Core\DrupalKernelInterface
*/
protected $drupalKernel;
/**
* The request stack.
*
* @var \Symfony\Component\HttpFoundation\RequestStack
*/
protected $requestStack;
/**
* Constructs an UpdateRootFactory instance.
*
* @param \Drupal\Core\DrupalKernelInterface $drupal_kernel
* The Drupal kernel.
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* The request stack.
*/
public function __construct(DrupalKernelInterface $drupal_kernel, RequestStack $request_stack) {
$this->drupalKernel = $drupal_kernel;
$this->requestStack = $request_stack;
}
/**
* Gets the root path under which projects are installed or updated.
*
* The Update Manager will ensure that project files can only be copied to
* specific subdirectories of this root path.
*
* @return string
*/
public function get() {
// Normally the Update Manager's root path is the same as the app root (the
// directory in which the Drupal site is installed).
$root_path = $this->drupalKernel->getAppRoot();
// When running in a test site, change the root path to be the testing site
// directory. This ensures that it will always be writable by the webserver
// (thereby allowing the actual extraction and installation of projects by
// the Update Manager to be tested) and also ensures that new project files
// added there won't be visible to the parent site and will be properly
// cleaned up once the test finishes running. This is done here (rather
// than having the tests enable a module which overrides the update root
// factory service) to ensure that the parent site is automatically kept
// clean without relying on test authors to take any explicit steps. See
// also \Drupal\update\Tests\UpdateTestBase::setUp().
if (DRUPAL_TEST_IN_CHILD_SITE) {
$kernel = $this->drupalKernel;
$request = $this->requestStack->getCurrentRequest();
$root_path .= '/' . $kernel::findSitePath($request);
}
return $root_path;
}
}
<?php
namespace Drupal\update;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Egulias\EmailValidator\EmailValidator;
/**
* Configure update settings for this site.
*
* @internal
*/
class UpdateSettingsForm extends ConfigFormBase implements ContainerInjectionInterface {
/**
* The email validator.
*
* @var \Egulias\EmailValidator\EmailValidator
*/
protected $emailValidator;
/**
* Constructs a new UpdateSettingsForm.
*
* @param \Egulias\EmailValidator\EmailValidator $email_validator
* The email validator.
*/
public function __construct(EmailValidator $email_validator) {
$this->emailValidator = $email_validator;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('email.validator')
);
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'update_settings';
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return ['update.settings'];
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('update.settings');
$form['update_check_frequency'] = [
'#type' => 'radios',
'#title' => t('Check for updates'),
'#default_value' => $config->get('check.interval_days'),
'#options' => [
'1' => t('Daily'),
'7' => t('Weekly'),
],
'#description' => t('Select how frequently you want to automatically check for new releases of your currently installed modules and themes.'),
];
$form['update_check_disabled'] = [
'#type' => 'checkbox',
'#title' => t('Check for updates of uninstalled modules and themes'),
'#default_value' => $config->get('check.disabled_extensions'),
];
$notification_emails = $config->get('notification.emails');
$form['update_notify_emails'] = [
'#type' => 'textarea',
'#title' => t('Email addresses to notify when updates are available'),
'#rows' => 4,
'#default_value' => implode("\n", $notification_emails),
'#description' => t('Whenever your site checks for available updates and finds new releases, it can notify a list of users via email. Put each address on a separate line. If blank, no emails will be sent.'),
];
$form['update_notification_threshold'] = [
'#type' => 'radios',
'#title' => t('Email notification threshold'),
'#default_value' => $config->get('notification.threshold'),
'#options' => [
'all' => t('All newer versions'),
'security' => t('Only security updates'),
],
'#description' => t('You can choose to send email only if a security update is available, or to be notified about all newer versions. If there are updates available of Drupal core or any of your installed modules and themes, your site will always print a message on the <a href=":status_report">status report</a> page, and will also display an error message on administration pages if there is a security update.', [':status_report' => $this->url('system.status')]),
];
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$form_state->set('notify_emails', []);
if (!$form_state->isValueEmpty('update_notify_emails')) {
$valid = [];
$invalid = [];
foreach (explode("\n", trim($form_state->getValue('update_notify_emails'))) as $email) {
$email = trim($email);
if (!empty($email)) {
if ($this->emailValidator->isValid($email)) {
$valid[] = $email;
}
else {
$invalid[] = $email;
}
}
}
if (empty($invalid)) {
$form_state->set('notify_emails', $valid);
}
elseif (count($invalid) == 1) {
$form_state->setErrorByName('update_notify_emails', $this->t('%email is not a valid email address.', ['%email' => reset($invalid)]));
}
else {
$form_state->setErrorByName('update_notify_emails', $this->t('%emails are not valid email addresses.', ['%emails' => implode(', ', $invalid)]));
}
}
parent::validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->config('update.settings');
// See if the update_check_disabled setting is being changed, and if so,
// invalidate all update status data.
if ($form_state->getValue('update_check_disabled') != $config->get('check.disabled_extensions')) {
update_storage_clear();
}
$config
->set('check.disabled_extensions', $form_state->getValue('update_check_disabled'))
->set('check.interval_days', $form_state->getValue('update_check_frequency'))
->set('notification.emails', $form_state->get('notify_emails'))
->set('notification.threshold', $form_state->getValue('update_notification_threshold'))
->save();
parent::submitForm($form, $form_state);
}
}
{#
/**
* @file
* Default theme implementation for the last time update data was checked.
*
* Available variables:
* - last: The timestamp that the site was last checked for updates.
* - time: The formatted time since the site last checked for updates.
* - link: A link to check for updates manually.
*
* @see template_preprocess_update_last_check()
*
* @ingroup themeable
*/
#}
<p>
{% if last %}
{{ 'Last checked: @time ago'|t({'@time': time}) }}
{% else %}
{{ 'Last checked: never'|t }}
{% endif %}
({{ link }})
</p>
{#
/**
* @file
* Default theme implementation for the project status report.
*
* Available variables:
* - title: The project title.
* - url: The project url.
* - status: The project status.
* - label: The project status label.
* - attributes: HTML attributes for the project status.
* - reason: The reason you should update the project.
* - icon: The project status version indicator icon.
* - existing_version: The version of the installed project.
* - versions: The available versions of the project.
* - install_type: The type of project (e.g., dev).
* - datestamp: The date/time of a project version's release.
* - extras: HTML attributes and additional information about the project.
* - attributes: HTML attributes for the extra item.
* - label: The label for an extra item.
* - data: The data about an extra item.
* - includes: The projects within the project.
* - disabled: The currently disabled projects in the project.
*
* @see template_preprocess_update_project_status()
*
* @ingroup themeable
*/
#}
{%
set status_classes = [
project.status == constant('UPDATE_NOT_SECURE') ? 'project-update__status--security-error',
project.status == constant('UPDATE_REVOKED') ? 'project-update__status--revoked',
project.status == constant('UPDATE_NOT_SUPPORTED') ? 'project-update__status--not-supported',
project.status == constant('UPDATE_NOT_CURRENT') ? 'project-update__status--not-current',
project.status == constant('UPDATE_CURRENT') ? 'project-update__status--current',
]
%}
<div{{ status.attributes.addClass('project-update__status', status_classes) }}>
{%- if status.label -%}
<span>{{ status.label }}</span>
{%- else -%}
{{ status.reason }}
{%- endif %}
<span class="project-update__status-icon">
{{ status.icon }}
</span>
</div>
<div class="project-update__title">
{%- if url -%}
<a href="{{ url }}">{{ title }}</a>
{%- else -%}
{{ title }}
{%- endif %}
{{ existing_version }}
{% if install_type == 'dev' and datestamp %}
<span class="project-update__version-date">({{ datestamp }})</span>
{% endif %}
</div>
{% if versions %}
{% for version in versions %}
{{ version }}
{% endfor %}
{% endif %}
{%
set extra_classes = [
project.status == constant('UPDATE_NOT_SECURE') ? 'project-not-secure',
project.status == constant('UPDATE_REVOKED') ? 'project-revoked',
project.status == constant('UPDATE_NOT_SUPPORTED') ? 'project-not-supported',
]
%}
<div class="project-updates__details">
{% if extras %}
<div class="extra">
{% for extra in extras %}
<div{{ extra.attributes.addClass(extra_classes) }}>
{{ extra.label }}: {{ extra.data }}
</div>
{% endfor %}
</div>
{% endif %}
{% set includes = includes|join(', ') %}
{% if disabled %}
{{ 'Includes:'|t }}
<ul>
<li>
{% trans %}
Enabled: {{ includes|placeholder }}
{% endtrans %}
</li>
<li>
{% set disabled = disabled|join(', ') %}
{% trans %}
Disabled: {{ disabled|placeholder }}
{% endtrans %}
</li>
</ul>
{% else %}
{% trans %}
Includes: {{ includes|placeholder }}
{% endtrans %}
{% endif %}
</div>
{#
/**
* @file
* Default theme implementation for the project status report.
*
* Available variables:
* - last_checked: Themed last time update data was checked.
* - no_updates_message: Message when there are no project updates.
* - project_types: A list of project types.
* - label: The project type label.
* - table: The project status table.
*
* @see template_preprocess_update_report()
*
* @ingroup themeable
*/
#}
{{ last_checked }}
{% for project_type in project_types %}
<h3>{{ project_type.label }}</h3>
{{ project_type.table }}
{% else %}
<p>{{ no_updates_message }}</p>
{% endfor %}
{#
/**
* @file
* Default theme implementation for the version display of a project.
*
* Available variables:
* - attributes: HTML attributes suitable for a container element.
* - title: The title of the project.
* - version: A list of data about the latest released version, containing:
* - version: The version number.
* - date: The date of the release.
* - download_link: The URL for the downloadable file.
* - release_link: The URL for the release notes.
*
* @ingroup themeable
*/
#}
<div class="{{ attributes.class }} project-update__version"{{ attributes|without('class') }}>
<div class="clearfix">
<div class="project-update__version-title layout-column layout-column--quarter">{{ title }}</div>
<div class="project-update__version-details layout-column layout-column--quarter">
<a href="{{ version.release_link }}">{{ version.version }}</a>
<span class="project-update__version-date">({{ version.date|date('Y-M-d') }})</span>
</div>
<div class="layout-column layout-column--half">
<ul class="project-update__version-links">
<li class="project-update__download-link">
<a href="{{ version.download_link }}">{{ 'Download'|t }}</a>
</li>
<li class="project-update__release-notes-link">
<a href="{{ version.release_link }}">{{ 'Release notes'|t }}</a>
</li>
</ul>
</div>
</div>
</div>
name: 'AAA Update test'
type: module
description: 'Support module for update module testing.'
package: Testing
# version: VERSION
# core: 8.x
# Information added by Drupal.org packaging script on 2018-09-10
version: '8.6.1'
core: '8.x'
project: 'drupal'
datestamp: 1536585833
name: 'BBB Update test'
type: module
description: 'Support module for update module testing.'
package: Testing
# version: VERSION
# core: 8.x
# Information added by Drupal.org packaging script on 2018-09-10
version: '8.6.1'
core: '8.x'
project: 'drupal'
datestamp: 1536585833
name: 'CCC Update test'
type: module
description: 'Support module for update module testing.'
package: Testing
# version: VERSION
# core: 8.x
# Information added by Drupal.org packaging script on 2018-09-10
version: '8.6.1'
core: '8.x'
project: 'drupal'
datestamp: 1536585833
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>AAA Update test</title>
<short_name>aaa_update_test</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>1</recommended_major>
<supported_majors>1</supported_majors>
<default_major>1</default_major>
<project_status>published</project_status>
<link>http://example.com/project/aaa_update_test</link>
<terms>
<term><name>Projects</name><value>Modules</value></term>
</terms>
<releases>
<release>
<name>aaa_update_test 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-8--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8.x-1.0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<error>No release history was found for the requested project (aaa_update_test).</error>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>AAA Update test</title>
<short_name>aaa_update_test</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>1</recommended_major>
<supported_majors>1</supported_majors>
<default_major>1</default_major>
<project_status>published</project_status>
<link>http://example.com/project/aaa_update_test</link>
<terms>
<term><name>Projects</name><value>Modules</value></term>
</terms>
<releases>
<release>
<name>aaa_update_test 8.x-1.2</name>
<version>8.x-1.2</version>
<tag>DRUPAL-8--1-2</tag>
<version_major>1</version_major>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-2-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-2.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.1</name>
<version>8.x-1.1</version>
<tag>DRUPAL-8--1-1</tag>
<version_major>1</version_major>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-8--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>AAA Update test</title>
<short_name>aaa_update_test</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>1</recommended_major>
<supported_majors>1</supported_majors>
<default_major>1</default_major>
<project_status>published</project_status>
<link>http://example.com/project/aaa_update_test</link>
<terms>
<term><name>Projects</name><value>Modules</value></term>
</terms>
<releases>
<release>
<name>aaa_update_test 8.x-1.2</name>
<version>8.x-1.2</version>
<tag>DRUPAL-8--1-2</tag>
<version_major>1</version_major>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-2-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-2.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.1</name>
<version>8.x-1.1</version>
<tag>DRUPAL-8--1-1</tag>
<version_major>1</version_major>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-8--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>AAA Update test</title>
<short_name>aaa_update_test</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>2</recommended_major>
<supported_majors>1,2</supported_majors>
<default_major>2</default_major>
<project_status>published</project_status>
<link>http://example.com/project/aaa_update_test</link>
<terms>
<term><name>Projects</name><value>Modules</value></term>
</terms>
<releases>
<release>
<name>aaa_update_test 8.x-3.0-beta2</name>
<version>8.x-3.0-beta2</version>
<tag>8.x-3.0-beta2</tag>
<version_major>3</version_major>
<version_patch>0</version_patch>
<version_extra>beta2</version_extra>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-3-0-beta2-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-3-0-beta2.tar.gz</download_link>
<date>1533298080</date>
<mdhash>2387284145e34a19fc45e03c258a2831</mdhash>
<filesize>16209911</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
Beta releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>aaa_update_test 8.x-3.0-beta1</name>
<version>8.x-3.0-beta1</version>
<tag>8.x-3.0-beta1</tag>
<version_major>3</version_major>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-3-0-beta1</release_link>
<download_link>http://example.com/aaa_update_test--8-x-3-0-beta1.tar.gz</download_link>
<date>1533270485</date>
<mdhash>3d70ae568dd8f7100082b8c58bc8d1fe</mdhash>
<filesize>16209123</filesize>
<terms>
<term><name>Release type</name><value>Insecure</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
Beta releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>aaa_update_test 8.x-2.2</name>
<version>8.x-2.2</version>
<tag>DRUPAL-8--2-2</tag>
<version_major>2</version_major>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-2-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-2.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-2.1</name>
<version>8.x-2.1</version>
<tag>DRUPAL-8--2-1</tag>
<version_major>2</version_major>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-2.0</name>
<version>8.x-2.0</version>
<tag>DRUPAL-8--2-0</tag>
<version_major>2</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.2</name>
<version>8.x-1.2</version>
<tag>DRUPAL-8--1-2</tag>
<version_major>1</version_major>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-2-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-2.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.1</name>
<version>8.x-1.1</version>
<tag>DRUPAL-8--1-1</tag>
<version_major>1</version_major>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-8--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>AAA Update test</title>
<short_name>aaa_update_test</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>2</recommended_major>
<supported_majors>1,2</supported_majors>
<default_major>2</default_major>
<project_status>published</project_status>
<link>http://example.com/project/aaa_update_test</link>
<terms>
<term><name>Projects</name><value>Modules</value></term>
</terms>
<releases>
<release>
<name>aaa_update_test 8.x-2.2</name>
<version>8.x-2.2</version>
<tag>DRUPAL-8--2-2</tag>
<version_major>2</version_major>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-2-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-2.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-2.1</name>
<version>8.x-2.1</version>
<tag>DRUPAL-8--2-1</tag>
<version_major>2</version_major>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-2.0</name>
<version>8.x-2.0</version>
<tag>DRUPAL-8--2-0</tag>
<version_major>2</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.2</name>
<version>8.x-1.2</version>
<tag>DRUPAL-8--1-2</tag>
<version_major>1</version_major>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-2-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-2.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.1</name>
<version>8.x-1.1</version>
<tag>DRUPAL-8--1-1</tag>
<version_major>1</version_major>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>aaa_update_test 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-8--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>BBB Update test</title>
<short_name>bbb_update_test</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>1</recommended_major>
<supported_majors>1</supported_majors>
<default_major>1</default_major>
<project_status>published</project_status>
<link>http://example.com/project/bbb_update_test</link>
<terms>
<term><name>Projects</name><value>Modules</value></term>
</terms>
<releases>
<release>
<name>bbb_update_test 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-7--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/bbb_update_test-7-x-1-0-release</release_link>
<download_link>http://example.com/bbb_update_test-8.x-1.0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>CCC Update test</title>
<short_name>ccc_update_test</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>1</recommended_major>
<supported_majors>1</supported_majors>
<default_major>1</default_major>
<project_status>published</project_status>
<link>http://example.com/project/ccc_update_test</link>
<terms>
<term><name>Projects</name><value>Modules</value></term>
</terms>
<releases>
<release>
<name>ccc_update_test 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-7--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/ccc_update_test-7-x-1-0-release</release_link>
<download_link>http://example.com/ccc_update_test-8.x-1.0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
# Schema for the configuration files of the Update Test module.
update_test.settings:
type: config_object
label: 'Update test settings'
mapping:
system_info:
type: sequence
label: 'System info'
sequence:
type: sequence
label: 'Items'
sequence:
type: string
label: 'Item'
update_status:
type: sequence
label: 'Update status'
sequence:
type: mapping
label: 'Module'
mapping:
status:
type: integer
label: 'Value'
xml_map:
type: sequence
label: 'XML map'
sequence:
type: string
label: 'Value'
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.1.0-alpha1</name>
<version>8.1.0-alpha1</version>
<tag>DRUPAL-8-1-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.1.0-beta1</name>
<version>8.1.0-beta1</version>
<tag>DRUPAL-8-1-0-beta1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-beta1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-alpha1</name>
<version>8.1.0-alpha1</version>
<tag>DRUPAL-8-1-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.1.0</name>
<version>8.1.0</version>
<tag>DRUPAL-8-1-0</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-release</release_link>
<download_link>http://example.com/drupal-8-1-0.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-beta1</name>
<version>8.1.0-beta1</version>
<tag>DRUPAL-8-1-0-beta1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-beta1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-alpha1</name>
<version>8.1.0-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.1.1-alpha1</name>
<version>8.1.1-alpha1</version>
<tag>DRUPAL-8-1-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-1-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0</name>
<version>8.1.0</version>
<tag>DRUPAL-8-1-0</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-release</release_link>
<download_link>http://example.com/drupal-8-1-0.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-beta1</name>
<version>8.1.0-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-beta1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-alpha1</name>
<version>8.1.0-alpha1</version>
<tag>DRUPAL-8-1-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.1.1-beta1</name>
<version>8.1.1-beta1</version>
<tag>DRUPAL-8-1-1-beta1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-1-1-beta1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.1-alpha1</name>
<version>8.1.1-alpha1</version>
<tag>DRUPAL-8-1-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-1-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0</name>
<version>8.1.0</version>
<tag>DRUPAL-8-1-0</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-release</release_link>
<download_link>http://example.com/drupal-8-1-0.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-beta1</name>
<version>8.1.0-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-beta1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-alpha1</name>
<version>8.1.0-alpha1</version>
<tag>DRUPAL-8-1-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.1.1</name>
<version>8.1.1</version>
<tag>DRUPAL-8-1-1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-release</release_link>
<download_link>http://example.com/drupal-8-1-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.1-beta1</name>
<version>8.1.1-beta1</version>
<tag>DRUPAL-8-1-1-beta1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-1-1-beta1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.1-alpha1</name>
<version>8.1.1-alpha1</version>
<tag>DRUPAL-8-1-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-1-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0</name>
<version>8.1.0</version>
<tag>DRUPAL-8-1-0</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-release</release_link>
<download_link>http://example.com/drupal-8-1-0.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-beta1</name>
<version>8.1.0-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-beta1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0-alpha1</name>
<version>8.1.0-alpha1</version>
<tag>DRUPAL-8-1-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-1-0-alpha1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>DRUPAL-8-0-1-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>DRUPAL-8-0-1-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>DRUPAL-8-0-0-beta1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-beta1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>DRUPAL-8-0-0-alpha1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-8-0-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>9.x</api_version>
<recommended_major>9</recommended_major>
<supported_majors>9</supported_majors>
<default_major>9</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 9.0.0</name>
<version>9.0.0</version>
<tag>DRUPAL-9-0-0</tag>
<version_major>9</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-9-0-0-release</release_link>
<download_link>http://example.com/drupal-9-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.x-dev</name>
<version>8.0.x-dev</version>
<tag>DRUPAL-8-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_extra>dev</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-0-x-dev-release</release_link>
<download_link>http://example.com/drupal-8.0.x-dev.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.2</name>
<version>8.0.2</version>
<tag>DRUPAL-8-0-2</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-2-release</release_link>
<download_link>http://example.com/drupal-8-0-2.tar.gz</download_link>
<date>1250424641</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>drupal 8.2.0-rc2</name>
<version>8.2.0-rc2</version>
<tag>8.2.0-rc2</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>rc2</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-rc2-release</release_link>
<download_link>http://example.com/drupal-8-2-0-rc2.tar.gz</download_link>
<date>1533298080</date>
<mdhash>2387284145e34a19fc45e03c258a2831</mdhash>
<filesize>16209911</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
RC releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-rc1</name>
<version>8.2.0-rc1</version>
<tag>8.2.0-rc1</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>rc1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-rc1-release</release_link>
<download_link>http://example.com/drupal-8-2-0-rc1.tar.gz</download_link>
<date>1533270485</date>
<mdhash>3d70ae568dd8f7100082b8c58bc8d1fe</mdhash>
<filesize>16209123</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
RC releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-beta2</name>
<version>8.2.0-beta2</version>
<tag>8.2.0-beta2</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>beta2</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-beta2-release</release_link>
<download_link>http://example.com/drupal-8-2-0-beta2.tar.gz</download_link>
<date>1533298080</date>
<mdhash>2387284145e34a19fc45e03c258a2831</mdhash>
<filesize>16209911</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
Beta releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-beta1</name>
<version>8.2.0-beta1</version>
<tag>8.2.0-beta1</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-2-0-beta1.tar.gz</download_link>
<date>1533270485</date>
<mdhash>3d70ae568dd8f7100082b8c58bc8d1fe</mdhash>
<filesize>16209123</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
Beta releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-alpha2</name>
<version>8.2.0-alpha2</version>
<tag>8.2.0-alpha2</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha2</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-alpha2-release</release_link>
<download_link>http://example.com/drupal-8-2-0-alpha2.tar.gz</download_link>
<date>1533298080</date>
<mdhash>2387284145e34a19fc45e03c258a2831</mdhash>
<filesize>16209911</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
Alpha releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-alpha1</name>
<version>8.2.0-alpha1</version>
<tag>8.2.0-alpha1</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8.2.0-alpha1</release_link>
<download_link>http://example.com/drupal-8-2-0-alpha1.tar.gz</download_link>
<date>1533270485</date>
<mdhash>3d70ae568dd8f7100082b8c58bc8d1fe</mdhash>
<filesize>16209123</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
Alpha releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>Drupal 8.1.2</name>
<version>8.1.2</version>
<tag>DRUPAL-8-1-2</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-2-release</release_link>
<download_link>http://example.com/drupal-8-1-2.tar.gz</download_link>
<date>1250424526</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.1</name>
<version>8.1.1</version>
<tag>DRUPAL-8-1-1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-release</release_link>
<download_link>http://example.com/drupal-8-1-1.tar.gz</download_link>
<date>1250424525</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0</name>
<version>8.1.0</version>
<tag>DRUPAL-8-1-0</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-release</release_link>
<download_link>http://example.com/drupal-8-1-0.tar.gz</download_link>
<date>1250424524</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.2</name>
<version>8.0.2</version>
<tag>DRUPAL-8-0-2</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-2-release</release_link>
<download_link>http://example.com/drupal-8-0-2.tar.gz</download_link>
<date>1250424523</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424522</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>drupal 8.2.0-rc2</name>
<version>8.2.0-rc2</version>
<tag>8.2.0-rc2</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>rc2</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-rc2-release</release_link>
<download_link>http://example.com/drupal-8-2-0-rc2.tar.gz</download_link>
<date>1533298080</date>
<mdhash>2387284145e34a19fc45e03c258a2831</mdhash>
<filesize>16209911</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
<security>
RC releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-rc1</name>
<version>8.2.0-rc1</version>
<tag>8.2.0-rc1</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>rc1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-rc1-release</release_link>
<download_link>http://example.com/drupal-8-2-0-rc1.tar.gz</download_link>
<date>1533270485</date>
<mdhash>3d70ae568dd8f7100082b8c58bc8d1fe</mdhash>
<filesize>16209123</filesize>
<terms>
<term><name>Release type</name><value>Insecure</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
RC releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-beta2</name>
<version>8.2.0-beta2</version>
<tag>8.2.0-beta2</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>beta2</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-beta2-release</release_link>
<download_link>http://example.com/drupal-8-2-0-beta2.tar.gz</download_link>
<date>1533298080</date>
<mdhash>2387284145e34a19fc45e03c258a2831</mdhash>
<filesize>16209911</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
<security>
Beta releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-beta1</name>
<version>8.2.0-beta1</version>
<tag>8.2.0-beta1</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>beta1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-beta1-release</release_link>
<download_link>http://example.com/drupal-8-2-0-beta1.tar.gz</download_link>
<date>1533270485</date>
<mdhash>3d70ae568dd8f7100082b8c58bc8d1fe</mdhash>
<filesize>16209123</filesize>
<terms>
<term><name>Release type</name><value>Insecure</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
Beta releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-alpha2</name>
<version>8.2.0-alpha2</version>
<tag>8.2.0-alpha2</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha2</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8-2-0-alpha2-release</release_link>
<download_link>http://example.com/drupal-8-2-0-alpha2.tar.gz</download_link>
<date>1533298080</date>
<mdhash>2387284145e34a19fc45e03c258a2831</mdhash>
<filesize>16209911</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
<security>
Alpha releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>drupal 8.2.0-alpha1</name>
<version>8.2.0-alpha1</version>
<tag>8.2.0-alpha1</tag>
<version_major>8</version_major>
<version_minor>2</version_minor>
<version_patch>0</version_patch>
<version_extra>alpha1</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-8.2.0-alpha1</release_link>
<download_link>http://example.com/drupal-8-2-0-alpha1.tar.gz</download_link>
<date>1533270485</date>
<mdhash>3d70ae568dd8f7100082b8c58bc8d1fe</mdhash>
<filesize>16209123</filesize>
<terms>
<term><name>Release type</name><value>Insecure</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>New features</value></term>
</terms>
<security>
Alpha releases are not covered by Drupal security advisories.
</security>
</release>
<release>
<name>Drupal 8.1.2</name>
<version>8.1.2</version>
<tag>DRUPAL-8-1-2</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-2-release</release_link>
<download_link>http://example.com/drupal-8-1-2.tar.gz</download_link>
<date>1250424641</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.1</name>
<version>8.1.1</version>
<tag>DRUPAL-8-1-1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-release</release_link>
<download_link>http://example.com/drupal-8-1-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0</name>
<version>8.1.0</version>
<tag>DRUPAL-8-1-0</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-release</release_link>
<download_link>http://example.com/drupal-8-1-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.2</name>
<version>8.0.2</version>
<tag>DRUPAL-8-0-2</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-2-release</release_link>
<download_link>http://example.com/drupal-8-0-2.tar.gz</download_link>
<date>1250424641</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.0.2</name>
<version>8.0.2</version>
<tag>DRUPAL-8-0-2</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-2-release</release_link>
<download_link>http://example.com/drupal-8-0-2.tar.gz</download_link>
<date>1250424641</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.1.2</name>
<version>8.1.2</version>
<tag>DRUPAL-8-1-2</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-2-release</release_link>
<download_link>http://example.com/drupal-8-1-2.tar.gz</download_link>
<date>1250424641</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.1</name>
<version>8.1.1</version>
<tag>DRUPAL-8-1-1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-release</release_link>
<download_link>http://example.com/drupal-8-1-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0</name>
<version>8.1.0</version>
<tag>DRUPAL-8-1-0</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-release</release_link>
<download_link>http://example.com/drupal-8-1-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.2</name>
<version>8.0.2</version>
<tag>DRUPAL-8-0-2</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-2-release</release_link>
<download_link>http://example.com/drupal-8-0-2.tar.gz</download_link>
<date>1250424641</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>8</recommended_major>
<supported_majors>8</supported_majors>
<default_major>8</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 8.1.2</name>
<version>8.1.2</version>
<tag>DRUPAL-8-1-2</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-2-release</release_link>
<download_link>http://example.com/drupal-8-1-2.tar.gz</download_link>
<date>1250424641</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.1</name>
<version>8.1.1</version>
<tag>DRUPAL-8-1-1</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-1-release</release_link>
<download_link>http://example.com/drupal-8-1-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.1.0</name>
<version>8.1.0</version>
<tag>DRUPAL-8-1-0</tag>
<version_major>8</version_major>
<version_minor>1</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-1-0-release</release_link>
<download_link>http://example.com/drupal-8-1-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.2</name>
<version>8.0.2</version>
<tag>DRUPAL-8-0-2</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>2</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-2-release</release_link>
<download_link>http://example.com/drupal-8-0-2.tar.gz</download_link>
<date>1250424641</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>4294967296</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.1</name>
<version>8.0.1</version>
<tag>DRUPAL-8-0-1</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-1-release</release_link>
<download_link>http://example.com/drupal-8-0-1.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
<release>
<name>Drupal 8.0.0</name>
<version>8.0.0</version>
<tag>DRUPAL-8-0-0</tag>
<version_major>8</version_major>
<version_minor>0</version_minor>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-8-0-0-release</release_link>
<download_link>http://example.com/drupal-8-0-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?php
namespace Drupal\update_test\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* Provides different routes of the update_test module.
*/
class UpdateTestController extends ControllerBase {
/**
* Displays an Error 503 (Service unavailable) page.
*
* @return \Symfony\Component\HttpFoundation\Response
* Returns the response with a special header.
*/
public function updateError() {
$response = new Response();
$response->setStatusCode(503);
$response->headers->set('Status', '503 Service unavailable');
return $response;
}
/**
* Page callback: Prints mock XML for the Update Manager module.
*
* The specific XML file to print depends on two things: the project we're
* trying to fetch data for, and the desired "availability scenario" for that
* project which we're trying to test. Before attempting to fetch this data (by
* checking for updates on the available updates report), callers need to define
* the 'update_test_xml_map' variable as an array, keyed by project name,
* indicating which availability scenario to use for that project.
*
* @param string $project_name
* The project short name the update manager is trying to fetch data for (the
* fetch URLs are of the form: [base_url]/[project_name]/[core_version]).
* @param string $version
* The version of Drupal core.
*
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse|Response
* A BinaryFileResponse object containing the content of the XML release file
* for the specified project if one is available; a Response object with no
* content otherwise.
*/
public function updateTest($project_name, $version) {
$xml_map = $this->config('update_test.settings')->get('xml_map');
if (isset($xml_map[$project_name])) {
$availability_scenario = $xml_map[$project_name];
}
elseif (isset($xml_map['#all'])) {
$availability_scenario = $xml_map['#all'];
}
else {
// The test didn't specify (for example, the webroot has other modules and
// themes installed but they're disabled by the version of the site
// running the test. So, we default to a file we know won't exist, so at
// least we'll get an empty xml response instead of a bunch of Drupal page
// output.
$availability_scenario = '#broken#';
}
$file = __DIR__ . "/../../$project_name.$availability_scenario.xml";
$headers = ['Content-Type' => 'text/xml; charset=utf-8'];
if (!is_file($file)) {
// Return an empty response.
return new Response('', 200, $headers);
}
return new BinaryFileResponse($file, 200, $headers);
}
}
<?php
namespace Drupal\update_test\Plugin\Archiver;
use Drupal\Core\Archiver\ArchiverInterface;
/**
* Defines a test archiver implementation.
*
* @Archiver(
* id = "update_test_archiver",
* title = @Translation("Update Test Archiver"),
* extensions = {"update-test-extension"}
* )
*/
class UpdateTestArchiver implements ArchiverInterface {
/**
* {@inheritdoc}
*/
public function add($file_path) {
return $this;
}
/**
* {@inheritdoc}
*/
public function remove($path) {
return $this;
}
/**
* {@inheritdoc}
*/
public function extract($path, array $files = []) {
return $this;
}
/**
* {@inheritdoc}
*/
public function listContents() {
return [];
}
}
<?php
namespace Drupal\update_test;
use Drupal\Core\FileTransfer\Local;
/**
* Provides an object to test the settings form functionality.
*
* This class extends \Drupal\Core\FileTransfer\Local to make module install
* testing via \Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm and
* authorize.php possible.
*
* @see \Drupal\update\Tests\FileTransferAuthorizeFormTest
*/
class TestFileTransferWithSettingsForm extends Local {
/**
* Returns a Drupal\update_test\TestFileTransferWithSettingsForm object.
*
* @return \Drupal\update_test\TestFileTransferWithSettingsForm
* A new Drupal\update_test\TestFileTransferWithSettingsForm object.
*/
public static function factory($jail, $settings) {
return new static($jail);
}
/**
* Returns a settings form with a text field to input a username.
*/
public function getSettingsForm() {
$form = [];
$form['update_test_username'] = [
'#type' => 'textfield',
'#title' => t('Update Test Username'),
];
return $form;
}
}
name: 'Update test'
type: module
description: 'Support module for update module testing.'
package: Testing
# version: VERSION
# core: 8.x
# Information added by Drupal.org packaging script on 2018-09-10
version: '8.6.1'
core: '8.x'
project: 'drupal'
datestamp: 1536585833
<?php
/**
* @file
* Module for testing Update Manager functionality.
*/
use Drupal\Core\Extension\Extension;
/**
* Implements hook_system_info_alter().
*
* Checks the 'update_test.settings:system_info' configuration and sees if we
* need to alter the system info for the given $file based on the setting. The
* setting is expected to be a nested associative array. If the key '#all' is
* defined, its subarray will include .info.yml keys and values for all modules
* and themes on the system. Otherwise, the settings array is keyed by the
* module or theme short name ($file->name) and the subarrays contain settings
* just for that module or theme.
*/
function update_test_system_info_alter(&$info, Extension $file) {
$setting = \Drupal::config('update_test.settings')->get('system_info');
foreach (['#all', $file->getName()] as $id) {
if (!empty($setting[$id])) {
foreach ($setting[$id] as $key => $value) {
$info[$key] = $value;
}
}
}
}
/**
* Implements hook_update_status_alter().
*
* Checks the 'update_test.settings:update_status' configuration and sees if we
* need to alter the update status for the given project based on the setting.
* The setting is expected to be a nested associative array. If the key '#all'
* is defined, its subarray will include .info.yml keys and values for all modules
* and themes on the system. Otherwise, the settings array is keyed by the
* module or theme short name and the subarrays contain settings just for that
* module or theme.
*/
function update_test_update_status_alter(&$projects) {
$setting = \Drupal::config('update_test.settings')->get('update_status');
if (!empty($setting)) {
foreach ($projects as $project_name => &$project) {
foreach (['#all', $project_name] as $id) {
if (!empty($setting[$id])) {
foreach ($setting[$id] as $key => $value) {
$project[$key] = $value;
}
}
}
}
}
}
/**
* Implements hook_filetransfer_info().
*/
function update_test_filetransfer_info() {
// Define a test file transfer method, to ensure that there will always be at
// least one method available in the user interface (regardless of the
// environment in which the update manager tests are run).
return [
'system_test' => [
'title' => t('Update Test FileTransfer'),
'class' => 'Drupal\update_test\TestFileTransferWithSettingsForm',
'weight' => -20,
],
];
}
update_test.503:
path: '/503-error'
defaults:
_controller: 'Drupal\update_test\Controller\UpdateTestController::updateError'
requirements:
_access: 'TRUE'
update_test.update_test:
path: '/update-test/{project_name}/{version}'
defaults:
_title: 'Update test'
_controller: '\Drupal\update_test\Controller\UpdateTestController::updateTest'
version: NULL
project_name: NULL
requirements:
_access: 'TRUE'
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Update test base theme</title>
<short_name>update_test_basetheme</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>1</recommended_major>
<supported_majors>1</supported_majors>
<default_major>1</default_major>
<project_status>published</project_status>
<link>http://example.com/project/update_test_basetheme</link>
<terms>
<term><name>Projects</name><value>Themes</value></term>
</terms>
<releases>
<release>
<name>update_test_basetheme 8.x-1.1</name>
<version>8.x-1.1</version>
<tag>DRUPAL-7--1-1</tag>
<version_major>1</version_major>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/update_test_basetheme-7-x-1-1-release</release_link>
<download_link>http://example.com/update_test_basetheme-8.x-1.1.tar.gz</download_link>
<date>1250624521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073763241</filesize>
<terms>
<term><name>Release type</name><value>Security update</value></term>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>update_test_basetheme 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-7--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/update_test_basetheme-7-x-1-0-release</release_link>
<download_link>http://example.com/update_test_basetheme-8.x-1.0.tar.gz</download_link>
<date>1250524521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Update test new module</title>
<short_name>update_test_new_module</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>1</recommended_major>
<supported_majors>1</supported_majors>
<default_major>1</default_major>
<project_status>published</project_status>
<link>http://example.com/project/update_test_new_module</link>
<terms>
<term><name>Projects</name><value>Modules</value></term>
</terms>
<releases>
<release>
<name>update_test_new_module 8.x-1.1</name>
<version>8.x-1.1</version>
<tag>DRUPAL-8--1-1</tag>
<version_major>1</version_major>
<version_patch>1</version_patch>
<status>published</status>
<release_link>http://example.com/update_test_new_module-8-x-1-1-release</release_link>
<download_link>core/modules/update/tests/update_test_new_module/8.x-1.1/update_test_new_module.tar.gz</download_link>
<date>1300424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Update test subtheme</title>
<short_name>update_test_subtheme</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>1</recommended_major>
<supported_majors>1</supported_majors>
<default_major>1</default_major>
<project_status>published</project_status>
<link>http://example.com/project/update_test_subtheme</link>
<terms>
<term><name>Projects</name><value>Themes</value></term>
</terms>
<releases>
<release>
<name>update_test_subtheme 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>DRUPAL-7--1-0</tag>
<version_major>1</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/update_test_subtheme-7-x-1-0-release</release_link>
<download_link>http://example.com/update_test_subtheme-8.x-1.0.tar.gz</download_link>
<date>1250524521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
<?php
namespace Drupal\Tests\update\Functional;
/**
* Tests the Update Manager module upload via authorize.php functionality.
*
* @group update
*/
class FileTransferAuthorizeFormTest extends UpdateTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['update', 'update_test'];
protected function setUp() {
parent::setUp();
$admin_user = $this->drupalCreateUser(['administer modules', 'administer software updates', 'administer site configuration']);
$this->drupalLogin($admin_user);
// Create a local cache so the module is not downloaded from drupal.org.
$cache_directory = _update_manager_cache_directory(TRUE);
$validArchiveFile = __DIR__ . '/../../update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
copy($validArchiveFile, $cache_directory . '/update_test_new_module.tar.gz');
}
/**
* Tests the Update Manager module upload via authorize.php functionality.
*/
public function testViaAuthorize() {
// Ensure the that we can select which file transfer backend to use.
\Drupal::state()->set('test_uploaders_via_prompt', TRUE);
// Ensure the module does not already exist.
$this->drupalGet('admin/modules');
$this->assertNoText('Update test new module');
$edit = [
// This project has been cached in the test's setUp() method.
'project_url' => 'https://ftp.drupal.org/files/projects/update_test_new_module.tar.gz',
];
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
$edit = [
'connection_settings[authorize_filetransfer_default]' => 'system_test',
'connection_settings[system_test][update_test_username]' => $this->randomMachineName(),
];
$this->drupalPostForm(NULL, $edit, t('Continue'));
$this->assertText(t('Installation was completed successfully.'));
// Ensure the module is available to install.
$this->drupalGet('admin/modules');
$this->assertText('Update test new module');
}
}
<?php
namespace Drupal\Tests\update\Functional;
use Drupal\Core\Url;
use Drupal\Core\Utility\ProjectInfo;
/**
* Tests how the Update Manager module handles contributed modules and themes in
* a series of functional tests using mock XML data.
*
* @group update
*/
class UpdateContribTest extends UpdateTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['update_test', 'update', 'aaa_update_test', 'bbb_update_test', 'ccc_update_test'];
protected function setUp() {
parent::setUp();
$admin_user = $this->drupalCreateUser(['administer site configuration']);
$this->drupalLogin($admin_user);
}
/**
* Tests when there is no available release data for a contrib module.
*/
public function testNoReleasesAvailable() {
$system_info = [
'#all' => [
'version' => '8.0.0',
],
'aaa_update_test' => [
'project' => 'aaa_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
];
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(['drupal' => '0.0', 'aaa_update_test' => 'no-releases']);
$this->drupalGet('admin/reports/updates');
// Cannot use $this->standardTests() because we need to check for the
// 'No available releases found' string.
$this->assertRaw('<h3>' . t('Drupal core') . '</h3>');
$this->assertRaw(\Drupal::l(t('Drupal'), Url::fromUri('http://example.com/project/drupal')));
$this->assertText(t('Up to date'));
$this->assertRaw('<h3>' . t('Modules') . '</h3>');
$this->assertNoText(t('Update available'));
$this->assertText(t('No available releases found'));
$this->assertNoRaw(\Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')));
$available = update_get_available();
$this->assertFalse(isset($available['aaa_update_test']['fetch_status']), 'Results are cached even if no releases are available.');
}
/**
* Tests the basic functionality of a contrib module on the status report.
*/
public function testUpdateContribBasic() {
$project_link = \Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'));
$system_info = [
'#all' => [
'version' => '8.0.0',
],
'aaa_update_test' => [
'project' => 'aaa_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
];
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(
[
'drupal' => '0.0',
'aaa_update_test' => '1_0',
]
);
$this->standardTests();
$this->assertText(t('Up to date'));
$this->assertRaw('<h3>' . t('Modules') . '</h3>');
$this->assertNoText(t('Update available'));
$this->assertRaw($project_link, 'Link to aaa_update_test project appears.');
// Since aaa_update_test is installed the fact it is hidden and in the
// Testing package means it should not appear.
$system_info['aaa_update_test']['hidden'] = TRUE;
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(
[
'drupal' => '0.0',
'aaa_update_test' => '1_0',
]
);
$this->assertNoRaw($project_link, 'Link to aaa_update_test project does not appear.');
// A hidden and installed project not in the Testing package should appear.
$system_info['aaa_update_test']['package'] = 'aaa_update_test';
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(
[
'drupal' => '0.0',
'aaa_update_test' => '1_0',
]
);
$this->assertRaw($project_link, 'Link to aaa_update_test project appears.');
}
/**
* Tests that contrib projects are ordered by project name.
*
* If a project contains multiple modules, we want to make sure that the
* available updates report is sorted by the parent project names, not by the
* names of the modules included in each project. In this test case, we have
* two contrib projects, "BBB Update test" and "CCC Update test". However, we
* have a module called "aaa_update_test" that's part of the "CCC Update test"
* project. We need to make sure that we see the "BBB" project before the
* "CCC" project, even though "CCC" includes a module that's processed first
* if you sort alphabetically by module name (which is the order we see things
* inside system_rebuild_module_data() for example).
*/
public function testUpdateContribOrder() {
// We want core to be version 8.0.0.
$system_info = [
'#all' => [
'version' => '8.0.0',
],
// All the rest should be visible as contrib modules at version 8.x-1.0.
// aaa_update_test needs to be part of the "CCC Update test" project,
// which would throw off the report if we weren't properly sorting by
// the project names.
'aaa_update_test' => [
'project' => 'ccc_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
// This should be its own project, and listed first on the report.
'bbb_update_test' => [
'project' => 'bbb_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
// This will contain both aaa_update_test and ccc_update_test, and
// should come after the bbb_update_test project.
'ccc_update_test' => [
'project' => 'ccc_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
];
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(['drupal' => '0.0', '#all' => '1_0']);
$this->standardTests();
// We're expecting the report to say all projects are up to date.
$this->assertText(t('Up to date'));
$this->assertNoText(t('Update available'));
// We want to see all 3 module names listed, since they'll show up either
// as project names or as modules under the "Includes" listing.
$this->assertText(t('AAA Update test'));
$this->assertText(t('BBB Update test'));
$this->assertText(t('CCC Update test'));
// We want aaa_update_test included in the ccc_update_test project, not as
// its own project on the report.
$this->assertNoRaw(\Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')), 'Link to aaa_update_test project does not appear.');
// The other two should be listed as projects.
$this->assertRaw(\Drupal::l(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test')), 'Link to bbb_update_test project appears.');
$this->assertRaw(\Drupal::l(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test')), 'Link to bbb_update_test project appears.');
// We want to make sure we see the BBB project before the CCC project.
// Instead of just searching for 'BBB Update test' or something, we want
// to use the full markup that starts the project entry itself, so that
// we're really testing that the project listings are in the right order.
$bbb_project_link = '<div class="project-update__title"><a href="http://example.com/project/bbb_update_test">BBB Update test</a>';
$ccc_project_link = '<div class="project-update__title"><a href="http://example.com/project/ccc_update_test">CCC Update test</a>';
$this->assertTrue(strpos($this->getSession()->getPage()->getContent(), $bbb_project_link) < strpos($this->getSession()->getPage()->getContent(), $ccc_project_link), "'BBB Update test' project is listed before the 'CCC Update test' project");
}
/**
* Tests that subthemes are notified about security updates for base themes.
*/
public function testUpdateBaseThemeSecurityUpdate() {
// @todo https://www.drupal.org/node/2338175 base themes have to be
// installed.
// Only install the subtheme, not the base theme.
\Drupal::service('theme_handler')->install(['update_test_subtheme']);
// Define the initial state for core and the subtheme.
$system_info = [
// We want core to be version 8.0.0.
'#all' => [
'version' => '8.0.0',
],
// Show the update_test_basetheme
'update_test_basetheme' => [
'project' => 'update_test_basetheme',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
// Show the update_test_subtheme
'update_test_subtheme' => [
'project' => 'update_test_subtheme',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
];
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$xml_mapping = [
'drupal' => '0.0',
'update_test_subtheme' => '1_0',
'update_test_basetheme' => '1_1-sec',
];
$this->refreshUpdateStatus($xml_mapping);
$this->assertText(t('Security update required!'));
$this->assertRaw(\Drupal::l(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme')), 'Link to the Update test base theme project appears.');
}
/**
* Tests that disabled themes are only shown when desired.
*
* @todo https://www.drupal.org/node/2338175 extensions can not be hidden and
* base themes have to be installed.
*/
public function testUpdateShowDisabledThemes() {
$update_settings = $this->config('update.settings');
// Make sure all the update_test_* themes are disabled.
$extension_config = $this->config('core.extension');
foreach ($extension_config->get('theme') as $theme => $weight) {
if (preg_match('/^update_test_/', $theme)) {
$extension_config->clear("theme.$theme");
}
}
$extension_config->save();
// Define the initial state for core and the test contrib themes.
$system_info = [
// We want core to be version 8.0.0.
'#all' => [
'version' => '8.0.0',
],
// The update_test_basetheme should be visible and up to date.
'update_test_basetheme' => [
'project' => 'update_test_basetheme',
'version' => '8.x-1.1',
'hidden' => FALSE,
],
// The update_test_subtheme should be visible and up to date.
'update_test_subtheme' => [
'project' => 'update_test_subtheme',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
];
// When there are contributed modules in the site's file system, the
// total number of attempts made in the test may exceed the default value
// of update_max_fetch_attempts. Therefore this variable is set very high
// to avoid test failures in those cases.
$update_settings->set('fetch.max_attempts', 99999)->save();
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$xml_mapping = [
'drupal' => '0.0',
'update_test_subtheme' => '1_0',
'update_test_basetheme' => '1_1-sec',
];
$base_theme_project_link = \Drupal::l(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme'));
$sub_theme_project_link = \Drupal::l(t('Update test subtheme'), Url::fromUri('http://example.com/project/update_test_subtheme'));
foreach ([TRUE, FALSE] as $check_disabled) {
$update_settings->set('check.disabled_extensions', $check_disabled)->save();
$this->refreshUpdateStatus($xml_mapping);
// In neither case should we see the "Themes" heading for installed
// themes.
$this->assertNoText(t('Themes'));
if ($check_disabled) {
$this->assertText(t('Uninstalled themes'));
$this->assertRaw($base_theme_project_link, 'Link to the Update test base theme project appears.');
$this->assertRaw($sub_theme_project_link, 'Link to the Update test subtheme project appears.');
}
else {
$this->assertNoText(t('Uninstalled themes'));
$this->assertNoRaw($base_theme_project_link, 'Link to the Update test base theme project does not appear.');
$this->assertNoRaw($sub_theme_project_link, 'Link to the Update test subtheme project does not appear.');
}
}
}
/**
* Tests updates with a hidden base theme.
*/
public function testUpdateHiddenBaseTheme() {
module_load_include('compare.inc', 'update');
// Install the subtheme.
\Drupal::service('theme_handler')->install(['update_test_subtheme']);
// Add a project and initial state for base theme and subtheme.
$system_info = [
// Hide the update_test_basetheme.
'update_test_basetheme' => [
'project' => 'update_test_basetheme',
'hidden' => TRUE,
],
// Show the update_test_subtheme.
'update_test_subtheme' => [
'project' => 'update_test_subtheme',
'hidden' => FALSE,
],
];
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$projects = \Drupal::service('update.manager')->getProjects();
$theme_data = \Drupal::service('theme_handler')->rebuildThemeData();
$project_info = new ProjectInfo();
$project_info->processInfoList($projects, $theme_data, 'theme', TRUE);
$this->assertTrue(!empty($projects['update_test_basetheme']), 'Valid base theme (update_test_basetheme) was found.');
}
/**
* Makes sure that if we fetch from a broken URL, sane things happen.
*/
public function testUpdateBrokenFetchURL() {
$system_info = [
'#all' => [
'version' => '8.0.0',
],
'aaa_update_test' => [
'project' => 'aaa_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
'bbb_update_test' => [
'project' => 'bbb_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
'ccc_update_test' => [
'project' => 'ccc_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
];
$this->config('update_test.settings')->set('system_info', $system_info)->save();
// Ensure that the update information is correct before testing.
$this->drupalGet('admin/reports/updates');
$xml_mapping = [
'drupal' => '0.0',
'aaa_update_test' => '1_0',
'bbb_update_test' => 'does-not-exist',
'ccc_update_test' => '1_0',
];
$this->refreshUpdateStatus($xml_mapping);
$this->assertText(t('Up to date'));
// We're expecting the report to say most projects are up to date, so we
// hope that 'Up to date' is not unique.
$this->assertNoUniqueText(t('Up to date'));
// It should say we failed to get data, not that we're missing an update.
$this->assertNoText(t('Update available'));
// We need to check that this string is found as part of a project row, not
// just in the "Failed to get available update data" message at the top of
// the page.
$this->assertRaw('<div class="project-update__status">' . t('Failed to get available update data'));
// We should see the output messages from fetching manually.
$this->assertUniqueText(t('Checked available update data for 3 projects.'));
$this->assertUniqueText(t('Failed to get available update data for one project.'));
// The other two should be listed as projects.
$this->assertRaw(\Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')), 'Link to aaa_update_test project appears.');
$this->assertNoRaw(\Drupal::l(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test')), 'Link to bbb_update_test project does not appear.');
$this->assertRaw(\Drupal::l(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test')), 'Link to bbb_update_test project appears.');
}
/**
* Checks that hook_update_status_alter() works to change a status.
*
* We provide the same external data as if aaa_update_test 8.x-1.0 were
* installed and that was the latest release. Then we use
* hook_update_status_alter() to try to mark this as missing a security
* update, then assert if we see the appropriate warnings on the right pages.
*/
public function testHookUpdateStatusAlter() {
$update_test_config = $this->config('update_test.settings');
$update_admin_user = $this->drupalCreateUser(['administer site configuration', 'administer software updates']);
$this->drupalLogin($update_admin_user);
$system_info = [
'#all' => [
'version' => '8.0.0',
],
'aaa_update_test' => [
'project' => 'aaa_update_test',
'version' => '8.x-1.0',
'hidden' => FALSE,
],
];
$update_test_config->set('system_info', $system_info)->save();
$update_status = [
'aaa_update_test' => [
'status' => UPDATE_NOT_SECURE,
],
];
$update_test_config->set('update_status', $update_status)->save();
$this->refreshUpdateStatus(
[
'drupal' => '0.0',
'aaa_update_test' => '1_0',
]
);
$this->drupalGet('admin/reports/updates');
$this->assertRaw('<h3>' . t('Modules') . '</h3>');
$this->assertText(t('Security update required!'));
$this->assertRaw(\Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')), 'Link to aaa_update_test project appears.');
// Visit the reports page again without the altering and make sure the
// status is back to normal.
$update_test_config->set('update_status', [])->save();
$this->drupalGet('admin/reports/updates');
$this->assertRaw('<h3>' . t('Modules') . '</h3>');
$this->assertNoText(t('Security update required!'));
$this->assertRaw(\Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')), 'Link to aaa_update_test project appears.');
// Turn the altering back on and visit the Update manager UI.
$update_test_config->set('update_status', $update_status)->save();
$this->drupalGet('admin/modules/update');
$this->assertText(t('Security update'));
// Turn the altering back off and visit the Update manager UI.
$update_test_config->set('update_status', [])->save();
$this->drupalGet('admin/modules/update');
$this->assertNoText(t('Security update'));
}
/**
* Tests update status of security releases.
*
* @param string $module_version
* The module version the site is using.
* @param string[] $expected_security_releases
* The security releases, if any, that the status report should recommend.
* @param string $expected_update_message_type
* The type of update message expected.
* @param string $fixture
* The fixture file to use.
*
* @dataProvider securityUpdateAvailabilityProvider
*/
public function testSecurityUpdateAvailability($module_version, array $expected_security_releases, $expected_update_message_type, $fixture) {
$system_info = [
'#all' => [
'version' => '8.0.0',
],
'aaa_update_test' => [
'project' => 'aaa_update_test',
'version' => $module_version,
'hidden' => FALSE,
],
];
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(['drupal' => '0.0', 'aaa_update_test' => $fixture]);
$this->assertSecurityUpdates('aaa_update_test', $expected_security_releases, $expected_update_message_type, 'table.update:nth-of-type(2)');
}
/**
* Data provider method for testSecurityUpdateAvailability().
*
* These test cases rely on the following fixtures containing the following
* releases:
* - aaa_update_test.sec.8.x-1.2.xml
* - 8.x-1.2 Security update
* - 8.x-1.1 Insecure
* - 8.x-1.0 Insecure
* - aaa_update_test.sec.8.x-1.1_8.x-1.2.xml
* - 8.x-1.2 Security update
* - 8.x-1.1 Security update, Insecure
* - 8.x-1.0 Insecure
* - aaa_update_test.sec.8.x-1.2_8.x-2.2.xml
* - 8.x-3.0-beta2
* - 8.x-3.0-beta1 Insecure
* - 8.x-2.2 Security update
* - 8.x-2.1 Security update, Insecure
* - 8.x-2.0 Insecure
* - 8.x-1.2 Security update
* - 8.x-1.1 Insecure
* - 8.x-1.0 Insecure
* - aaa_update_test.sec.8.x-2.2_1.x_secure.xml
* - 8.x-2.2 Security update
* - 8.x-2.1 Security update, Insecure
* - 8.x-2.0 Insecure
* - 8.x-1.2
* - 8.x-1.1
* - 8.x-1.0
*/
public function securityUpdateAvailabilityProvider() {
return [
// Security releases available for module major release 1.
// No releases for next major.
'8.x-1.0, 8.x-1.2' => [
'module_patch_version' => '8.x-1.0',
'expected_security_releases' => ['8.x-1.2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.8.x-1.2',
],
// Two security releases available for module major release 1.
// 8.x-1.1 security release marked as insecure.
// No releases for next major.
'8.x-1.0, 8.x-1.1 8.x-1.2' => [
'module_patch_version' => '8.x-1.0',
'expected_security_releases' => ['8.x-1.2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.8.x-1.1_8.x-1.2',
],
// Security release available for module major release 2.
// No releases for next major.
'8.x-2.0, 8.x-2.2' => [
'module_patch_version' => '8.x-2.0',
'expected_security_releases' => ['8.x-2.2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.8.x-2.2_1.x_secure',
],
'8.x-2.2, 8.x-1.2 8.x-2.2' => [
'module_patch_version' => '8.x-2.2',
'expected_security_releases' => [],
'expected_update_message_type' => static::UPDATE_NONE,
'fixture' => 'sec.8.x-1.2_8.x-2.2',
],
// Security release available for module major release 1.
// Security release also available for next major.
'8.x-1.0, 8.x-1.2 8.x-2.2' => [
'module_patch_version' => '8.x-1.0',
'expected_security_releases' => ['8.x-1.2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.8.x-1.2_8.x-2.2',
],
// No security release available for module major release 1 but 1.x
// releases are not marked as insecure.
// Security release available for next major.
'8.x-1.0, 8.x-2.2, not insecure' => [
'module_patch_version' => '8.x-1.0',
'expected_security_releases' => [],
'expected_update_message_type' => static::UPDATE_AVAILABLE,
'fixture' => 'sec.8.x-2.2_1.x_secure',
],
// On latest security release for module major release 1.
// Security release also available for next major.
'8.x-1.2, 8.x-1.2 8.x-2.2' => [
'module_patch_version' => '8.x-1.2',
'expected_security_release' => [],
'expected_update_message_type' => static::UPDATE_NONE,
'fixture' => 'sec.8.x-1.2_8.x-2.2',
],
// @todo In https://www.drupal.org/node/2865920 add test cases:
// - 8.x-2.0 using fixture 'sec.8.x-1.2_8.x-2.2' to ensure that 8.x-2.2
// is the only security update.
// - 8.x-3.0-beta1 using fixture 'sec.8.x-1.2_8.x-2.2' to ensure that
// 8.x-2.2 is the only security update.
];
}
}
<?php
namespace Drupal\Tests\update\Functional;
use Drupal\Core\Url;
use Drupal\Tests\Traits\Core\CronRunTrait;
/**
* Tests the Update Manager module through a series of functional tests using
* mock XML data.
*
* @group update
*/
class UpdateCoreTest extends UpdateTestBase {
use CronRunTrait;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['update_test', 'update', 'language', 'block'];
protected function setUp() {
parent::setUp();
$admin_user = $this->drupalCreateUser(['administer site configuration', 'administer modules', 'administer themes']);
$this->drupalLogin($admin_user);
$this->drupalPlaceBlock('local_actions_block');
}
/**
* Sets the version to x.x.x when no project-specific mapping is defined.
*
* @param string $version
* The version.
*/
protected function setSystemInfo($version) {
$setting = [
'#all' => [
'version' => $version,
],
];
$this->config('update_test.settings')->set('system_info', $setting)->save();
}
/**
* Tests the Update Manager module when no updates are available.
*/
public function testNoUpdatesAvailable() {
foreach ([0, 1] as $minor_version) {
foreach ([0, 1] as $patch_version) {
foreach (['-alpha1', '-beta1', ''] as $extra_version) {
$this->setSystemInfo("8.$minor_version.$patch_version" . $extra_version);
$this->refreshUpdateStatus(['drupal' => "$minor_version.$patch_version" . $extra_version]);
$this->standardTests();
$this->assertText(t('Up to date'));
$this->assertNoText(t('Update available'));
$this->assertNoText(t('Security update required!'));
$this->assertRaw('check.svg', 'Check icon was found.');
}
}
}
}
/**
* Tests the Update Manager module when one normal update is available.
*/
public function testNormalUpdateAvailable() {
$this->setSystemInfo('8.0.0');
// Ensure that the update check requires a token.
$this->drupalGet('admin/reports/updates/check');
$this->assertResponse(403, 'Accessing admin/reports/updates/check without a CSRF token results in access denied.');
foreach ([0, 1] as $minor_version) {
foreach (['-alpha1', '-beta1', ''] as $extra_version) {
$this->refreshUpdateStatus(['drupal' => "$minor_version.1" . $extra_version]);
$this->standardTests();
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Check manually'));
$this->checkForMetaRefresh();
$this->assertNoText(t('Security update required!'));
$this->assertRaw(\Drupal::l("8.$minor_version.1" . $extra_version, Url::fromUri("http://example.com/drupal-8-$minor_version-1$extra_version-release")), 'Link to release appears.');
$this->assertRaw(\Drupal::l(t('Download'), Url::fromUri("http://example.com/drupal-8-$minor_version-1$extra_version.tar.gz")), 'Link to download appears.');
$this->assertRaw(\Drupal::l(t('Release notes'), Url::fromUri("http://example.com/drupal-8-$minor_version-1$extra_version-release")), 'Link to release notes appears.');
switch ($minor_version) {
case 0:
// Both stable and unstable releases are available.
// A stable release is the latest.
if ($extra_version == '') {
$this->assertNoText(t('Up to date'));
$this->assertText(t('Update available'));
$this->assertText(t('Recommended version:'));
$this->assertNoText(t('Latest version:'));
$this->assertRaw('warning.svg', 'Warning icon was found.');
}
// Only unstable releases are available.
// An unstable release is the latest.
else {
$this->assertText(t('Up to date'));
$this->assertNoText(t('Update available'));
$this->assertNoText(t('Recommended version:'));
$this->assertText(t('Latest version:'));
$this->assertRaw('check.svg', 'Check icon was found.');
}
break;
case 1:
// Both stable and unstable releases are available.
// A stable release is the latest.
if ($extra_version == '') {
$this->assertNoText(t('Up to date'));
$this->assertText(t('Update available'));
$this->assertText(t('Recommended version:'));
$this->assertNoText(t('Latest version:'));
$this->assertRaw('warning.svg', 'Warning icon was found.');
}
// Both stable and unstable releases are available.
// An unstable release is the latest.
else {
$this->assertNoText(t('Up to date'));
$this->assertText(t('Update available'));
$this->assertText(t('Recommended version:'));
$this->assertText(t('Latest version:'));
$this->assertRaw('warning.svg', 'Warning icon was found.');
}
break;
}
}
}
}
/**
* Tests the Update Manager module when a major update is available.
*/
public function testMajorUpdateAvailable() {
foreach ([0, 1] as $minor_version) {
foreach ([0, 1] as $patch_version) {
foreach (['-alpha1', '-beta1', ''] as $extra_version) {
$this->setSystemInfo("8.$minor_version.$patch_version" . $extra_version);
$this->refreshUpdateStatus(['drupal' => '9']);
$this->standardTests();
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Check manually'));
$this->checkForMetaRefresh();
$this->assertNoText(t('Security update required!'));
$this->assertRaw(\Drupal::l('9.0.0', Url::fromUri("http://example.com/drupal-9-0-0-release")), 'Link to release appears.');
$this->assertRaw(\Drupal::l(t('Download'), Url::fromUri("http://example.com/drupal-9-0-0.tar.gz")), 'Link to download appears.');
$this->assertRaw(\Drupal::l(t('Release notes'), Url::fromUri("http://example.com/drupal-9-0-0-release")), 'Link to release notes appears.');
$this->assertNoText(t('Up to date'));
$this->assertText(t('Not supported!'));
$this->assertText(t('Recommended version:'));
$this->assertNoText(t('Latest version:'));
$this->assertRaw('error.svg', 'Error icon was found.');
}
}
}
}
/**
* Tests the Update Manager module when a security update is available.
*
* @param string $site_patch_version
* The patch version to set the site to for testing.
* @param string[] $expected_security_releases
* The security releases, if any, that the status report should recommend.
* @param string $expected_update_message_type
* The type of update message expected.
* @param string $fixture
* The test fixture that contains the test XML.
*
* @dataProvider securityUpdateAvailabilityProvider
*/
public function testSecurityUpdateAvailability($site_patch_version, array $expected_security_releases, $expected_update_message_type, $fixture) {
$this->setSystemInfo("8.$site_patch_version");
$this->refreshUpdateStatus(['drupal' => $fixture]);
$this->assertSecurityUpdates('drupal-8', $expected_security_releases, $expected_update_message_type, 'table.update');
}
/**
* Data provider method for testSecurityUpdateAvailability().
*
* These test cases rely on the following fixtures containing the following
* releases:
* - drupal.sec.0.1_0.2.xml
* - 8.0.2 Security update
* - 8.0.1 Security update, Insecure
* - 8.0.0 Insecure
* - drupal.sec.0.2.xml
* - 8.0.2 Security update
* - 8.0.1 Insecure
* - 8.0.0 Insecure
* - drupal.sec.0.2-rc2.xml
* - 8.2.0-rc2 Security update
* - 8.2.0-rc1 Insecure
* - 8.2.0-beta2 Insecure
* - 8.2.0-beta1 Insecure
* - 8.2.0-alpha2 Insecure
* - 8.2.0-alpha1 Insecure
* - 8.1.2 Security update
* - 8.1.1 Insecure
* - 8.1.0 Insecure
* - 8.0.2 Security update
* - 8.0.1 Insecure
* - 8.0.0 Insecure
* - drupal.sec.1.2.xml
* - 8.1.2 Security update
* - 8.1.1 Insecure
* - 8.1.0 Insecure
* - 8.0.2
* - 8.0.1
* - 8.0.0
* - drupal.sec.1.2_insecure.xml
* - 8.1.2 Security update
* - 8.1.1 Insecure
* - 8.1.0 Insecure
* - 8.0.2 Insecure
* - 8.0.1 Insecure
* - 8.0.0 Insecure
* - drupal.sec.0.2-rc2-b.xml
* - 8.2.0-rc2
* - 8.2.0-rc1
* - 8.2.0-beta2
* - 8.2.0-beta1
* - 8.2.0-alpha2
* - 8.2.0-alpha1
* - 8.1.2 Security update
* - 8.1.1 Insecure
* - 8.1.0 Insecure
* - 8.0.2 Security update
* - 8.0.1 Insecure
* - 8.0.0 Insecure
*/
public function securityUpdateAvailabilityProvider() {
$test_cases = [
// Security release available for site minor release 0.
// No releases for next minor.
'0.0, 0.2' => [
'site_patch_version' => '0.0',
'expected_security_releases' => ['0.2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.0.2',
],
// Site on latest security release available for site minor release 0.
// Minor release 1 also has a security release, and the current release
// is marked as insecure.
'0.2, 0.2' => [
'site_patch_version' => '0.2',
'expected_security_release' => ['1.2', '2.0-rc2'],
'expected_update_message_type' => static::UPDATE_AVAILABLE,
'fixture' => 'sec.0.2-rc2',
],
// Two security releases available for site minor release 0.
// 0.1 security release marked as insecure.
// No releases for next minor.
'0.0, 0.1 0.2' => [
'site_patch_version' => '0.0',
'expected_security_releases' => ['0.2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.0.1_0.2',
],
// Security release available for site minor release 1.
// No releases for next minor.
'1.0, 1.2' => [
'site_patch_version' => '1.0',
'expected_security_releases' => ['1.2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.1.2',
],
// Security release available for site minor release 0.
// Security release also available for next minor.
'0.0, 0.2 1.2' => [
'site_patch_version' => '0.0',
'expected_security_releases' => ['0.2', '1.2', '2.0-rc2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.0.2-rc2',
],
// No newer security release for site minor 1.
// Previous minor has security release.
'1.2, 0.2 1.2' => [
'site_patch_version' => '1.2',
'expected_security_releases' => [],
'expected_update_message_type' => static::UPDATE_NONE,
'fixture' => 'sec.0.2-rc2',
],
// No security release available for site minor release 0.
// Security release available for next minor.
'0.0, 1.2, insecure' => [
'site_patch_version' => '0.0',
'expected_security_releases' => ['1.2'],
'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
'fixture' => 'sec.1.2_insecure',
],
// All releases for minor 0 are secure.
// Security release available for next minor.
'0.0, 1.2, secure' => [
'site_patch_version' => '0.0',
'expected_security_release' => ['1.2'],
'expected_update_message_type' => static::UPDATE_AVAILABLE,
'fixture' => 'sec.1.2',
],
'0.2, 1.2, secure' => [
'site_patch_version' => '0.2',
'expected_security_release' => ['1.2'],
'expected_update_message_type' => static::UPDATE_AVAILABLE,
'fixture' => 'sec.1.2',
],
// Site on 2.0-rc2 which is a security release.
'2.0-rc2, 0.2 1.2' => [
'site_patch_version' => '2.0-rc2',
'expected_security_releases' => [],
'expected_update_message_type' => static::UPDATE_NONE,
'fixture' => 'sec.0.2-rc2',
],
];
$pre_releases = [
'2.0-alpha1',
'2.0-alpha2',
'2.0-beta1',
'2.0-beta2',
'2.0-rc1',
'2.0-rc2',
];
// If the site is on an alpha/beta/RC of an upcoming minor and none of the
// alpha/beta/RC versions are marked insecure, no security update should be
// required.
foreach ($pre_releases as $pre_release) {
$test_cases["Pre-release:$pre_release, no security update"] = [
'site_patch_version' => $pre_release,
'expected_security_releases' => [],
'expected_update_message_type' => $pre_release === '2.0-rc2' ? static::UPDATE_NONE : static::UPDATE_AVAILABLE,
'fixture' => 'sec.0.2-rc2-b',
];
}
// @todo In https://www.drupal.org/node/2865920 add test cases:
// - For all pre-releases for 8.2.0 except 8.2.0-rc2 using the
// 'sec.0.2-rc2' fixture to ensure that 8.2.0-rc2 is the only security
// update.
// - For 8.1.0 using fixture 'sec.0.2-rc2' to ensure that only security
// updates are 8.1.2 and 8.2.0-rc2.
return $test_cases;
}
/**
* Ensures proper results where there are date mismatches among modules.
*/
public function testDatestampMismatch() {
$system_info = [
'#all' => [
// We need to think we're running a -dev snapshot to see dates.
'version' => '8.1.0-dev',
'datestamp' => time(),
],
'block' => [
// This is 2001-09-09 01:46:40 GMT, so test for "2001-Sep-".
'datestamp' => '1000000000',
],
];
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(['drupal' => 'dev']);
$this->assertNoText(t('2001-Sep-'));
$this->assertText(t('Up to date'));
$this->assertNoText(t('Update available'));
$this->assertNoText(t('Security update required!'));
}
/**
* Checks that running cron updates the list of available updates.
*/
public function testModulePageRunCron() {
$this->setSystemInfo('8.0.0');
$this->config('update.settings')
->set('fetch.url', Url::fromRoute('update_test.update_test')->setAbsolute()->toString())
->save();
$this->config('update_test.settings')
->set('xml_map', ['drupal' => '0.0'])
->save();
$this->cronRun();
$this->drupalGet('admin/modules');
$this->assertNoText(t('No update information available.'));
}
/**
* Checks the messages at admin/modules when the site is up to date.
*/
public function testModulePageUpToDate() {
$this->setSystemInfo('8.0.0');
// Instead of using refreshUpdateStatus(), set these manually.
$this->config('update.settings')
->set('fetch.url', Url::fromRoute('update_test.update_test')->setAbsolute()->toString())
->save();
$this->config('update_test.settings')
->set('xml_map', ['drupal' => '0.0'])
->save();
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Check manually'));
$this->checkForMetaRefresh();
$this->assertText(t('Checked available update data for one project.'));
$this->drupalGet('admin/modules');
$this->assertNoText(t('There are updates available for your version of Drupal.'));
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
}
/**
* Checks the messages at admin/modules when an update is missing.
*/
public function testModulePageRegularUpdate() {
$this->setSystemInfo('8.0.0');
// Instead of using refreshUpdateStatus(), set these manually.
$this->config('update.settings')
->set('fetch.url', Url::fromRoute('update_test.update_test')->setAbsolute()->toString())
->save();
$this->config('update_test.settings')
->set('xml_map', ['drupal' => '0.1'])
->save();
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Check manually'));
$this->checkForMetaRefresh();
$this->assertText(t('Checked available update data for one project.'));
$this->drupalGet('admin/modules');
$this->assertText(t('There are updates available for your version of Drupal.'));
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
}
/**
* Checks the messages at admin/modules when a security update is missing.
*/
public function testModulePageSecurityUpdate() {
$this->setSystemInfo('8.0.0');
// Instead of using refreshUpdateStatus(), set these manually.
$this->config('update.settings')
->set('fetch.url', Url::fromRoute('update_test.update_test')->setAbsolute()->toString())
->save();
$this->config('update_test.settings')
->set('xml_map', ['drupal' => 'sec.0.2'])
->save();
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Check manually'));
$this->checkForMetaRefresh();
$this->assertText(t('Checked available update data for one project.'));
$this->drupalGet('admin/modules');
$this->assertNoText(t('There are updates available for your version of Drupal.'));
$this->assertText(t('There is a security update available for your version of Drupal.'));
// Make sure admin/appearance warns you you're missing a security update.
$this->drupalGet('admin/appearance');
$this->assertNoText(t('There are updates available for your version of Drupal.'));
$this->assertText(t('There is a security update available for your version of Drupal.'));
// Make sure duplicate messages don't appear on Update status pages.
$this->drupalGet('admin/reports/status');
// We're expecting "There is a security update..." inside the status report
// itself, but the message from
// \Drupal\Core\Messenger\MessengerInterface::addStatus() appears as an li
// so we can prefix with that and search for the raw HTML.
$this->assertNoRaw('<li>' . t('There is a security update available for your version of Drupal.'));
$this->drupalGet('admin/reports/updates');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
$this->drupalGet('admin/reports/updates/settings');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
}
/**
* Tests the Update Manager module when the update server returns 503 errors.
*/
public function testServiceUnavailable() {
$this->refreshUpdateStatus([], '503-error');
// Ensure that no "Warning: SimpleXMLElement..." parse errors are found.
$this->assertNoText('SimpleXMLElement');
$this->assertUniqueText(t('Failed to get available update data for one project.'));
}
/**
* Tests that exactly one fetch task per project is created and not more.
*/
public function testFetchTasks() {
$projecta = [
'name' => 'aaa_update_test',
];
$projectb = [
'name' => 'bbb_update_test',
];
$queue = \Drupal::queue('update_fetch_tasks');
$this->assertEqual($queue->numberOfItems(), 0, 'Queue is empty');
update_create_fetch_task($projecta);
$this->assertEqual($queue->numberOfItems(), 1, 'Queue contains one item');
update_create_fetch_task($projectb);
$this->assertEqual($queue->numberOfItems(), 2, 'Queue contains two items');
// Try to add project a again.
update_create_fetch_task($projecta);
$this->assertEqual($queue->numberOfItems(), 2, 'Queue still contains two items');
// Clear storage and try again.
update_storage_clear();
update_create_fetch_task($projecta);
$this->assertEqual($queue->numberOfItems(), 2, 'Queue contains two items');
}
/**
* Checks language module in core package at admin/reports/updates.
*/
public function testLanguageModuleUpdate() {
$this->setSystemInfo('8.0.0');
// Instead of using refreshUpdateStatus(), set these manually.
$this->config('update.settings')
->set('fetch.url', Url::fromRoute('update_test.update_test')->setAbsolute()->toString())
->save();
$this->config('update_test.settings')
->set('xml_map', ['drupal' => '0.1'])
->save();
$this->drupalGet('admin/reports/updates');
$this->assertText(t('Language'));
}
/**
* Ensures that the local actions appear.
*/
public function testLocalActions() {
$admin_user = $this->drupalCreateUser(['administer site configuration', 'administer modules', 'administer software updates', 'administer themes']);
$this->drupalLogin($admin_user);
$this->drupalGet('admin/modules');
$this->clickLink(t('Install new module'));
$this->assertUrl('admin/modules/install');
$this->drupalGet('admin/appearance');
$this->clickLink(t('Install new theme'));
$this->assertUrl('admin/theme/install');
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Install new module or theme'));
$this->assertUrl('admin/reports/updates/install');
}
}
<?php
namespace Drupal\Tests\update\Functional;
/**
* Tests the update_delete_file_if_stale() function.
*
* @group update
*/
class UpdateDeleteFileIfStaleTest extends UpdateTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['update'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
}
/**
* Tests the deletion of stale files.
*/
public function testUpdateDeleteFileIfStale() {
$file_name = file_unmanaged_save_data($this->randomMachineName());
$this->assertNotNull($file_name);
// During testing the file change and the stale checking occurs in the same
// request, so the beginning of request will be before the file changes and
// REQUEST_TIME - $filectime is negative. Set the maximum age to a number
// even smaller than that.
$this->config('system.file')
->set('temporary_maximum_age', -100000)
->save();
$file_path = \Drupal::service('file_system')->realpath($file_name);
update_delete_file_if_stale($file_path);
$this->assertFalse(is_file($file_path));
}
}
<?php
namespace Drupal\Tests\update\Functional;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
/**
* Defines some shared functions used by all update tests.
*
* The overarching methodology of these tests is we need to compare a given
* state of installed modules and themes (e.g., version, project grouping,
* timestamps, etc) against a current state of what the release history XML
* files we fetch say is available. We have dummy XML files (in the
* core/modules/update/tests directory) that describe various scenarios of
* what's available for different test projects, and we have dummy .info file
* data (specified via hook_system_info_alter() in the update_test helper
* module) describing what's currently installed. Each test case defines a set
* of projects to install, their current state (via the
* 'update_test_system_info' variable) and the desired available update data
* (via the 'update_test_xml_map' variable), and then performs a series of
* assertions that the report matches our expectations given the specific
* initial state and availability scenario.
*/
abstract class UpdateTestBase extends BrowserTestBase {
/**
* Denotes a security update will be required in the test case.
*/
const SECURITY_UPDATE_REQUIRED = 'SECURITY_UPDATE_REQUIRED';
/**
* Denotes an update will be available in the test case.
*/
const UPDATE_AVAILABLE = 'UPDATE_AVAILABLE';
/**
* Denotes no update will be available in the test case.
*/
const UPDATE_NONE = 'UPDATE_NONE';
protected function setUp() {
parent::setUp();
// Change the root path which Update Manager uses to install and update
// projects to be inside the testing site directory. See
// \Drupal\update\UpdateRootFactory::get() for equivalent changes to the
// test child site.
$request = \Drupal::request();
$update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request);
$this->container->set('update.root', $update_root);
\Drupal::setContainer($this->container);
// Create the directories within the root path within which the Update
// Manager will install projects.
foreach (drupal_get_updaters() as $updater_info) {
$updater = $updater_info['class'];
$install_directory = $update_root . '/' . $updater::getRootDirectoryRelativePath();
if (!is_dir($install_directory)) {
mkdir($install_directory);
}
}
}
/**
* Refreshes the update status based on the desired available update scenario.
*
* @param $xml_map
* Array that maps project names to availability scenarios to fetch. The key
* '#all' is used if a project-specific mapping is not defined.
* @param $url
* (optional) A string containing the URL to fetch update data from.
* Defaults to 'update-test'.
*
* @see \Drupal\update_test\Controller\UpdateTestController::updateTest()
*/
protected function refreshUpdateStatus($xml_map, $url = 'update-test') {
// Tell the Update Manager module to fetch from the URL provided by
// update_test module.
$this->config('update.settings')->set('fetch.url', Url::fromUri('base:' . $url, ['absolute' => TRUE])->toString())->save();
// Save the map for UpdateTestController::updateTest() to use.
$this->config('update_test.settings')->set('xml_map', $xml_map)->save();
// Manually check the update status.
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Check manually'));
$this->checkForMetaRefresh();
}
/**
* Runs a series of assertions that are applicable to all update statuses.
*/
protected function standardTests() {
$this->assertRaw('<h3>' . t('Drupal core') . '</h3>');
$this->assertRaw(\Drupal::l(t('Drupal'), Url::fromUri('http://example.com/project/drupal')), 'Link to the Drupal project appears.');
$this->assertNoText(t('No available releases found'));
}
/**
* Asserts the expected security updates are displayed correctly on the page.
*
* @param string $project_path_part
* The project path part needed for the download and release links.
* @param string[] $expected_security_releases
* The security releases, if any, that the status report should recommend.
* @param string $expected_update_message_type
* The type of update message expected.
* @param string $update_element_css_locator
* The CSS locator for the page element that contains the security updates.
*/
protected function assertSecurityUpdates($project_path_part, array $expected_security_releases, $expected_update_message_type, $update_element_css_locator) {
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
$this->standardTests();
$assert_session->elementTextNotContains('css', $update_element_css_locator, 'Not supported');
$all_security_release_urls = array_map(function ($link) {
return $link->getAttribute('href');
}, $page->findAll('css', "$update_element_css_locator .version-security a[href$='-release']"));
$all_security_download_urls = array_map(function ($link) {
return $link->getAttribute('href');
}, $page->findAll('css', "$update_element_css_locator .version-security a[href$='.tar.gz']"));
if ($expected_security_releases) {
$expected_download_urls = [];
$expected_release_urls = [];
if ($expected_update_message_type === static::SECURITY_UPDATE_REQUIRED) {
$assert_session->elementTextNotContains('css', $update_element_css_locator, 'Update available');
$assert_session->elementTextContains('css', $update_element_css_locator, 'Security update required!');
$assert_session->responseContains('error.svg', 'Error icon was found.');
}
else {
$assert_session->elementTextContains('css', $update_element_css_locator, 'Update available');
$assert_session->elementTextNotContains('css', $update_element_css_locator, 'Security update required!');
}
$assert_session->elementTextNotContains('css', $update_element_css_locator, 'Up to date');
foreach ($expected_security_releases as $expected_security_release) {
$expected_url_version = str_replace('.', '-', $expected_security_release);
$release_url = "http://example.com/$project_path_part-$expected_url_version-release";
$download_url = "http://example.com/$project_path_part-$expected_url_version.tar.gz";
$expected_release_urls[] = $release_url;
$expected_download_urls[] = $download_url;
// Ensure the expected links are security links.
$this->assertTrue(in_array($release_url, $all_security_release_urls), "Release $release_url is a security release link.");
$this->assertTrue(in_array($download_url, $all_security_download_urls), "Release $download_url is a security download link.");
$assert_session->linkByHrefExists($release_url);
$assert_session->linkByHrefExists($download_url);
}
// Ensure no other links are shown as security releases.
$this->assertEquals([], array_diff($all_security_release_urls, $expected_release_urls));
$this->assertEquals([], array_diff($all_security_download_urls, $expected_download_urls));
}
else {
// Ensure there were no security links.
$this->assertEquals([], $all_security_release_urls);
$this->assertEquals([], $all_security_download_urls);
$assert_session->pageTextNotContains('Security update required!');
if ($expected_update_message_type === static::UPDATE_AVAILABLE) {
$assert_session->elementTextContains('css', $update_element_css_locator, 'Update available');
$assert_session->elementTextNotContains('css', $update_element_css_locator, 'Up to date');
}
elseif ($expected_update_message_type === static::UPDATE_NONE) {
$assert_session->elementTextNotContains('css', $update_element_css_locator, 'Update available');
$assert_session->elementTextContains('css', $update_element_css_locator, 'Up to date');
}
else {
$this->fail('Unexpected value for $expected_update_message_type: ' . $expected_update_message_type);
}
}
}
}
<?php
namespace Drupal\Tests\update\Functional;
use Drupal\Core\Extension\InfoParserDynamic;
use Drupal\Core\Updater\Updater;
use Drupal\Core\Url;
use Drupal\Tests\TestFileCreationTrait;
/**
* Tests the Update Manager module's upload and extraction functionality.
*
* @group update
*/
class UpdateUploadTest extends UpdateTestBase {
use TestFileCreationTrait {
getTestFiles as drupalGetTestFiles;
}
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['update', 'update_test'];
protected function setUp() {
parent::setUp();
$admin_user = $this->drupalCreateUser(['administer modules', 'administer software updates', 'administer site configuration']);
$this->drupalLogin($admin_user);
}
/**
* Tests upload, extraction, and update of a module.
*/
public function testUploadModule() {
// Ensure that the update information is correct before testing.
update_get_available(TRUE);
// Images are not valid archives, so get one and try to install it. We
// need an extra variable to store the result of drupalGetTestFiles()
// since reset() takes an argument by reference and passing in a constant
// emits a notice in strict mode.
$imageTestFiles = $this->drupalGetTestFiles('image');
$invalidArchiveFile = reset($imageTestFiles);
$edit = [
'files[project_upload]' => $invalidArchiveFile->uri,
];
// This also checks that the correct archive extensions are allowed.
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
$this->assertText(t('Only files with the following extensions are allowed: @archive_extensions.', ['@archive_extensions' => archiver_get_extensions()]), 'Only valid archives can be uploaded.');
$this->assertUrl('admin/modules/install');
// Check to ensure an existing module can't be reinstalled. Also checks that
// the archive was extracted since we can't know if the module is already
// installed until after extraction.
$validArchiveFile = __DIR__ . '/../../aaa_update_test.tar.gz';
$edit = [
'files[project_upload]' => $validArchiveFile,
];
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
$this->assertText(t('@module_name is already installed.', ['@module_name' => 'AAA Update test']), 'Existing module was extracted and not reinstalled.');
$this->assertUrl('admin/modules/install');
// Ensure that a new module can be extracted and installed.
$updaters = drupal_get_updaters();
$moduleUpdater = $updaters['module']['class'];
$installedInfoFilePath = $this->container->get('update.root') . '/' . $moduleUpdater::getRootDirectoryRelativePath() . '/update_test_new_module/update_test_new_module.info.yml';
$this->assertFalse(file_exists($installedInfoFilePath), 'The new module does not exist in the filesystem before it is installed with the Update Manager.');
$validArchiveFile = __DIR__ . '/../../update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
$edit = [
'files[project_upload]' => $validArchiveFile,
];
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
// Check that submitting the form takes the user to authorize.php.
$this->assertUrl('core/authorize.php');
$this->assertTitle('Update manager | Drupal');
// Check for a success message on the page, and check that the installed
// module now exists in the expected place in the filesystem.
$this->assertRaw(t('Installed %project_name successfully', ['%project_name' => 'update_test_new_module']));
$this->assertTrue(file_exists($installedInfoFilePath), 'The new module exists in the filesystem after it is installed with the Update Manager.');
// Ensure the links are relative to the site root and not
// core/authorize.php.
$this->assertLink(t('Install another module'));
$this->assertLinkByHref(Url::fromRoute('update.module_install')->toString());
$this->assertLink(t('Enable newly added modules'));
$this->assertLinkByHref(Url::fromRoute('system.modules_list')->toString());
$this->assertLink(t('Administration pages'));
$this->assertLinkByHref(Url::fromRoute('system.admin')->toString());
// Ensure we can reach the "Install another module" link.
$this->clickLink(t('Install another module'));
$this->assertResponse(200);
$this->assertUrl('admin/modules/install');
// Check that the module has the correct version before trying to update
// it. Since the module is installed in sites/simpletest, which only the
// child site has access to, standard module API functions won't find it
// when called here. To get the version, the info file must be parsed
// directly instead.
$info_parser = new InfoParserDynamic();
$info = $info_parser->parse($installedInfoFilePath);
$this->assertEqual($info['version'], '8.x-1.0');
// Enable the module.
$this->drupalPostForm('admin/modules', ['modules[update_test_new_module][enable]' => TRUE], t('Install'));
// Define the update XML such that the new module downloaded above needs an
// update from 8.x-1.0 to 8.x-1.1.
$update_test_config = $this->config('update_test.settings');
$system_info = [
'update_test_new_module' => [
'project' => 'update_test_new_module',
],
];
$update_test_config->set('system_info', $system_info)->save();
$xml_mapping = [
'update_test_new_module' => '1_1',
];
$this->refreshUpdateStatus($xml_mapping);
// Run the updates for the new module.
$this->drupalPostForm('admin/reports/updates/update', ['projects[update_test_new_module]' => TRUE], t('Download these updates'));
$this->drupalPostForm(NULL, ['maintenance_mode' => FALSE], t('Continue'));
$this->assertText(t('Update was completed successfully.'));
$this->assertRaw(t('Installed %project_name successfully', ['%project_name' => 'update_test_new_module']));
// Parse the info file again to check that the module has been updated to
// 8.x-1.1.
$info = $info_parser->parse($installedInfoFilePath);
$this->assertEqual($info['version'], '8.x-1.1');
}
/**
* Ensures that archiver extensions are properly merged in the UI.
*/
public function testFileNameExtensionMerging() {
$this->drupalGet('admin/modules/install');
// Make sure the bogus extension supported by update_test.module is there.
$this->assertPattern('/file extensions are supported:.*update-test-extension/', "Found 'update-test-extension' extension.");
// Make sure it didn't clobber the first option from core.
$this->assertPattern('/file extensions are supported:.*tar/', "Found 'tar' extension.");
}
/**
* Checks the messages on update manager pages when missing a security update.
*/
public function testUpdateManagerCoreSecurityUpdateMessages() {
$setting = [
'#all' => [
'version' => '8.0.0',
],
];
$this->config('update_test.settings')
->set('system_info', $setting)
->set('xml_map', ['drupal' => '0.2-sec'])
->save();
$this->config('update.settings')
->set('fetch.url', Url::fromRoute('update_test.update_test')->setAbsolute()->toString())
->save();
// Initialize the update status.
$this->drupalGet('admin/reports/updates');
// Now, make sure none of the Update manager pages have duplicate messages
// about core missing a security update.
$this->drupalGet('admin/modules/install');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
$this->drupalGet('admin/modules/update');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
$this->drupalGet('admin/appearance/install');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
$this->drupalGet('admin/appearance/update');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
$this->drupalGet('admin/reports/updates/install');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
$this->drupalGet('admin/reports/updates/update');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
$this->drupalGet('admin/update/ready');
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
}
/**
* Tests only an *.info.yml file are detected without supporting files.
*/
public function testUpdateDirectory() {
$type = Updater::getUpdaterFromDirectory($this->root . '/core/modules/update/tests/modules/aaa_update_test');
$this->assertEqual($type, 'Drupal\\Core\\Updater\\Module', 'Detected a Module');
$type = Updater::getUpdaterFromDirectory($this->root . '/core/modules/update/tests/themes/update_test_basetheme');
$this->assertEqual($type, 'Drupal\\Core\\Updater\\Theme', 'Detected a Theme.');
}
}
<?php
namespace Drupal\Tests\update\Kernel\Migrate\d6;
use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to update.settings.yml.
*
* @group migrate_drupal_6
*/
class MigrateUpdateConfigsTest extends MigrateDrupal6TestBase {
use SchemaCheckTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['update'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('update_settings');
}
/**
* Tests migration of update variables to update.settings.yml.
*/
public function testUpdateSettings() {
$config = $this->config('update.settings');
$this->assertIdentical(2, $config->get('fetch.max_attempts'));
$this->assertIdentical('http://updates.drupal.org/release-history', $config->get('fetch.url'));
$this->assertIdentical('all', $config->get('notification.threshold'));
$this->assertIdentical([], $config->get('notification.emails'));
$this->assertIdentical(7, $config->get('check.interval_days'));
$this->assertConfigSchema(\Drupal::service('config.typed'), 'update.settings', $config->get());
}
}
<?php
namespace Drupal\Tests\update\Unit\Menu;
use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
/**
* Tests existence of update local tasks.
*
* @group update
*/
class UpdateLocalTasksTest extends LocalTaskIntegrationTestBase {
protected function setUp() {
$this->directoryList = ['update' => 'core/modules/update'];
parent::setUp();
}
/**
* Checks update report tasks.
*
* @dataProvider getUpdateReportRoutes
*/
public function testUpdateReportLocalTasks($route) {
$this->assertLocalTasks($route, [
0 => ['update.status', 'update.settings', 'update.report_update'],
]);
}
/**
* Provides a list of report routes to test.
*/
public function getUpdateReportRoutes() {
return [
['update.status'],
['update.settings'],
['update.report_update'],
];
}
/**
* Checks update module tasks.
*
* @dataProvider getUpdateModuleRoutes
*/
public function testUpdateModuleLocalTasks($route) {
$this->assertLocalTasks($route, [
0 => ['update.module_update'],
]);
;
}
/**
* Provides a list of module routes to test.
*/
public function getUpdateModuleRoutes() {
return [
['update.module_update'],
];
}
/**
* Checks update theme tasks.
*
* @dataProvider getUpdateThemeRoutes
*/
public function testUpdateThemeLocalTasks($route) {
$this->assertLocalTasks($route, [
0 => ['update.theme_update'],
]);
;
}
/**
* Provides a list of theme routes to test.
*/
public function getUpdateThemeRoutes() {
return [
['update.theme_update'],
];
}
}
<?php
namespace Drupal\Tests\update\Unit;
use Drupal\Tests\UnitTestCase;
use Drupal\update\UpdateFetcher;
if (!defined('DRUPAL_CORE_COMPATIBILITY')) {
define('DRUPAL_CORE_COMPATIBILITY', '8.x');
}
/**
* Tests update functionality unrelated to the database.
*
* @group update
*/
class UpdateFetcherTest extends UnitTestCase {
/**
* The update fetcher to use.
*
* @var \Drupal\update\UpdateFetcher
*/
protected $updateFetcher;
/**
* {@inheritdoc}
*/
protected function setUp() {
$config_factory = $this->getConfigFactoryStub(['update.settings' => ['fetch_url' => 'http://www.example.com']]);
$http_client_mock = $this->createMock('\GuzzleHttp\ClientInterface');
$this->updateFetcher = new UpdateFetcher($config_factory, $http_client_mock);
}
/**
* Tests that buildFetchUrl() builds the URL correctly.
*
* @param array $project
* A keyed array of project information matching results from
* \Drupal\Update\UpdateManager::getProjects().
* @param string $site_key
* A string to mimic an anonymous site key hash.
* @param string $expected
* The expected url returned from UpdateFetcher::buildFetchUrl()
*
* @dataProvider providerTestUpdateBuildFetchUrl
*
* @see \Drupal\update\UpdateFetcher::buildFetchUrl()
*/
public function testUpdateBuildFetchUrl(array $project, $site_key, $expected) {
$url = $this->updateFetcher->buildFetchUrl($project, $site_key);
$this->assertEquals($url, $expected);
}
/**
* Provide test data for self::testUpdateBuildFetchUrl().
*
* @return array
* An array of arrays, each containing:
* - 'project' - An array matching a project's .info file structure.
* - 'site_key' - An arbitrary site key.
* - 'expected' - The expected url from UpdateFetcher::buildFetchUrl().
*/
public function providerTestUpdateBuildFetchUrl() {
$data = [];
// First test that we didn't break the trivial case.
$project['name'] = 'update_test';
$project['project_type'] = '';
$project['info']['version'] = '';
$project['info']['project status url'] = 'http://www.example.com';
$project['includes'] = ['module1' => 'Module 1', 'module2' => 'Module 2'];
$site_key = '';
$expected = 'http://www.example.com/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY;
$data[] = [$project, $site_key, $expected];
// For disabled projects it shouldn't add the site key either.
$site_key = 'site_key';
$project['project_type'] = 'disabled';
$expected = 'http://www.example.com/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY;
$data[] = [$project, $site_key, $expected];
// For enabled projects, test adding the site key.
$project['project_type'] = '';
$expected = 'http://www.example.com/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY;
$expected .= '?site_key=site_key';
$expected .= '&list=' . rawurlencode('module1,module2');
$data[] = [$project, $site_key, $expected];
// Test when the URL contains a question mark.
$project['info']['project status url'] = 'http://www.example.com/?project=';
$expected = 'http://www.example.com/?project=/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY;
$expected .= '&site_key=site_key';
$expected .= '&list=' . rawurlencode('module1,module2');
$data[] = [$project, $site_key, $expected];
return $data;
}
}
name: 'Update test base theme'
type: theme
description: 'Test theme which acts as a base theme for other test subthemes.'
# version: VERSION
# core: 8.x
# Information added by Drupal.org packaging script on 2018-09-10
version: '8.6.1'
core: '8.x'
project: 'drupal'
datestamp: 1536585833
name: 'Update test subtheme'
type: theme
description: 'Test theme which uses update_test_basetheme as the base theme.'
# version: VERSION
# core: 8.x
base theme: update_test_basetheme
# Information added by Drupal.org packaging script on 2018-09-10
version: '8.6.1'
core: '8.x'
project: 'drupal'
datestamp: 1536585833
<?php
/**
* @file
* Hooks provided by the Update Manager module.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Alter the list of projects before fetching data and comparing versions.
*
* Most modules will never need to implement this hook. It is for advanced
* interaction with the Update Manager module. The primary use-case for this
* hook is to add projects to the list; for example, to provide update status
* data on disabled modules and themes. A contributed module might want to hide
* projects from the list; for example, if there is a site-specific module that
* doesn't have any official releases, that module could remove itself from this
* list to avoid "No available releases found" warnings on the available updates
* report. In rare cases, a module might want to alter the data associated with
* a project already in the list.
*
* @param $projects
* Reference to an array of the projects installed on the system. This
* includes all the metadata documented in the comments below for each project
* (either module or theme) that is currently enabled. The array is initially
* populated inside \Drupal\Update\UpdateManager::getProjects() with the help
* of \Drupal\Core\Utility\ProjectInfo->processInfoList(), so look there for
* examples of how to populate the array with real values.
*
* @see \Drupal\Update\UpdateManager::getProjects()
* @see \Drupal\Core\Utility\ProjectInfo::processInfoList()
*/
function hook_update_projects_alter(&$projects) {
// Hide a site-specific module from the list.
unset($projects['site_specific_module']);
// Add a disabled module to the list.
// The key for the array should be the machine-readable project "short name".
$projects['disabled_project_name'] = [
// Machine-readable project short name (same as the array key above).
'name' => 'disabled_project_name',
// Array of values from the main .info.yml file for this project.
'info' => [
'name' => 'Some disabled module',
'description' => 'A module not enabled on the site that you want to see in the available updates report.',
'version' => '8.x-1.0',
'core' => '8.x',
// The maximum file change time (the "ctime" returned by the filectime()
// PHP method) for all of the .info.yml files included in this project.
'_info_file_ctime' => 1243888165,
],
// The date stamp when the project was released, if known. If the disabled
// project was an officially packaged release from drupal.org, this will
// be included in the .info.yml file as the 'datestamp' field. This only
// really matters for development snapshot releases that are regenerated,
// so it can be left undefined or set to 0 in most cases.
'datestamp' => 1243888185,
// Any modules (or themes) included in this project. Keyed by machine-
// readable "short name", value is the human-readable project name printed
// in the UI.
'includes' => [
'disabled_project' => 'Disabled module',
'disabled_project_helper' => 'Disabled module helper module',
'disabled_project_foo' => 'Disabled module foo add-on module',
],
// Does this project contain a 'module', 'theme', 'disabled-module', or
// 'disabled-theme'?
'project_type' => 'disabled-module',
];
}
/**
* Alter the information about available updates for projects.
*
* @param $projects
* Reference to an array of information about available updates to each
* project installed on the system.
*
* @see update_calculate_project_data()
*/
function hook_update_status_alter(&$projects) {
$settings = \Drupal::config('update_advanced.settings')->get('projects');
foreach ($projects as $project => $project_info) {
if (isset($settings[$project]) && isset($settings[$project]['check']) &&
($settings[$project]['check'] == 'never' ||
(isset($project_info['recommended']) &&
$settings[$project]['check'] === $project_info['recommended']))) {
$projects[$project]['status'] = UPDATE_NOT_CHECKED;
$projects[$project]['reason'] = t('Ignored from settings');
if (!empty($settings[$project]['notes'])) {
$projects[$project]['extra'][] = [
'class' => ['admin-note'],
'label' => t('Administrator note'),
'data' => $settings[$project]['notes'],
];
}
}
}
}
/**
* Verify an archive after it has been downloaded and extracted.
*
* @param string $project
* The short name of the project that has been downloaded.
* @param string $archive_file
* The filename of the unextracted archive.
* @param string $directory
* The directory that the archive was extracted into.
*
* @return
* If there are any problems, return an array of error messages. If there are
* no problems, return an empty array.
*
* @see update_manager_archive_verify()
* @ingroup update_manager_file
*/
function hook_verify_update_archive($project, $archive_file, $directory) {
$errors = [];
if (!file_exists($directory)) {
$errors[] = t('The %directory does not exist.', ['%directory' => $directory]);
}
// Add other checks on the archive integrity here.
return $errors;
}
/**
* @} End of "addtogroup hooks".
*/
<?php
/**
* @file
* Callbacks and related functions invoked by authorize.php to update projects.
*
* We use the Batch API to actually update each individual project on the site.
* All of the code in this file is run at a low bootstrap level (modules are not
* loaded), so these functions cannot assume access to the rest of the code of
* the Update Manager module.
*/
use Drupal\Core\Updater\UpdaterException;
use Drupal\Core\Url;
/**
* Updates existing projects when invoked by authorize.php.
*
* Callback for system_authorized_init() in
* update_manager_update_ready_form_submit().
*
* @param $filetransfer
* The FileTransfer object created by authorize.php for use during this
* operation.
* @param $projects
* A nested array of projects to install into the live webroot, keyed by
* project name. Each subarray contains the following keys:
* - project: The canonical project short name.
* - updater_name: The name of the Drupal\Core\Updater\Updater class to use
* for this project.
* - local_url: The locally installed location of new code to update with.
*
* @return \Symfony\Component\HttpFoundation\Response|null
* The result of processing the batch that updates the projects. If this is
* an instance of \Symfony\Component\HttpFoundation\Response the calling code
* should use that response for the current page request.
*/
function update_authorize_run_update($filetransfer, $projects) {
$operations = [];
foreach ($projects as $project_info) {
$operations[] = [
'update_authorize_batch_copy_project',
[
$project_info['project'],
$project_info['updater_name'],
$project_info['local_url'],
$filetransfer,
],
];
}
$batch = [
'init_message' => t('Preparing to update your site'),
'operations' => $operations,
'finished' => 'update_authorize_update_batch_finished',
'file' => drupal_get_path('module', 'update') . '/update.authorize.inc',
];
batch_set($batch);
// Since authorize.php has its own method for setting the page title, set it
// manually here rather than passing it in to batch_set() as would normally
// be done.
$_SESSION['authorize_page_title'] = t('Installing updates');
// Invoke the batch via authorize.php.
return system_authorized_batch_process();
}
/**
* Installs a new project when invoked by authorize.php.
*
* Callback for system_authorized_init() in
* update_manager_install_form_submit().
*
* @param FileTransfer $filetransfer
* The FileTransfer object created by authorize.php for use during this
* operation.
* @param string $project
* The canonical project short name; i.e., the name of the module, theme, or
* profile.
* @param string $updater_name
* The name of the Drupal\Core\Updater\Updater class to use for installing
* this project.
* @param string $local_url
* The URL to the locally installed temp directory where the project has
* already been downloaded and extracted into.
*
* @return \Symfony\Component\HttpFoundation\Response|null
* The result of processing the batch that installs the project. If this is
* an instance of \Symfony\Component\HttpFoundation\Response the calling code
* should use that response for the current page request.
*/
function update_authorize_run_install($filetransfer, $project, $updater_name, $local_url) {
$operations[] = [
'update_authorize_batch_copy_project',
[
$project,
$updater_name,
$local_url,
$filetransfer,
],
];
// @todo Instantiate our Updater to set the human-readable title?
$batch = [
'init_message' => t('Preparing to install'),
'operations' => $operations,
// @todo Use a different finished callback for different messages?
'finished' => 'update_authorize_install_batch_finished',
'file' => drupal_get_path('module', 'update') . '/update.authorize.inc',
];
batch_set($batch);
// Since authorize.php has its own method for setting the page title, set it
// manually here rather than passing it in to batch_set() as would normally
// be done.
$_SESSION['authorize_page_title'] = t('Installing %project', ['%project' => $project]);
// Invoke the batch via authorize.php.
return system_authorized_batch_process();
}
/**
* Implements callback_batch_operation().
*
* Copies project to its proper place when authorized to do so.
*
* @param string $project
* The canonical short name of the project being installed.
* @param string $updater_name
* The name of the Drupal\Core\Updater\Updater class to use for installing
* this project.
* @param string $local_url
* The URL to the locally installed temp directory where the project has
* already been downloaded and extracted into.
* @param FileTransfer $filetransfer
* The FileTransfer object to use for performing this operation.
* @param array $context
* Reference to an array used for Batch API storage.
*/
function update_authorize_batch_copy_project($project, $updater_name, $local_url, $filetransfer, &$context) {
// Initialize some variables in the Batch API $context array.
if (!isset($context['results']['log'])) {
$context['results']['log'] = [];
}
if (!isset($context['results']['log'][$project])) {
$context['results']['log'][$project] = [];
}
if (!isset($context['results']['tasks'])) {
$context['results']['tasks'] = [];
}
// The batch API uses a session, and since all the arguments are serialized
// and unserialized between requests, although the FileTransfer object itself
// will be reconstructed, the connection pointer itself will be lost. However,
// the FileTransfer object will still have the connection variable, even
// though the connection itself is now gone. So, although it's ugly, we have
// to unset the connection variable at this point so that the FileTransfer
// object will re-initiate the actual connection.
unset($filetransfer->connection);
if (!empty($context['results']['log'][$project]['#abort'])) {
$context['finished'] = 1;
return;
}
$updater = new $updater_name($local_url, \Drupal::getContainer()->get('update.root'));
try {
if ($updater->isInstalled()) {
// This is an update.
$tasks = $updater->update($filetransfer);
}
else {
$tasks = $updater->install($filetransfer);
}
}
catch (UpdaterException $e) {
_update_batch_create_message($context['results']['log'][$project], t('Error installing / updating'), FALSE);
_update_batch_create_message($context['results']['log'][$project], $e->getMessage(), FALSE);
$context['results']['log'][$project]['#abort'] = TRUE;
return;
}
_update_batch_create_message($context['results']['log'][$project], t('Installed %project_name successfully', ['%project_name' => $project]));
if (!empty($tasks)) {
$context['results']['tasks'] += $tasks;
}
// This particular operation is now complete, even though the batch might
// have other operations to perform.
$context['finished'] = 1;
}
/**
* Batch callback: Performs actions when the authorized update batch is done.
*
* This processes the results and stashes them into SESSION such that
* authorize.php will render a report. Also responsible for putting the site
* back online and clearing the update status storage after a successful update.
*
* @param $success
* TRUE if the batch operation was successful; FALSE if there were errors.
* @param $results
* An associative array of results from the batch operation.
*/
function update_authorize_update_batch_finished($success, $results) {
foreach ($results['log'] as $messages) {
if (!empty($messages['#abort'])) {
$success = FALSE;
}
}
$offline = \Drupal::state()->get('system.maintenance_mode');
if ($success) {
// Now that the update completed, we need to clear the available update data
// and recompute our status, so prevent show bogus results.
_update_authorize_clear_update_status();
// Take the site out of maintenance mode if it was previously that way.
if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
\Drupal::state()->set('system.maintenance_mode', FALSE);
$page_message = [
'message' => t('Update was completed successfully. Your site has been taken out of maintenance mode.'),
'type' => 'status',
];
}
else {
$page_message = [
'message' => t('Update was completed successfully.'),
'type' => 'status',
];
}
}
elseif (!$offline) {
$page_message = [
'message' => t('Update failed! See the log below for more information.'),
'type' => 'error',
];
}
else {
$page_message = [
'message' => t('Update failed! See the log below for more information. Your site is still in maintenance mode.'),
'type' => 'error',
];
}
// Since we're doing an update of existing code, always add a task for
// running update.php.
$url = Url::fromRoute('system.db_update');
$results['tasks'][] = t('Your modules have been downloaded and updated.');
$results['tasks'][] = [
'#type' => 'link',
'#url' => $url,
'#title' => t('Run database updates'),
// Since this is being called outsite of the primary front controller,
// the base_url needs to be set explicitly to ensure that links are
// relative to the site root.
// @todo Simplify with https://www.drupal.org/node/2548095
'#options' => [
'absolute' => TRUE,
'base_url' => $GLOBALS['base_url'],
],
'#access' => $url->access(\Drupal::currentUser()),
];
// Unset the variable since it is no longer needed.
unset($_SESSION['maintenance_mode']);
// Set all these values into the SESSION so authorize.php can display them.
$_SESSION['authorize_results']['success'] = $success;
$_SESSION['authorize_results']['page_message'] = $page_message;
$_SESSION['authorize_results']['messages'] = $results['log'];
$_SESSION['authorize_results']['tasks'] = $results['tasks'];
$_SESSION['authorize_page_title'] = t('Update manager');
}
/**
* Implements callback_batch_finished().
*
* Performs actions when the authorized install batch is done.
*
* This processes the results and stashes them into SESSION such that
* authorize.php will render a report. Also responsible for putting the site
* back online after a successful install if necessary.
*
* @param $success
* TRUE if the batch operation was a success; FALSE if there were errors.
* @param $results
* An associative array of results from the batch operation.
*/
function update_authorize_install_batch_finished($success, $results) {
foreach ($results['log'] as $messages) {
if (!empty($messages['#abort'])) {
$success = FALSE;
}
}
$offline = \Drupal::state()->get('system.maintenance_mode');
if ($success) {
// Take the site out of maintenance mode if it was previously that way.
if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
\Drupal::state()->set('system.maintenance_mode', FALSE);
$page_message = [
'message' => t('Installation was completed successfully. Your site has been taken out of maintenance mode.'),
'type' => 'status',
];
}
else {
$page_message = [
'message' => t('Installation was completed successfully.'),
'type' => 'status',
];
}
}
elseif (!$success && !$offline) {
$page_message = [
'message' => t('Installation failed! See the log below for more information.'),
'type' => 'error',
];
}
else {
$page_message = [
'message' => t('Installation failed! See the log below for more information. Your site is still in maintenance mode.'),
'type' => 'error',
];
}
// Unset the variable since it is no longer needed.
unset($_SESSION['maintenance_mode']);
// Set all these values into the SESSION so authorize.php can display them.
$_SESSION['authorize_results']['success'] = $success;
$_SESSION['authorize_results']['page_message'] = $page_message;
$_SESSION['authorize_results']['messages'] = $results['log'];
$_SESSION['authorize_results']['tasks'] = $results['tasks'];
$_SESSION['authorize_page_title'] = t('Update manager');
}
/**
* Creates a structure of log messages.
*
* @param array $project_results
* An associative array of results from the batch operation.
* @param string $message
* A string containing a log message.
* @param bool $success
* (optional) TRUE if the operation the message is about was a success, FALSE
* if there were errors. Defaults to TRUE.
*/
function _update_batch_create_message(&$project_results, $message, $success = TRUE) {
$project_results[] = ['message' => $message, 'success' => $success];
}
/**
* Clears available update status data.
*
* Since this function is run at such a low bootstrap level, the Update Manager
* module is not loaded. So, we can't just call update_storage_clear(). However,
* the key-value backend is available, so we just call that.
*
* Note that we do not want to delete items related to currently pending fetch
* attempts.
*
* @see update_authorize_update_batch_finished()
* @see update_storage_clear()
*/
function _update_authorize_clear_update_status() {
\Drupal::keyValueExpirable('update')->deleteAll();
\Drupal::keyValueExpirable('update_available_release')->deleteAll();
}
<?php
/**
* @file
* Code required only when comparing available updates to existing data.
*/
/**
* Determines version and type information for currently installed projects.
*
* Processes the list of projects on the system to figure out the currently
* installed versions, and other information that is required before we can
* compare against the available releases to produce the status report.
*
* @param $projects
* Array of project information from
* \Drupal\Update\UpdateManager::getProjects().
*/
function update_process_project_info(&$projects) {
foreach ($projects as $key => $project) {
// Assume an official release until we see otherwise.
$install_type = 'official';
$info = $project['info'];
if (isset($info['version'])) {
// Check for development snapshots
if (preg_match('@(dev|HEAD)@', $info['version'])) {
$install_type = 'dev';
}
// Figure out what the currently installed major version is. We need
// to handle both contribution (e.g. "5.x-1.3", major = 1) and core
// (e.g. "5.1", major = 5) version strings.
$matches = [];
if (preg_match('/^(\d+\.x-)?(\d+)\..*$/', $info['version'], $matches)) {
$info['major'] = $matches[2];
}
elseif (!isset($info['major'])) {
// This would only happen for version strings that don't follow the
// drupal.org convention. We let contribs define "major" in their
// .info.yml in this case, and only if that's missing would we hit this.
$info['major'] = -1;
}
}
else {
// No version info available at all.
$install_type = 'unknown';
$info['version'] = t('Unknown');
$info['major'] = -1;
}
// Finally, save the results we care about into the $projects array.
$projects[$key]['existing_version'] = $info['version'];
$projects[$key]['existing_major'] = $info['major'];
$projects[$key]['install_type'] = $install_type;
}
}
/**
* 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 store the results. 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.
*
* @param array $available
* Data about available project releases.
*
* @return
* An array of installed projects with current update status information.
*
* @see update_get_available()
* @see \Drupal\Update\UpdateManager::getProjects()
* @see update_process_project_info()
* @see \Drupal\update\UpdateManagerInterface::projectStorage()
*/
function update_calculate_project_data($available) {
// Retrieve the projects from storage, if present.
$projects = \Drupal::service('update.manager')->projectStorage('update_project_data');
// If $projects is empty, then the data must be rebuilt.
// Otherwise, return the data and skip the rest of the function.
if (!empty($projects)) {
return $projects;
}
$projects = \Drupal::service('update.manager')->getProjects();
update_process_project_info($projects);
foreach ($projects as $project => $project_info) {
if (isset($available[$project])) {
update_calculate_project_update_status($projects[$project], $available[$project]);
}
else {
$projects[$project]['status'] = UPDATE_UNKNOWN;
$projects[$project]['reason'] = t('No available releases found');
}
}
// Give other modules a chance to alter the status (for example, to allow a
// contrib module to provide fine-grained settings to ignore specific
// projects or releases).
\Drupal::moduleHandler()->alter('update_status', $projects);
// Store the site's update status for at most 1 hour.
\Drupal::keyValueExpirable('update')->setWithExpire('update_project_data', $projects, 3600);
return $projects;
}
/**
* Calculates the current update status of a specific project.
*
* This function is the heart of the update status feature. For each project it
* is invoked with, it first checks if the project has been flagged with a
* special status like "unsupported" or "insecure", or if the project node
* itself has been unpublished. In any of those cases, the project is marked
* with an error and the next project is considered.
*
* If the project itself is valid, the function decides what major release
* series to consider. The project defines what the currently supported major
* versions are for each version of core, so the first step is to make sure the
* current version is still supported. If so, that's the target version. If the
* current version is unsupported, the project maintainer's recommended major
* version is used. There's also a check to make sure that this function never
* recommends an earlier release than the currently installed major version.
*
* Given a target major version, the available releases are scanned looking for
* the specific release to recommend (avoiding beta releases and development
* snapshots if possible). For the target major version, the highest patch level
* is found. If there is a release at that patch level with no extra ("beta",
* etc.), then the release at that patch level with the most recent release date
* is recommended. If every release at that patch level has extra (only betas),
* then the latest release from the previous patch level is recommended. For
* example:
*
* - 1.6-bugfix <-- recommended version because 1.6 already exists.
* - 1.6
*
* or
*
* - 1.6-beta
* - 1.5 <-- recommended version because no 1.6 exists.
* - 1.4
*
* Also, the latest release from the same major version is looked for, even beta
* releases, to display to the user as the "Latest version" option.
* Additionally, the latest official release from any higher major versions that
* have been released is searched for to provide a set of "Also available"
* options.
*
* Finally, and most importantly, the release history continues to be scanned
* until the currently installed release is reached, searching for anything
* marked as a security update. If any security updates have been found between
* the recommended release and the installed version, all of the releases that
* included a security fix are recorded so that the site administrator can be
* warned their site is insecure, and links pointing to the release notes for
* each security update can be included (which, in turn, will link to the
* official security announcements for each vulnerability).
*
* This function relies on the fact that the .xml release history data comes
* sorted based on major version and patch level, then finally by release date
* if there are multiple releases such as betas from the same major.patch
* version (e.g., 5.x-1.5-beta1, 5.x-1.5-beta2, and 5.x-1.5). Development
* snapshots for a given major version are always listed last.
*
* @param $project_data
* An array containing information about a specific project.
* @param $available
* Data about available project releases of a specific project.
*/
function update_calculate_project_update_status(&$project_data, $available) {
foreach (['title', 'link'] as $attribute) {
if (!isset($project_data[$attribute]) && isset($available[$attribute])) {
$project_data[$attribute] = $available[$attribute];
}
}
// If the project status is marked as something bad, there's nothing else
// to consider.
if (isset($available['project_status'])) {
switch ($available['project_status']) {
case 'insecure':
$project_data['status'] = UPDATE_NOT_SECURE;
if (empty($project_data['extra'])) {
$project_data['extra'] = [];
}
$project_data['extra'][] = [
'label' => t('Project not secure'),
'data' => t('This project has been labeled insecure by the Drupal security team, and is no longer available for download. Immediately disabling everything included by this project is strongly recommended!'),
];
break;
case 'unpublished':
case 'revoked':
$project_data['status'] = UPDATE_REVOKED;
if (empty($project_data['extra'])) {
$project_data['extra'] = [];
}
$project_data['extra'][] = [
'label' => t('Project revoked'),
'data' => t('This project has been revoked, and is no longer available for download. Disabling everything included by this project is strongly recommended!'),
];
break;
case 'unsupported':
$project_data['status'] = UPDATE_NOT_SUPPORTED;
if (empty($project_data['extra'])) {
$project_data['extra'] = [];
}
$project_data['extra'][] = [
'label' => t('Project not supported'),
'data' => t('This project is no longer supported, and is no longer available for download. Disabling everything included by this project is strongly recommended!'),
];
break;
case 'not-fetched':
$project_data['status'] = UPDATE_NOT_FETCHED;
$project_data['reason'] = t('Failed to get available update data.');
break;
default:
// Assume anything else (e.g. 'published') is valid and we should
// perform the rest of the logic in this function.
break;
}
}
if (!empty($project_data['status'])) {
// We already know the status for this project, so there's nothing else to
// compute. Record the project status into $project_data and we're done.
$project_data['project_status'] = $available['project_status'];
return;
}
// Figure out the target major version.
$existing_major = $project_data['existing_major'];
$supported_majors = [];
if (isset($available['supported_majors'])) {
$supported_majors = explode(',', $available['supported_majors']);
}
elseif (isset($available['default_major'])) {
// Older release history XML file without supported or recommended.
$supported_majors[] = $available['default_major'];
}
if (in_array($existing_major, $supported_majors)) {
// Still supported, stay at the current major version.
$target_major = $existing_major;
}
elseif (isset($available['recommended_major'])) {
// Since 'recommended_major' is defined, we know this is the new XML
// format. Therefore, we know the current release is unsupported since
// its major version was not in the 'supported_majors' list. We should
// find the best release from the recommended major version.
$target_major = $available['recommended_major'];
$project_data['status'] = UPDATE_NOT_SUPPORTED;
}
elseif (isset($available['default_major'])) {
// Older release history XML file without recommended, so recommend
// the currently defined "default_major" version.
$target_major = $available['default_major'];
}
else {
// Malformed XML file? Stick with the current version.
$target_major = $existing_major;
}
// Make sure we never tell the admin to downgrade. If we recommended an
// earlier version than the one they're running, they'd face an
// impossible data migration problem, since Drupal never supports a DB
// downgrade path. In the unfortunate case that what they're running is
// unsupported, and there's nothing newer for them to upgrade to, we
// can't print out a "Recommended version", but just have to tell them
// what they have is unsupported and let them figure it out.
$target_major = max($existing_major, $target_major);
$release_patch_changed = '';
$patch = '';
// If the project is marked as UPDATE_FETCH_PENDING, it means that the
// data we currently have (if any) is stale, and we've got a task queued
// up to (re)fetch the data. In that case, we mark it as such, merge in
// whatever data we have (e.g. project title and link), and move on.
if (!empty($available['fetch_status']) && $available['fetch_status'] == UPDATE_FETCH_PENDING) {
$project_data['status'] = UPDATE_FETCH_PENDING;
$project_data['reason'] = t('No available update data');
$project_data['fetch_status'] = $available['fetch_status'];
return;
}
// Defend ourselves from XML history files that contain no releases.
if (empty($available['releases'])) {
$project_data['status'] = UPDATE_UNKNOWN;
$project_data['reason'] = t('No available releases found');
return;
}
foreach ($available['releases'] as $version => $release) {
// First, if this is the existing release, check a few conditions.
if ($project_data['existing_version'] === $version) {
if (isset($release['terms']['Release type']) &&
in_array('Insecure', $release['terms']['Release type'])) {
$project_data['status'] = UPDATE_NOT_SECURE;
}
elseif ($release['status'] == 'unpublished') {
$project_data['status'] = UPDATE_REVOKED;
if (empty($project_data['extra'])) {
$project_data['extra'] = [];
}
$project_data['extra'][] = [
'class' => ['release-revoked'],
'label' => t('Release revoked'),
'data' => t('Your currently installed release has been revoked, and is no longer available for download. Disabling everything included in this release or upgrading is strongly recommended!'),
];
}
elseif (isset($release['terms']['Release type']) &&
in_array('Unsupported', $release['terms']['Release type'])) {
$project_data['status'] = UPDATE_NOT_SUPPORTED;
if (empty($project_data['extra'])) {
$project_data['extra'] = [];
}
$project_data['extra'][] = [
'class' => ['release-not-supported'],
'label' => t('Release not supported'),
'data' => t('Your currently installed release is now unsupported, and is no longer available for download. Disabling everything included in this release or upgrading is strongly recommended!'),
];
}
}
// Otherwise, ignore unpublished, insecure, or unsupported releases.
if ($release['status'] == 'unpublished' ||
(isset($release['terms']['Release type']) &&
(in_array('Insecure', $release['terms']['Release type']) ||
in_array('Unsupported', $release['terms']['Release type'])))) {
continue;
}
// See if this is a higher major version than our target and yet still
// supported. If so, record it as an "Also available" release.
// Note: Some projects have a HEAD release from CVS days, which could
// be one of those being compared. They would not have version_major
// set, so we must call isset first.
if (isset($release['version_major']) && $release['version_major'] > $target_major) {
if (in_array($release['version_major'], $supported_majors)) {
if (!isset($project_data['also'])) {
$project_data['also'] = [];
}
if (!isset($project_data['also'][$release['version_major']])) {
$project_data['also'][$release['version_major']] = $version;
$project_data['releases'][$version] = $release;
}
}
// Otherwise, this release can't matter to us, since it's neither
// from the release series we're currently using nor the recommended
// release. We don't even care about security updates for this
// branch, since if a project maintainer puts out a security release
// at a higher major version and not at the lower major version,
// they must remove the lower version from the supported major
// versions at the same time, in which case we won't hit this code.
continue;
}
// Look for the 'latest version' if we haven't found it yet. Latest is
// defined as the most recent version for the target major version.
if (!isset($project_data['latest_version'])
&& $release['version_major'] == $target_major) {
$project_data['latest_version'] = $version;
$project_data['releases'][$version] = $release;
}
// Look for the development snapshot release for this branch.
if (!isset($project_data['dev_version'])
&& $release['version_major'] == $target_major
&& isset($release['version_extra'])
&& $release['version_extra'] == 'dev') {
$project_data['dev_version'] = $version;
$project_data['releases'][$version] = $release;
}
// Look for the 'recommended' version if we haven't found it yet (see
// phpdoc at the top of this function for the definition).
if (!isset($project_data['recommended'])
&& $release['version_major'] == $target_major
&& isset($release['version_patch'])) {
if ($patch != $release['version_patch']) {
$patch = $release['version_patch'];
$release_patch_changed = $release;
}
if (empty($release['version_extra']) && $patch == $release['version_patch']) {
$project_data['recommended'] = $release_patch_changed['version'];
$project_data['releases'][$release_patch_changed['version']] = $release_patch_changed;
}
}
// Stop searching once we hit the currently installed version.
if ($project_data['existing_version'] === $version) {
break;
}
// If we're running a dev snapshot and have a timestamp, stop
// searching for security updates once we hit an official release
// older than what we've got. Allow 100 seconds of leeway to handle
// differences between the datestamp in the .info.yml file and the
// timestamp of the tarball itself (which are usually off by 1 or 2
// seconds) so that we don't flag that as a new release.
if ($project_data['install_type'] == 'dev') {
if (empty($project_data['datestamp'])) {
// We don't have current timestamp info, so we can't know.
continue;
}
elseif (isset($release['date']) && ($project_data['datestamp'] + 100 > $release['date'])) {
// We're newer than this, so we can skip it.
continue;
}
}
// See if this release is a security update.
if (isset($release['terms']['Release type'])
&& in_array('Security update', $release['terms']['Release type'])) {
$project_data['security updates'][] = $release;
}
}
// If we were unable to find a recommended version, then make the latest
// version the recommended version if possible.
if (!isset($project_data['recommended']) && isset($project_data['latest_version'])) {
$project_data['recommended'] = $project_data['latest_version'];
}
if (isset($project_data['status'])) {
// If we already know the status, we're done.
return;
}
// If we don't know what to recommend, there's nothing we can report.
// Bail out early.
if (!isset($project_data['recommended'])) {
$project_data['status'] = UPDATE_UNKNOWN;
$project_data['reason'] = t('No available releases found');
return;
}
// If we're running a dev snapshot, compare the date of the dev snapshot
// with the latest official version, and record the absolute latest in
// 'latest_dev' so we can correctly decide if there's a newer release
// than our current snapshot.
if ($project_data['install_type'] == 'dev') {
if (isset($project_data['dev_version']) && $available['releases'][$project_data['dev_version']]['date'] > $available['releases'][$project_data['latest_version']]['date']) {
$project_data['latest_dev'] = $project_data['dev_version'];
}
else {
$project_data['latest_dev'] = $project_data['latest_version'];
}
}
// Figure out the status, based on what we've seen and the install type.
switch ($project_data['install_type']) {
case 'official':
if ($project_data['existing_version'] === $project_data['recommended'] || $project_data['existing_version'] === $project_data['latest_version']) {
$project_data['status'] = UPDATE_CURRENT;
}
else {
$project_data['status'] = UPDATE_NOT_CURRENT;
}
break;
case 'dev':
$latest = $available['releases'][$project_data['latest_dev']];
if (empty($project_data['datestamp'])) {
$project_data['status'] = UPDATE_NOT_CHECKED;
$project_data['reason'] = t('Unknown release date');
}
elseif (($project_data['datestamp'] + 100 > $latest['date'])) {
$project_data['status'] = UPDATE_CURRENT;
}
else {
$project_data['status'] = UPDATE_NOT_CURRENT;
}
break;
default:
$project_data['status'] = UPDATE_UNKNOWN;
$project_data['reason'] = t('Invalid info');
}
}
<?php
/**
* @file
* Code required only when fetching information about available updates.
*/
/**
* Performs any notifications that should be done once cron fetches new data.
*
* This method checks the status of the site using the new data and, depending
* on the configuration of the site, notifies administrators via email if there
* are new releases or missing security updates.
*
* @see update_requirements()
*/
function _update_cron_notify() {
$update_config = \Drupal::config('update.settings');
module_load_install('update');
$status = update_requirements('runtime');
$params = [];
$notify_all = ($update_config->get('notification.threshold') == 'all');
foreach (['core', 'contrib'] as $report_type) {
$type = 'update_' . $report_type;
if (isset($status[$type]['severity'])
&& ($status[$type]['severity'] == REQUIREMENT_ERROR || ($notify_all && $status[$type]['reason'] == UPDATE_NOT_CURRENT))) {
$params[$report_type] = $status[$type]['reason'];
}
}
if (!empty($params)) {
$notify_list = $update_config->get('notification.emails');
if (!empty($notify_list)) {
$default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();
foreach ($notify_list as $target) {
if ($target_user = user_load_by_mail($target)) {
$target_langcode = $target_user->getPreferredLangcode();
}
else {
$target_langcode = $default_langcode;
}
$message = \Drupal::service('plugin.manager.mail')->mail('update', 'status_notify', $target, $target_langcode, $params);
// Track when the last mail was successfully sent to avoid sending
// too many emails.
if ($message['result']) {
\Drupal::state()->set('update.last_email_notification', REQUEST_TIME);
}
}
}
}
}
name: 'Update Manager' name: 'Update Manager'
type: module type: module
description: 'Checks for available updates, and can securely install or update modules and themes via a web interface.' description: 'Не поддерживается в ДАР CMS'
# version: VERSION # version: VERSION
package: Core package: Core
# core: 8.x # core: 8.x
configure: update.settings
dependencies: dependencies:
- drupal:file - drupal:file
......
<?php
/**
* @file
* Install, update, and uninstall functions for the Update Manager module.
*/
use Drupal\Core\Url;
/**
* Implements hook_requirements().
*
* @return
* An array describing the status of the site regarding available updates. If
* there is no update data, only one record will be returned, indicating that
* the status of core can't be determined. If data is available, there will be
* two records: one for core, and another for all of contrib (assuming there
* are any contributed modules or themes enabled on the site). In addition to
* the fields expected by hook_requirements ('value', 'severity', and
* optionally 'description'), this array will contain a 'reason' attribute,
* which is an integer constant to indicate why the given status is being
* returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or UPDATE_UNKNOWN). This
* is used for generating the appropriate email notification messages during
* update_cron(), and might be useful for other modules that invoke
* update_requirements() to find out if the site is up to date or not.
*
* @see _update_message_text()
* @see _update_cron_notify()
*/
function update_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
if ($available = update_get_available(FALSE)) {
module_load_include('inc', 'update', 'update.compare');
$data = update_calculate_project_data($available);
// First, populate the requirements for core:
$requirements['update_core'] = _update_requirement_check($data['drupal'], 'core');
// We don't want to check drupal a second time.
unset($data['drupal']);
if (!empty($data)) {
// Now, sort our $data array based on each project's status. The
// status constants are numbered in the right order of precedence, so
// we just need to make sure the projects are sorted in ascending
// order of status, and we can look at the first project we find.
uasort($data, '_update_project_status_sort');
$first_project = reset($data);
$requirements['update_contrib'] = _update_requirement_check($first_project, 'contrib');
}
}
else {
$requirements['update_core']['title'] = t('Drupal core update status');
$requirements['update_core']['value'] = t('No update data available');
$requirements['update_core']['severity'] = REQUIREMENT_WARNING;
$requirements['update_core']['reason'] = UPDATE_UNKNOWN;
$requirements['update_core']['description'] = _update_no_data();
}
}
return $requirements;
}
/**
* Implements hook_install().
*/
function update_install() {
$queue = \Drupal::queue('update_fetch_tasks', TRUE);
$queue->createQueue();
}
/**
* Implements hook_uninstall().
*/
function update_uninstall() {
\Drupal::state()->delete('update.last_check');
\Drupal::state()->delete('update.last_email_notification');
$queue = \Drupal::queue('update_fetch_tasks');
$queue->deleteQueue();
}
/**
* Fills in the requirements array.
*
* This is shared for both core and contrib to generate the right elements in
* the array for hook_requirements().
*
* @param $project
* Array of information about the project we're testing as returned by
* update_calculate_project_data().
* @param $type
* What kind of project this is ('core' or 'contrib').
*
* @return
* An array to be included in the nested $requirements array.
*
* @see hook_requirements()
* @see update_requirements()
* @see update_calculate_project_data()
*/
function _update_requirement_check($project, $type) {
$requirement = [];
if ($type == 'core') {
$requirement['title'] = t('Drupal core update status');
}
else {
$requirement['title'] = t('Module and theme update status');
}
$status = $project['status'];
if ($status != UPDATE_CURRENT) {
$requirement['reason'] = $status;
$requirement['severity'] = REQUIREMENT_ERROR;
// When updates are available, append the available updates link to the
// message from _update_message_text(), and format the two translated
// strings together in a single paragraph.
$requirement['description'][] = ['#markup' => _update_message_text($type, $status)];
if (!in_array($status, [UPDATE_UNKNOWN, UPDATE_NOT_CHECKED, UPDATE_NOT_FETCHED, UPDATE_FETCH_PENDING])) {
if (_update_manager_access()) {
$requirement['description'][] = ['#prefix' => ' ', '#markup' => t('See the <a href=":available_updates">available updates</a> page for more information and to install your missing updates.', [':available_updates' => \Drupal::url('update.report_update')])];
}
else {
$requirement['description'][] = ['#prefix' => ' ', '#markup' => t('See the <a href=":available_updates">available updates</a> page for more information.', [':available_updates' => \Drupal::url('update.status')])];
}
}
}
switch ($status) {
case UPDATE_NOT_SECURE:
$requirement_label = t('Not secure!');
break;
case UPDATE_REVOKED:
$requirement_label = t('Revoked!');
break;
case UPDATE_NOT_SUPPORTED:
$requirement_label = t('Unsupported release');
break;
case UPDATE_NOT_CURRENT:
$requirement_label = t('Out of date');
$requirement['severity'] = REQUIREMENT_WARNING;
break;
case UPDATE_UNKNOWN:
case UPDATE_NOT_CHECKED:
case UPDATE_NOT_FETCHED:
case UPDATE_FETCH_PENDING:
$requirement_label = isset($project['reason']) ? $project['reason'] : t('Can not determine status');
$requirement['severity'] = REQUIREMENT_WARNING;
break;
default:
$requirement_label = t('Up to date');
}
if ($status != UPDATE_CURRENT && $type == 'core' && isset($project['recommended'])) {
$requirement_label .= ' ' . t('(version @version available)', ['@version' => $project['recommended']]);
}
$requirement['value'] = \Drupal::l($requirement_label, new Url(_update_manager_access() ? 'update.report_update' : 'update.status'));
return $requirement;
}
/**
* Rebuild the router to ensure admin/reports/updates/check has CSRF protection.
*/
function update_update_8001() {
// Empty update forces a call to drupal_flush_all_caches() which rebuilds the
// router.
// Use hook_post_update_NAME() instead to clear the cache.The use
// of hook_update_N to clear the cache has been deprecated see
// https://www.drupal.org/node/2960601 for more details.
}
drupal.update.admin:
version: VERSION
css:
theme:
css/update.admin.theme.css: {}
update.report_install:
route_name: update.report_install
title: 'Install new module or theme'
weight: 25
appears_on:
- update.status
update.module_install:
route_name: update.module_install
title: 'Install new module'
weight: 25
appears_on:
- system.modules_list
update.theme_install:
route_name: update.theme_install
title: 'Install new theme'
weight: 25
appears_on:
- system.themes_page
update.status:
title: 'Available updates'
description: 'Get a status report about available updates for your installed modules and themes.'
route_name: update.status
parent: system.admin_reports
weight: -50
update.status:
route_name: update.status
base_route: system.admin_reports
title: List
update.settings:
route_name: update.settings
base_route: system.admin_reports
title: Settings
weight: 50
update.report_update:
route_name: update.report_update
base_route: system.admin_reports
title: Update
weight: 10
update.module_update:
route_name: update.module_update
base_route: system.modules_list
title: Update
weight: 10
update.theme_update:
route_name: update.theme_update
base_route: system.themes_page
title: Update
weight: 10
<?php
/**
* @file
* Administrative screens and processing functions of the Update Manager module.
*
* This allows site administrators with the 'administer software updates'
* permission to either upgrade existing projects, or download and install new
* ones, so long as the killswitch setting ('allow_authorize_operations') is
* not FALSE.
*
* To install new code, the administrator is prompted for either the URL of an
* archive file, or to directly upload the archive file. The archive is loaded
* into a temporary location, extracted, and verified. If everything is
* successful, the user is redirected to authorize.php to type in file transfer
* credentials and authorize the installation to proceed with elevated
* privileges, such that the extracted files can be copied out of the temporary
* location and into the live web root.
*
* Updating existing code is a more elaborate process. The first step is a
* selection form where the user is presented with a table of installed projects
* that are missing newer releases. The user selects which projects they wish to
* update, and presses the "Download updates" button to continue. This sets up a
* batch to fetch all the selected releases, and redirects to
* admin/update/download to display the batch progress bar as it runs. Each
* batch operation is responsible for downloading a single file, extracting the
* archive, and verifying the contents. If there are any errors, the user is
* redirected back to the first page with the error messages. If all downloads
* were extracted and verified, the user is instead redirected to
* admin/update/ready, a landing page which reminds them to backup their
* database and asks if they want to put the site offline during the update.
* Once the user presses the "Install updates" button, they are redirected to
* authorize.php to supply their web root file access credentials. The
* authorized operation (which lives in update.authorize.inc) sets up a batch to
* copy each extracted update from the temporary location into the live web
* root.
*/
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* Batch callback: Performs actions when the download batch is completed.
*
* @param $success
* TRUE if the batch operation was successful, FALSE if there were errors.
* @param $results
* An associative array of results from the batch operation.
*/
function update_manager_download_batch_finished($success, $results) {
if (!empty($results['errors'])) {
$item_list = [
'#theme' => 'item_list',
'#title' => t('Downloading updates failed:'),
'#items' => $results['errors'],
];
\Drupal::messenger()->addError(\Drupal::service('renderer')->render($item_list));
}
elseif ($success) {
\Drupal::messenger()->addStatus(t('Updates downloaded successfully.'));
$_SESSION['update_manager_update_projects'] = $results['projects'];
return new RedirectResponse(\Drupal::url('update.confirmation_page', [], ['absolute' => TRUE]));
}
else {
// Ideally we're catching all Exceptions, so they should never see this,
// but just in case, we have to tell them something.
\Drupal::messenger()->addError(t('Fatal error trying to download.'));
}
}
/**
* Checks for file transfer backends and prepares a form fragment about them.
*
* @param array $form
* Reference to the form array we're building.
* @param string $operation
* The update manager operation we're in the middle of. Can be either 'update'
* or 'install'. Use to provide operation-specific interface text.
*
* @return
* TRUE if the update manager should continue to the next step in the
* workflow, or FALSE if we've hit a fatal configuration and must halt the
* workflow.
*/
function _update_manager_check_backends(&$form, $operation) {
// If file transfers will be performed locally, we do not need to display any
// warnings or notices to the user and should automatically continue the
// workflow, since we won't be using a FileTransfer backend that requires
// user input or a specific server configuration.
if (update_manager_local_transfers_allowed()) {
return TRUE;
}
// Otherwise, show the available backends.
$form['available_backends'] = [
'#prefix' => '<p>',
'#suffix' => '</p>',
];
$available_backends = drupal_get_filetransfer_info();
if (empty($available_backends)) {
if ($operation == 'update') {
$form['available_backends']['#markup'] = t('Your server does not support updating modules and themes from this interface. Instead, update modules and themes by uploading the new versions directly to the server, as documented in <a href=":doc_url">Extending Drupal 8</a>.', [':doc_url' => 'https://www.drupal.org/docs/8/extending-drupal-8/overview']);
}
else {
$form['available_backends']['#markup'] = t('Your server does not support installing modules and themes from this interface. Instead, install modules and themes by uploading them directly to the server, as documented in <a href=":doc_url">Extending Drupal 8</a>.', [':doc_url' => 'https://www.drupal.org/docs/8/extending-drupal-8/overview']);
}
return FALSE;
}
$backend_names = [];
foreach ($available_backends as $backend) {
$backend_names[] = $backend['title'];
}
if ($operation == 'update') {
$form['available_backends']['#markup'] = \Drupal::translation()->formatPlural(
count($available_backends),
'Updating modules and themes requires <strong>@backends access</strong> to your server. See <a href=":doc_url">Extending Drupal 8</a> for other update methods.',
'Updating modules and themes requires access to your server via one of the following methods: <strong>@backends</strong>. See <a href=":doc_url">Extending Drupal 8</a> for other update methods.',
[
'@backends' => implode(', ', $backend_names),
':doc_url' => 'https://www.drupal.org/docs/8/extending-drupal-8/overview',
]);
}
else {
$form['available_backends']['#markup'] = \Drupal::translation()->formatPlural(
count($available_backends),
'Installing modules and themes requires <strong>@backends access</strong> to your server. See <a href=":doc_url">Extending Drupal 8</a> for other installation methods.',
'Installing modules and themes requires access to your server via one of the following methods: <strong>@backends</strong>. See <a href=":doc_url">Extending Drupal 8</a> for other installation methods.',
[
'@backends' => implode(', ', $backend_names),
':doc_url' => 'https://www.drupal.org/docs/8/extending-drupal-8/overview',
]);
}
return TRUE;
}
/**
* Unpacks a downloaded archive file.
*
* @param string $file
* The filename of the archive you wish to extract.
* @param string $directory
* The directory you wish to extract the archive into.
*
* @return Archiver
* The Archiver object used to extract the archive.
*
* @throws Exception
*/
function update_manager_archive_extract($file, $directory) {
$archiver = archiver_get_archiver($file);
if (!$archiver) {
throw new Exception(t('Cannot extract %file, not a valid archive.', ['%file' => $file]));
}
// Remove the directory if it exists, otherwise it might contain a mixture of
// old files mixed with the new files (e.g. in cases where files were removed
// from a later release).
$files = $archiver->listContents();
// Unfortunately, we can only use the directory name to determine the project
// name. Some archivers list the first file as the directory (i.e., MODULE/)
// and others list an actual file (i.e., MODULE/README.TXT).
$project = strtok($files[0], '/\\');
$extract_location = $directory . '/' . $project;
if (file_exists($extract_location)) {
file_unmanaged_delete_recursive($extract_location);
}
$archiver->extract($directory);
return $archiver;
}
/**
* Verifies an archive after it has been downloaded and extracted.
*
* This function is responsible for invoking hook_verify_update_archive().
*
* @param string $project
* The short name of the project to download.
* @param string $archive_file
* The filename of the unextracted archive.
* @param string $directory
* The directory that the archive was extracted into.
*
* @return array
* An array of error messages to display if the archive was invalid. If there
* are no errors, it will be an empty array.
*/
function update_manager_archive_verify($project, $archive_file, $directory) {
return \Drupal::moduleHandler()->invokeAll('verify_update_archive', [$project, $archive_file, $directory]);
}
/**
* Copies a file from the specified URL to the temporary directory for updates.
*
* Returns the local path if the file has already been downloaded.
*
* @param $url
* The URL of the file on the server.
*
* @return string
* Path to local file.
*/
function update_manager_file_get($url) {
$parsed_url = parse_url($url);
$remote_schemes = ['http', 'https', 'ftp', 'ftps', 'smb', 'nfs'];
if (!isset($parsed_url['scheme']) || !in_array($parsed_url['scheme'], $remote_schemes)) {
// This is a local file, just return the path.
return \Drupal::service('file_system')->realpath($url);
}
// Check the cache and download the file if needed.
$cache_directory = _update_manager_cache_directory();
$local = $cache_directory . '/' . drupal_basename($parsed_url['path']);
if (!file_exists($local) || update_delete_file_if_stale($local)) {
return system_retrieve_file($url, $local, FALSE, FILE_EXISTS_REPLACE);
}
else {
return $local;
}
}
/**
* Implements callback_batch_operation().
*
* Downloads, unpacks, and verifies a project.
*
* This function assumes that the provided URL points to a file archive of some
* sort. The URL can have any scheme that we have a file stream wrapper to
* support. The file is downloaded to a local cache.
*
* @param string $project
* The short name of the project to download.
* @param string $url
* The URL to download a specific project release archive file.
* @param array $context
* Reference to an array used for Batch API storage.
*
* @see update_manager_download_page()
*/
function update_manager_batch_project_get($project, $url, &$context) {
// This is here to show the user that we are in the process of downloading.
if (!isset($context['sandbox']['started'])) {
$context['sandbox']['started'] = TRUE;
$context['message'] = t('Downloading %project', ['%project' => $project]);
$context['finished'] = 0;
return;
}
// Actually try to download the file.
if (!($local_cache = update_manager_file_get($url))) {
$context['results']['errors'][$project] = t('Failed to download %project from %url', ['%project' => $project, '%url' => $url]);
return;
}
// Extract it.
$extract_directory = _update_manager_extract_directory();
try {
update_manager_archive_extract($local_cache, $extract_directory);
}
catch (Exception $e) {
$context['results']['errors'][$project] = $e->getMessage();
return;
}
// Verify it.
$archive_errors = update_manager_archive_verify($project, $local_cache, $extract_directory);
if (!empty($archive_errors)) {
// We just need to make sure our array keys don't collide, so use the
// numeric keys from the $archive_errors array.
foreach ($archive_errors as $key => $error) {
$context['results']['errors']["$project-$key"] = $error;
}
return;
}
// Yay, success.
$context['results']['projects'][$project] = $url;
$context['finished'] = 1;
}
/**
* Determines if file transfers will be performed locally.
*
* If the server is configured such that webserver-created files have the same
* owner as the configuration directory (e.g., sites/default) where new code
* will eventually be installed, the update manager can transfer files entirely
* locally, without changing their ownership (in other words, without prompting
* the user for FTP, SSH or other credentials).
*
* This server configuration is an inherent security weakness because it allows
* a malicious webserver process to append arbitrary PHP code and then execute
* it. However, it is supported here because it is a common configuration on
* shared hosting, and there is nothing Drupal can do to prevent it.
*
* @return
* TRUE if local file transfers are allowed on this server, or FALSE if not.
*
* @see install_check_requirements()
*/
function update_manager_local_transfers_allowed() {
// Compare the owner of a webserver-created temporary file to the owner of
// the configuration directory to determine if local transfers will be
// allowed.
$temporary_file = drupal_tempnam('temporary://', 'update_');
$site_path = \Drupal::service('site.path');
$local_transfers_allowed = fileowner($temporary_file) === fileowner($site_path);
// Clean up. If this fails, we can ignore it (since this is just a temporary
// file anyway).
@drupal_unlink($temporary_file);
return $local_transfers_allowed;
}
<?php
/**
* @file
* Handles updates of Drupal core and contributed projects.
*
* The module checks for available updates of Drupal core and any installed
* contributed modules and themes. It warns site administrators if newer
* releases are available via the system status report (admin/reports/status),
* the module and theme pages, and optionally via email. It also provides the
* ability to install contributed modules and themes via an user interface.
*/
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Site\Settings;
// These are internally used constants for this code, do not modify.
/**
* Project is missing security update(s).
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::NOT_SECURE instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_NOT_SECURE = 1;
/**
* Current release has been unpublished and is no longer available.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::REVOKED instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_REVOKED = 2;
/**
* Current release is no longer supported by the project maintainer.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::NOT_SUPPORTED instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_NOT_SUPPORTED = 3;
/**
* Project has a new release available, but it is not a security release.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::NOT_CURRENT instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_NOT_CURRENT = 4;
/**
* Project is up to date.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::CURRENT instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_CURRENT = 5;
/**
* Project's status cannot be checked.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateFetcherInterface::NOT_CHECKED instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_NOT_CHECKED = -1;
/**
* No available update data was found for project.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateFetcherInterface::UNKNOWN instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_UNKNOWN = -2;
/**
* There was a failure fetching available update data for this project.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateFetcherInterface::NOT_FETCHED instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_NOT_FETCHED = -3;
/**
* We need to (re)fetch available update data for this project.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateFetcherInterface::FETCH_PENDING instead.
*
* @see https://www.drupal.org/node/2831620
*/
const UPDATE_FETCH_PENDING = -4;
/**
* Implements hook_help().
*/
function update_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.update':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Update Manager module periodically checks for new versions of your site\'s software (including contributed modules and themes), and alerts administrators to available updates. The Update Manager system is also used by some other modules to manage updates and downloads; for example, the Interface Translation module uses the Update Manager to download translations from the localization server. Note that whenever the Update Manager system is used, anonymous usage statistics are sent to Drupal.org. If desired, you may disable the Update Manager module from the <a href=":modules">Extend page</a>; if you do so, functionality that depends on the Update Manager system will not work. For more information, see the <a href=":update">online documentation for the Update Manager module</a>.', [':update' => 'https://www.drupal.org/documentation/modules/update', ':modules' => \Drupal::url('system.modules_list')]) . '</p>';
// Only explain the Update manager if it has not been disabled.
if (_update_manager_access()) {
$output .= '<p>' . t('The Update Manager also allows administrators to update and install modules and themes through the administration interface.') . '</p>';
}
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Checking for available updates') . '</dt>';
$output .= '<dd>' . t('The <a href=":update-report">Available updates report</a> displays core, contributed modules, and themes for which there are new releases available for download. On the report page, you can also check manually for updates. You can configure the frequency of update checks, which are performed during cron runs, and whether notifications are sent on the <a href=":update-settings">Update Manager settings page</a>.', [':update-report' => \Drupal::url('update.status'), ':update-settings' => \Drupal::url('update.settings')]) . '</dd>';
// Only explain the Update manager if it has not been disabled.
if (_update_manager_access()) {
$output .= '<dt>' . t('Performing updates through the Update page') . '</dt>';
$output .= '<dd>' . t('The Update Manager module allows administrators to perform updates directly from the <a href=":update-page">Update page</a>. It lists all available updates, and you can confirm whether you want to download them. If you don\'t have sufficient access rights to your web server, you could be prompted for your FTP/SSH password. Afterwards the files are transferred into your site installation, overwriting your old files. Direct links to the Update page are also displayed on the <a href=":modules_page">Extend page</a> and the <a href=":themes_page">Appearance page</a>.', [':modules_page' => \Drupal::url('system.modules_list'), ':themes_page' => \Drupal::url('system.themes_page'), ':update-page' => \Drupal::url('update.report_update')]) . '</dd>';
$output .= '<dt>' . t('Installing new modules and themes through the Install page') . '</dt>';
$output .= '<dd>' . t('You can also install new modules and themes in the same fashion, through the <a href=":install">Install page</a>, or by clicking the <em>Install new module/theme</em> links at the top of the <a href=":modules_page">Extend page</a> and the <a href=":themes_page">Appearance page</a>. In this case, you are prompted to provide either the URL to the download, or to upload a packaged release file from your local computer.', [':modules_page' => \Drupal::url('system.modules_list'), ':themes_page' => \Drupal::url('system.themes_page'), ':install' => \Drupal::url('update.report_install')]) . '</dd>';
}
$output .= '</dl>';
return $output;
case 'update.status':
return '<p>' . t('Here you can find information about available updates for your installed modules and themes. Note that each module or theme is part of a "project", which may or may not have the same name, and might include multiple modules or themes within it.') . '</p>';
case 'system.modules_list':
if (_update_manager_access()) {
$output = '<p>' . t('Regularly review and install <a href=":updates">available updates</a> to maintain a secure and current site. Always run the <a href=":update-php">update script</a> each time a module is updated.', [':update-php' => \Drupal::url('system.db_update'), ':updates' => \Drupal::url('update.status')]) . '</p>';
}
else {
$output = '<p>' . t('Regularly review <a href=":updates">available updates</a> to maintain a secure and current site. Always run the <a href=":update-php">update script</a> each time a module is updated.', [':update-php' => \Drupal::url('system.db_update'), ':updates' => \Drupal::url('update.status')]) . '</p>';
}
return $output;
}
}
/**
* Implements hook_page_top().
*/
function update_page_top() {
/** @var \Drupal\Core\Routing\AdminContext $admin_context */
$admin_context = \Drupal::service('router.admin_context');
$route_match = \Drupal::routeMatch();
if ($admin_context->isAdminRoute($route_match->getRouteObject()) && \Drupal::currentUser()->hasPermission('administer site configuration')) {
$route_name = \Drupal::routeMatch()->getRouteName();
switch ($route_name) {
// These pages don't need additional nagging.
case 'update.theme_update':
case 'system.theme_install':
case 'update.module_update':
case 'update.module_install':
case 'update.status':
case 'update.report_update':
case 'update.report_install':
case 'update.settings':
case 'system.status':
case 'update.confirmation_page':
return;
// If we are on the appearance or modules list, display a detailed report
// of the update status.
case 'system.themes_page':
case 'system.modules_list':
$verbose = TRUE;
break;
}
module_load_install('update');
$status = update_requirements('runtime');
foreach (['core', 'contrib'] as $report_type) {
$type = 'update_' . $report_type;
// hook_requirements() supports render arrays therefore we need to render
// them before using
// \Drupal\Core\Messenger\MessengerInterface::addStatus().
if (isset($status[$type]['description']) && is_array($status[$type]['description'])) {
$status[$type]['description'] = \Drupal::service('renderer')->renderPlain($status[$type]['description']);
}
if (!empty($verbose)) {
if (isset($status[$type]['severity'])) {
if ($status[$type]['severity'] == REQUIREMENT_ERROR) {
\Drupal::messenger()->addError($status[$type]['description']);
}
elseif ($status[$type]['severity'] == REQUIREMENT_WARNING) {
\Drupal::messenger()->addWarning($status[$type]['description']);
}
}
}
// Otherwise, if we're on *any* admin page and there's a security
// update missing, print an error message about it.
else {
if (isset($status[$type])
&& isset($status[$type]['reason'])
&& $status[$type]['reason'] === UPDATE_NOT_SECURE) {
\Drupal::messenger()->addError($status[$type]['description']);
}
}
}
}
}
/**
* Resolves if the current user can access updater menu items.
*
* It both enforces the 'administer software updates' permission and the global
* kill switch for the authorize.php script.
*
* @return
* TRUE if the current user can access the updater menu items; FALSE
* otherwise.
*/
function _update_manager_access() {
return Settings::get('allow_authorize_operations', TRUE) && \Drupal::currentUser()->hasPermission('administer software updates');
}
/**
* Implements hook_theme().
*/
function update_theme() {
return [
'update_last_check' => [
'variables' => ['last' => 0],
],
'update_report' => [
'variables' => ['data' => NULL],
'file' => 'update.report.inc',
],
'update_project_status' => [
'variables' => ['project' => []],
'file' => 'update.report.inc',
],
// We are using template instead of '#type' => 'table' here to keep markup
// out of preprocess and allow for easier changes to markup.
'update_version' => [
'variables' => ['version' => NULL, 'title' => NULL, 'attributes' => []],
'file' => 'update.report.inc',
],
];
}
/**
* Implements hook_cron().
*/
function update_cron() {
$update_config = \Drupal::config('update.settings');
$frequency = $update_config->get('check.interval_days');
$interval = 60 * 60 * 24 * $frequency;
$last_check = \Drupal::state()->get('update.last_check') ?: 0;
if ((REQUEST_TIME - $last_check) > $interval) {
// If the configured update interval has elapsed, we want to invalidate
// the data for all projects, attempt to re-fetch, and trigger any
// configured notifications about the new status.
update_refresh();
update_fetch_data();
}
else {
// Otherwise, see if any individual projects are now stale or still
// missing data, and if so, try to fetch the data.
update_get_available(TRUE);
}
$last_email_notice = \Drupal::state()->get('update.last_email_notification') ?: 0;
if ((REQUEST_TIME - $last_email_notice) > $interval) {
// If configured time between notifications elapsed, send email about
// updates possibly available.
module_load_include('inc', 'update', 'update.fetch');
_update_cron_notify();
}
// Clear garbage from disk.
update_clear_update_disk_cache();
}
/**
* Implements hook_themes_installed().
*
* If themes are installed, we invalidate the information of available updates.
*/
function update_themes_installed($themes) {
// Clear all update module data.
update_storage_clear();
}
/**
* Implements hook_themes_uninstalled().
*
* If themes are uninstalled, we invalidate the information of available updates.
*/
function update_themes_uninstalled($themes) {
// Clear all update module data.
update_storage_clear();
}
/**
* Implements hook_form_FORM_ID_alter() for system_modules().
*
* Adds a form submission handler to the system modules form, so that if a site
* admin saves the form, we invalidate the information of available updates.
*
* @see _update_cache_clear()
*/
function update_form_system_modules_alter(&$form, FormStateInterface $form_state) {
$form['#submit'][] = 'update_storage_clear_submit';
}
/**
* Form submission handler for system_modules().
*
* @see update_form_system_modules_alter()
*/
function update_storage_clear_submit($form, FormStateInterface $form_state) {
// Clear all update module data.
update_storage_clear();
}
/**
* Returns a warning message when there is no data about available updates.
*/
function _update_no_data() {
$destination = \Drupal::destination()->getAsArray();
return t('No update information available. <a href=":run_cron">Run cron</a> or <a href=":check_manually">check manually</a>.', [
':run_cron' => \Drupal::url('system.run_cron', [], ['query' => $destination]),
':check_manually' => \Drupal::url('update.manual_status', [], ['query' => $destination]),
]);
}
/**
* 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 enabled 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 update_calculate_project_data() will be wrong and produce confusing,
* bogus results.
*
* @param $refresh
* (optional) Boolean to indicate if this method should refresh automatically
* if there's no data. Defaults to FALSE.
*
* @return
* Array of data about available releases, keyed by project shortname.
*
* @see update_refresh()
* @see \Drupal\Update\UpdateManager::getProjects()
*/
function update_get_available($refresh = FALSE) {
module_load_include('inc', 'update', 'update.compare');
$needs_refresh = FALSE;
// Grab whatever data we currently have.
$available = \Drupal::keyValueExpirable('update_available_releases')->getAll();
$projects = \Drupal::service('update.manager')->getProjects();
foreach ($projects as $key => $project) {
// If there's no data at all, we clearly need to fetch some.
if (empty($available[$key])) {
// update_create_fetch_task($project);
\Drupal::service('update.processor')->createFetchTask($project);
$needs_refresh = TRUE;
continue;
}
// See if the .info.yml file is newer than the last time we checked for
// data, and if so, mark this project's data as needing to be re-fetched.
// Any time an admin upgrades their local installation, the .info.yml file
// will be changed, so this is the only way we can be sure we're not showing
// bogus information right after they upgrade.
if ($project['info']['_info_file_ctime'] > $available[$key]['last_fetch']) {
$available[$key]['fetch_status'] = UPDATE_FETCH_PENDING;
}
// If we have project data but no release data, we need to fetch. This
// can be triggered when we fail to contact a release history server.
if (empty($available[$key]['releases']) && !$available[$key]['last_fetch']) {
$available[$key]['fetch_status'] = UPDATE_FETCH_PENDING;
}
// If we think this project needs to fetch, actually create the task now
// and remember that we think we're missing some data.
if (!empty($available[$key]['fetch_status']) && $available[$key]['fetch_status'] == UPDATE_FETCH_PENDING) {
\Drupal::service('update.processor')->createFetchTask($project);
$needs_refresh = TRUE;
}
}
if ($needs_refresh && $refresh) {
// Attempt to drain the queue of fetch tasks.
update_fetch_data();
// After processing the queue, we've (hopefully) got better data, so pull
// the latest data again and use that directly.
$available = \Drupal::keyValueExpirable('update_available_releases')->getAll();
}
return $available;
}
/**
* Identifies equivalent security releases with a hardcoded list.
*
* Generally, only the latest minor version of Drupal 8 is supported. However,
* when security fixes are backported to an old branch, and the site owner
* updates to the release containing the backported fix, they should not
* see "Security update required!" again if the only other security releases
* are releases for the same advisories.
*
* @return string[]
* A list of security release numbers that are equivalent to this release
* (i.e. covered by the same advisory), for backported security fixes only.
*
* @internal
*
* @deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Use the
* 'Insecure' release type tag in update XML provided by Drupal.org to
* determine if releases are insecure.
*/
function _update_equivalent_security_releases() {
trigger_error("_update_equivalent_security_releases() was a temporary fix and will be removed before 9.0.0. Use the 'Insecure' release type tag in update XML provided by Drupal.org to determine if releases are insecure.", E_USER_DEPRECATED);
switch (\Drupal::VERSION) {
case '8.3.8':
return ['8.4.5', '8.5.0-rc1'];
case '8.3.9':
return ['8.4.6', '8.5.1'];
case '8.4.5':
return ['8.5.0-rc1'];
case '8.4.6':
return ['8.5.1'];
case '8.4.7':
return ['8.5.2'];
case '8.4.8':
return ['8.5.3'];
}
return [];
}
/**
* Adds a task to the queue for fetching release history data for a project.
*
* We only create a new fetch task if there's no task already in the queue for
* this particular project (based on 'update_fetch_task' key-value collection).
*
* @param $project
* Associative array of information about a project as created by
* \Drupal\Update\UpdateManager::getProjects(), including keys such as 'name'
* (short name), and the 'info' array with data from a .info.yml file for the
* project.
*
* @see \Drupal\update\UpdateFetcher::createFetchTask()
*/
function update_create_fetch_task($project) {
\Drupal::service('update.processor')->createFetchTask($project);
}
/**
* Refreshes the release data after loading the necessary include file.
*/
function update_refresh() {
\Drupal::service('update.manager')->refreshUpdateData();
}
/**
* Attempts to fetch update data after loading the necessary include file.
*
* @see \Drupal\update\UpdateProcessor::fetchData()
*/
function update_fetch_data() {
\Drupal::service('update.processor')->fetchData();
}
/**
* Batch callback: Performs actions when all fetch tasks have been completed.
*
* @param $success
* TRUE if the batch operation was successful; FALSE if there were errors.
* @param $results
* An associative array of results from the batch operation, including the key
* 'updated' which holds the total number of projects we fetched available
* update data for.
*/
function update_fetch_data_finished($success, $results) {
if ($success) {
if (!empty($results)) {
if (!empty($results['updated'])) {
\Drupal::messenger()->addStatus(\Drupal::translation()->formatPlural($results['updated'], 'Checked available update data for one project.', 'Checked available update data for @count projects.'));
}
if (!empty($results['failures'])) {
\Drupal::messenger()->addError(\Drupal::translation()->formatPlural($results['failures'], 'Failed to get available update data for one project.', 'Failed to get available update data for @count projects.'));
}
}
}
else {
\Drupal::messenger()->addError(t('An error occurred trying to get available update data.'), 'error');
}
}
/**
* Implements hook_mail().
*
* Constructs the email notification message when the site is out of date.
*
* @param $key
* Unique key to indicate what message to build, always 'status_notify'.
* @param $message
* Reference to the message array being built.
* @param $params
* Array of parameters to indicate what kind of text to include in the message
* body. This is a keyed array of message type ('core' or 'contrib') as the
* keys, and the status reason constant (UPDATE_NOT_SECURE, etc) for the
* values.
*
* @see \Drupal\Core\Mail\MailManagerInterface::mail()
* @see _update_cron_notify()
* @see _update_message_text()
*/
function update_mail($key, &$message, $params) {
$langcode = $message['langcode'];
$language = \Drupal::languageManager()->getLanguage($langcode);
$message['subject'] .= t('New release(s) available for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name')], ['langcode' => $langcode]);
foreach ($params as $msg_type => $msg_reason) {
$message['body'][] = _update_message_text($msg_type, $msg_reason, $langcode);
}
$message['body'][] = t('See the available updates page for more information:', [], ['langcode' => $langcode]) . "\n" . \Drupal::url('update.status', [], ['absolute' => TRUE, 'language' => $language]);
if (_update_manager_access()) {
$message['body'][] = t('You can automatically install your missing updates using the Update manager:', [], ['langcode' => $langcode]) . "\n" . \Drupal::url('update.report_update', [], ['absolute' => TRUE, 'language' => $language]);
}
$settings_url = \Drupal::url('update.settings', [], ['absolute' => TRUE]);
if (\Drupal::config('update.settings')->get('notification.threshold') == 'all') {
$message['body'][] = t('Your site is currently configured to send these emails when any updates are available. To get notified only for security updates, @url.', ['@url' => $settings_url]);
}
else {
$message['body'][] = t('Your site is currently configured to send these emails only when security updates are available. To get notified for any available updates, @url.', ['@url' => $settings_url]);
}
}
/**
* Returns the appropriate message text when site is out of date or not secure.
*
* These error messages are shared by both update_requirements() for the
* site-wide status report at admin/reports/status and in the body of the
* notification email messages generated by update_cron().
*
* @param $msg_type
* String to indicate what kind of message to generate. Can be either 'core'
* or 'contrib'.
* @param $msg_reason
* Integer constant specifying why message is generated.
* @param $langcode
* (optional) A language code to use. Defaults to NULL.
*
* @return
* The properly translated error message for the given key.
*/
function _update_message_text($msg_type, $msg_reason, $langcode = NULL) {
$text = '';
switch ($msg_reason) {
case UPDATE_NOT_SECURE:
if ($msg_type == 'core') {
$text = t('There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately!', [], ['langcode' => $langcode]);
}
else {
$text = t('There are security updates available for one or more of your modules or themes. To ensure the security of your server, you should update immediately!', [], ['langcode' => $langcode]);
}
break;
case UPDATE_REVOKED:
if ($msg_type == 'core') {
$text = t('Your version of Drupal has been revoked and is no longer available for download. Upgrading is strongly recommended!', [], ['langcode' => $langcode]);
}
else {
$text = t('The installed version of at least one of your modules or themes has been revoked and is no longer available for download. Upgrading or disabling is strongly recommended!', [], ['langcode' => $langcode]);
}
break;
case UPDATE_NOT_SUPPORTED:
if ($msg_type == 'core') {
$text = t('Your version of Drupal is no longer supported. Upgrading is strongly recommended!', [], ['langcode' => $langcode]);
}
else {
$text = t('The installed version of at least one of your modules or themes is no longer supported. Upgrading or disabling is strongly recommended. See the project homepage for more details.', [], ['langcode' => $langcode]);
}
break;
case UPDATE_NOT_CURRENT:
if ($msg_type == 'core') {
$text = t('There are updates available for your version of Drupal. To ensure the proper functioning of your site, you should update as soon as possible.', [], ['langcode' => $langcode]);
}
else {
$text = t('There are updates available for one or more of your modules or themes. To ensure the proper functioning of your site, you should update as soon as possible.', [], ['langcode' => $langcode]);
}
break;
case UPDATE_UNKNOWN:
case UPDATE_NOT_CHECKED:
case UPDATE_NOT_FETCHED:
case UPDATE_FETCH_PENDING:
if ($msg_type == 'core') {
$text = t('There was a problem checking <a href=":update-report">available updates</a> for Drupal.', [':update-report' => \Drupal::url('update.status')], ['langcode' => $langcode]);
}
else {
$text = t('There was a problem checking <a href=":update-report">available updates</a> for your modules or themes.', [':update-report' => \Drupal::url('update.status')], ['langcode' => $langcode]);
}
break;
}
return $text;
}
/**
* Orders projects based on their status.
*
* Callback for uasort() within update_requirements().
*/
function _update_project_status_sort($a, $b) {
// The status constants are numerically in the right order, so we can
// usually subtract the two to compare in the order we want. However,
// negative status values should be treated as if they are huge, since we
// always want them at the bottom of the list.
$a_status = $a['status'] > 0 ? $a['status'] : (-10 * $a['status']);
$b_status = $b['status'] > 0 ? $b['status'] : (-10 * $b['status']);
return $a_status - $b_status;
}
/**
* Prepares variables for last time update data was checked templates.
*
* Default template: update-last-check.html.twig.
*
* In addition to properly formatting the given timestamp, this function also
* provides a "Check manually" link that refreshes the available update and
* redirects back to the same page.
*
* @param $variables
* An associative array containing:
* - last: The timestamp when the site last checked for available updates.
*
* @see theme_update_report()
*/
function template_preprocess_update_last_check(&$variables) {
$variables['time'] = \Drupal::service('date.formatter')->formatTimeDiffSince($variables['last']);
$variables['link'] = \Drupal::l(t('Check manually'), new Url('update.manual_status', [], ['query' => \Drupal::destination()->getAsArray()]));
}
/**
* Implements hook_verify_update_archive().
*
* First, we ensure that the archive isn't a copy of Drupal core, which the
* update manager does not yet support. See https://www.drupal.org/node/606592.
*
* Then, we make sure that at least one module included in the archive file has
* an .info.yml file which claims that the code is compatible with the current
* version of Drupal core.
*
* @see \Drupal\Core\Extension\ExtensionDiscovery
*/
function update_verify_update_archive($project, $archive_file, $directory) {
$errors = [];
// Make sure this isn't a tarball of Drupal core.
if (
file_exists("$directory/$project/index.php")
&& file_exists("$directory/$project/core/install.php")
&& file_exists("$directory/$project/core/includes/bootstrap.inc")
&& file_exists("$directory/$project/core/modules/node/node.module")
&& file_exists("$directory/$project/core/modules/system/system.module")
) {
return [
'no-core' => t('Automatic updating of Drupal core is not supported. See the <a href=":upgrade-guide">upgrade guide</a> for information on how to update Drupal core manually.', [':upgrade-guide' => 'https://www.drupal.org/upgrade']),
];
}
// Parse all the .info.yml files and make sure at least one is compatible with
// this version of Drupal core. If one is compatible, then the project as a
// whole is considered compatible (since, for example, the project may ship
// with some out-of-date modules that are not necessary for its overall
// functionality).
$compatible_project = FALSE;
$incompatible = [];
$files = file_scan_directory("$directory/$project", '/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info.yml$/', ['key' => 'name', 'min_depth' => 0]);
foreach ($files as $file) {
// Get the .info.yml file for the module or theme this file belongs to.
$info = \Drupal::service('info_parser')->parse($file->uri);
// If the module or theme is incompatible with Drupal core, set an error.
if (empty($info['core']) || $info['core'] != \Drupal::CORE_COMPATIBILITY) {
$incompatible[] = !empty($info['name']) ? $info['name'] : t('Unknown');
}
else {
$compatible_project = TRUE;
break;
}
}
if (empty($files)) {
$errors[] = t('%archive_file does not contain any .info.yml files.', ['%archive_file' => drupal_basename($archive_file)]);
}
elseif (!$compatible_project) {
$errors[] = \Drupal::translation()->formatPlural(
count($incompatible),
'%archive_file contains a version of %names that is not compatible with Drupal @version.',
'%archive_file contains versions of modules or themes that are not compatible with Drupal @version: %names',
['@version' => \Drupal::CORE_COMPATIBILITY, '%archive_file' => drupal_basename($archive_file), '%names' => implode(', ', $incompatible)]
);
}
return $errors;
}
/**
* Invalidates stored data relating to update status.
*/
function update_storage_clear() {
\Drupal::keyValueExpirable('update')->deleteAll();
\Drupal::keyValueExpirable('update_available_release')->deleteAll();
}
/**
* Returns a short unique identifier for this Drupal installation.
*
* @return
* An eight character string uniquely identifying this Drupal installation.
*/
function _update_manager_unique_identifier() {
$id = &drupal_static(__FUNCTION__, '');
if (empty($id)) {
$id = substr(hash('sha256', Settings::getHashSalt()), 0, 8);
}
return $id;
}
/**
* Returns the directory where update archive files should be extracted.
*
* @param $create
* (optional) Whether to attempt to create the directory if it does not
* already exist. Defaults to TRUE.
*
* @return
* The full path to the temporary directory where update file archives should
* be extracted.
*/
function _update_manager_extract_directory($create = TRUE) {
$directory = &drupal_static(__FUNCTION__, '');
if (empty($directory)) {
$directory = 'temporary://update-extraction-' . _update_manager_unique_identifier();
if ($create && !file_exists($directory)) {
mkdir($directory);
}
}
return $directory;
}
/**
* Returns the directory where update archive files should be cached.
*
* @param $create
* (optional) Whether to attempt to create the directory if it does not
* already exist. Defaults to TRUE.
*
* @return
* The full path to the temporary directory where update file archives should
* be cached.
*/
function _update_manager_cache_directory($create = TRUE) {
$directory = &drupal_static(__FUNCTION__, '');
if (empty($directory)) {
$directory = 'temporary://update-cache-' . _update_manager_unique_identifier();
if ($create && !file_exists($directory)) {
mkdir($directory);
}
}
return $directory;
}
/**
* Clears the temporary files and directories based on file age from disk.
*/
function update_clear_update_disk_cache() {
// List of update module cache directories. Do not create the directories if
// they do not exist.
$directories = [
_update_manager_cache_directory(FALSE),
_update_manager_extract_directory(FALSE),
];
// Search for files and directories in base folder only without recursion.
foreach ($directories as $directory) {
file_scan_directory($directory, '/.*/', ['callback' => 'update_delete_file_if_stale', 'recurse' => FALSE]);
}
}
/**
* Deletes stale files and directories from the update manager disk cache.
*
* Files and directories older than 6 hours and development snapshots older than
* 5 minutes are considered stale. We only cache development snapshots for 5
* minutes since otherwise updated snapshots might not be downloaded as
* expected.
*
* When checking file ages, we need to use the ctime, not the mtime
* (modification time) since many (all?) tar implementations go out of their way
* to set the mtime on the files they create to the timestamps recorded in the
* tarball. We want to see the last time the file was changed on disk, which is
* left alone by tar and correctly set to the time the archive file was
* unpacked.
*
* @param $path
* A string containing a file path or (streamwrapper) URI.
*/
function update_delete_file_if_stale($path) {
if (file_exists($path)) {
$filectime = filectime($path);
$max_age = \Drupal::config('system.file')->get('temporary_maximum_age');
if (REQUEST_TIME - $filectime > $max_age || (preg_match('/.*-dev\.(tar\.gz|zip)/i', $path) && REQUEST_TIME - $filectime > 300)) {
file_unmanaged_delete_recursive($path);
}
}
}
<?php
/**
* @file
* Code required only when rendering the available updates report.
*/
use Drupal\Core\Template\Attribute;
use Drupal\Core\Url;
/**
* Prepares variables for project status report templates.
*
* Default template: update-report.html.twig.
*
* @param array $variables
* An associative array containing:
* - data: An array of data about each project's status.
*/
function template_preprocess_update_report(&$variables) {
$data = $variables['data'];
$last = \Drupal::state()->get('update.last_check') ?: 0;
$variables['last_checked'] = [
'#theme' => 'update_last_check',
'#last' => $last,
// Attach the library to a variable that gets printed always.
'#attached' => [
'library' => [
'update/drupal.update.admin',
],
],
];
// For no project update data, populate no data message.
if (empty($data)) {
$variables['no_updates_message'] = _update_no_data();
}
$rows = [];
foreach ($data as $project) {
$project_status = [
'#theme' => 'update_project_status',
'#project' => $project,
];
// Build project rows.
if (!isset($rows[$project['project_type']])) {
$rows[$project['project_type']] = [
'#type' => 'table',
'#attributes' => ['class' => ['update']],
];
}
$row_key = !empty($project['title']) ? mb_strtolower($project['title']) : mb_strtolower($project['name']);
// Add the project status row and details.
$rows[$project['project_type']][$row_key]['status'] = $project_status;
// Add project status class attribute to the table row.
switch ($project['status']) {
case UPDATE_CURRENT:
$rows[$project['project_type']][$row_key]['#attributes'] = ['class' => ['color-success']];
break;
case UPDATE_UNKNOWN:
case UPDATE_FETCH_PENDING:
case UPDATE_NOT_FETCHED:
case UPDATE_NOT_SECURE:
case UPDATE_REVOKED:
case UPDATE_NOT_SUPPORTED:
$rows[$project['project_type']][$row_key]['#attributes'] = ['class' => ['color-error']];
break;
case UPDATE_NOT_CHECKED:
case UPDATE_NOT_CURRENT:
default:
$rows[$project['project_type']][$row_key]['#attributes'] = ['class' => ['color-warning']];
break;
}
}
$project_types = [
'core' => t('Drupal core'),
'module' => t('Modules'),
'theme' => t('Themes'),
'module-disabled' => t('Uninstalled modules'),
'theme-disabled' => t('Uninstalled themes'),
];
$variables['project_types'] = [];
foreach ($project_types as $type_name => $type_label) {
if (!empty($rows[$type_name])) {
ksort($rows[$type_name]);
$variables['project_types'][] = [
'label' => $type_label,
'table' => $rows[$type_name],
];
}
}
}
/**
* Prepares variables for update project status templates.
*
* Default template: update-project-status.html.twig.
*
* @param array $variables
* An associative array containing:
* - project: An array of information about the project.
*/
function template_preprocess_update_project_status(&$variables) {
// Storing by reference because we are sorting the project values.
$project = &$variables['project'];
// Set the project title and URL.
$variables['title'] = (isset($project['title'])) ? $project['title'] : $project['name'];
$variables['url'] = (isset($project['link'])) ? Url::fromUri($project['link'])->toString() : NULL;
$variables['install_type'] = $project['install_type'];
if ($project['install_type'] == 'dev' && !empty($project['datestamp'])) {
$variables['datestamp'] = format_date($project['datestamp'], 'custom', 'Y-M-d');
}
$variables['existing_version'] = $project['existing_version'];
$versions_inner = [];
$security_class = [];
$version_class = [];
if (isset($project['recommended'])) {
if ($project['status'] != UPDATE_CURRENT || $project['existing_version'] !== $project['recommended']) {
// First, figure out what to recommend.
// If there's only 1 security update and it has the same version we're
// recommending, give it the same CSS class as if it was recommended,
// but don't print out a separate "Recommended" line for this project.
if (!empty($project['security updates'])
&& count($project['security updates']) == 1
&& $project['security updates'][0]['version'] === $project['recommended']
) {
$security_class[] = 'project-update__version--recommended';
$security_class[] = 'project-update__version---strong';
}
else {
$version_class[] = 'project-update__version--recommended';
// Apply an extra class if we're displaying both a recommended
// version and anything else for an extra visual hint.
if ($project['recommended'] !== $project['latest_version']
|| !empty($project['also'])
|| ($project['install_type'] == 'dev'
&& isset($project['dev_version'])
&& $project['latest_version'] !== $project['dev_version']
&& $project['recommended'] !== $project['dev_version'])
|| (isset($project['security updates'][0])
&& $project['recommended'] !== $project['security updates'][0])
) {
$version_class[] = 'project-update__version--recommended-strong';
}
$versions_inner[] = [
'#theme' => 'update_version',
'#version' => $project['releases'][$project['recommended']],
'#title' => t('Recommended version:'),
'#attributes' => ['class' => $version_class],
];
}
// Now, print any security updates.
if (!empty($project['security updates'])) {
$security_class[] = 'version-security';
foreach ($project['security updates'] as $security_update) {
$versions_inner[] = [
'#theme' => 'update_version',
'#version' => $security_update,
'#title' => t('Security update:'),
'#attributes' => ['class' => $security_class],
];
}
}
}
if ($project['recommended'] !== $project['latest_version']) {
$versions_inner[] = [
'#theme' => 'update_version',
'#version' => $project['releases'][$project['latest_version']],
'#title' => t('Latest version:'),
'#attributes' => ['class' => ['version-latest']],
];
}
if ($project['install_type'] == 'dev'
&& $project['status'] != UPDATE_CURRENT
&& isset($project['dev_version'])
&& $project['recommended'] !== $project['dev_version']) {
$versions_inner[] = [
'#theme' => 'update_version',
'#version' => $project['releases'][$project['dev_version']],
'#title' => t('Development version:'),
'#attributes' => ['class' => ['version-latest']],
];
}
}
if (isset($project['also'])) {
foreach ($project['also'] as $also) {
$versions_inner[] = [
'#theme' => 'update_version',
'#version' => $project['releases'][$also],
'#title' => t('Also available:'),
'#attributes' => ['class' => ['version-also-available']],
];
}
}
if (!empty($versions_inner)) {
$variables['versions'] = $versions_inner;
}
if (!empty($project['disabled'])) {
sort($project['disabled']);
$variables['disabled'] = $project['disabled'];
}
sort($project['includes']);
$variables['includes'] = $project['includes'];
$variables['extras'] = [];
if (!empty($project['extra'])) {
foreach ($project['extra'] as $value) {
$extra_item = [];
$extra_item['attributes'] = new Attribute();
$extra_item['label'] = $value['label'];
$extra_item['data'] = [
'#prefix' => '<em>',
'#markup' => $value['data'],
'#suffix' => '</em>',
];
$variables['extras'][] = $extra_item;
}
}
// Set the project status details.
$status_label = NULL;
switch ($project['status']) {
case UPDATE_NOT_SECURE:
$status_label = t('Security update required!');
break;
case UPDATE_REVOKED:
$status_label = t('Revoked!');
break;
case UPDATE_NOT_SUPPORTED:
$status_label = t('Not supported!');
break;
case UPDATE_NOT_CURRENT:
$status_label = t('Update available');
break;
case UPDATE_CURRENT:
$status_label = t('Up to date');
break;
}
$variables['status']['label'] = $status_label;
$variables['status']['attributes'] = new Attribute();
$variables['status']['reason'] = (isset($project['reason'])) ? $project['reason'] : NULL;
switch ($project['status']) {
case UPDATE_CURRENT:
$uri = 'core/misc/icons/73b355/check.svg';
$text = t('Ok');
break;
case UPDATE_UNKNOWN:
case UPDATE_FETCH_PENDING:
case UPDATE_NOT_FETCHED:
$uri = 'core/misc/icons/e29700/warning.svg';
$text = t('Warning');
break;
case UPDATE_NOT_SECURE:
case UPDATE_REVOKED:
case UPDATE_NOT_SUPPORTED:
$uri = 'core/misc/icons/e32700/error.svg';
$text = t('Error');
break;
case UPDATE_NOT_CHECKED:
case UPDATE_NOT_CURRENT:
default:
$uri = 'core/misc/icons/e29700/warning.svg';
$text = t('Warning');
break;
}
$variables['status']['icon'] = [
'#theme' => 'image',
'#width' => 18,
'#height' => 18,
'#uri' => $uri,
'#alt' => $text,
'#title' => $text,
];
}
update.settings:
path: '/admin/reports/updates/settings'
defaults:
_form: '\Drupal\update\UpdateSettingsForm'
_title: 'Update Manager settings'
requirements:
_permission: 'administer site configuration'
update.status:
path: '/admin/reports/updates'
defaults:
_controller: '\Drupal\update\Controller\UpdateController::updateStatus'
_title: 'Available updates'
requirements:
_permission: 'administer site configuration'
update.manual_status:
path: '/admin/reports/updates/check'
defaults:
_title: 'Manual update check'
_controller: '\Drupal\update\Controller\UpdateController::updateStatusManually'
requirements:
_permission: 'administer site configuration'
_csrf_token: 'TRUE'
update.report_install:
path: '/admin/reports/updates/install'
defaults:
_form: '\Drupal\update\Form\UpdateManagerInstall'
_title: 'Install'
requirements:
_permission: 'administer software updates'
_access_update_manager: 'TRUE'
update.report_update:
path: '/admin/reports/updates/update'
defaults:
_form: '\Drupal\update\Form\UpdateManagerUpdate'
_title: 'Update'
requirements:
_permission: 'administer software updates'
_access_update_manager: 'TRUE'
update.module_install:
path: '/admin/modules/install'
defaults:
_form: '\Drupal\update\Form\UpdateManagerInstall'
_title: 'Install new module'
requirements:
_permission: 'administer software updates'
_access_update_manager: 'TRUE'
update.module_update:
path: '/admin/modules/update'
defaults:
_form: '\Drupal\update\Form\UpdateManagerUpdate'
_title: 'Update'
requirements:
_permission: 'administer software updates'
_access_update_manager: 'TRUE'
update.theme_install:
path: '/admin/theme/install'
defaults:
_form: '\Drupal\update\Form\UpdateManagerInstall'
_title: 'Install new theme'
requirements:
_permission: 'administer software updates'
_access_update_manager: 'TRUE'
update.theme_update:
path: '/admin/theme/update'
defaults:
_form: '\Drupal\update\Form\UpdateManagerUpdate'
_title: 'Update'
requirements:
_permission: 'administer software updates'
_access_update_manager: 'TRUE'
update.confirmation_page:
path: '/admin/update/ready'
defaults:
_form: '\Drupal\update\Form\UpdateReady'
_title: 'Ready to update'
requirements:
_permission: 'administer software updates'
_access_update_manager: 'TRUE'
services:
access_check.update.manager_access:
class: Drupal\update\Access\UpdateManagerAccessCheck
arguments: ['@settings']
tags:
- { name: access_check, applies_to: _access_update_manager }
update.manager:
class: Drupal\update\UpdateManager
arguments: ['@config.factory', '@module_handler', '@update.processor', '@string_translation', '@keyvalue.expirable', '@theme_handler']
update.processor:
class: Drupal\update\UpdateProcessor
arguments: ['@config.factory', '@queue', '@update.fetcher', '@state', '@private_key', '@keyvalue', '@keyvalue.expirable']
update.fetcher:
class: Drupal\update\UpdateFetcher
arguments: ['@config.factory', '@http_client']
update.root:
class: SplString
factory: update.root.factory:get
tags:
- { name: parameter_service }
update.root.factory:
class: Drupal\update\UpdateRootFactory
arguments: ['@kernel', '@request_stack']
public: false
...@@ -419,24 +419,6 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) { ...@@ -419,24 +419,6 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
]; ];
} }
// If module Update Manager is enabled.
if ($moduleHandler->moduleExists('update')) {
$links['update.module_update'] = [
'title' => t('Update'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'update.module_update',
'menu_name' => 'admin',
'parent' => 'system.modules_list',
];
$links['update.module_install'] = [
'title' => t('Install new module'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'update.module_install',
'menu_name' => 'admin',
'parent' => 'system.modules_list',
];
}
// If module Devel is enabled. // If module Devel is enabled.
if ($moduleHandler->moduleExists('devel')) { if ($moduleHandler->moduleExists('devel')) {
$links['admin_development'] = [ $links['admin_development'] = [
...@@ -573,37 +555,6 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) { ...@@ -573,37 +555,6 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
]; ];
} }
if ($moduleHandler->moduleExists('update')) {
$links['update.theme_install_'] = [
'title' => t('Install new theme'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'update.theme_install',
'menu_name' => 'admin',
'parent' => 'system.themes_page',
];
$links['update.theme_update_'] = [
'title' => t('Update'),
'provider' => 'admin_toolbar_tools',
'route_name' => 'update.theme_update',
'menu_name' => 'admin',
'parent' => 'system.themes_page',
];
// Lists installed themes.
$installed_themes = admin_toolbar_tools_installed_themes();
foreach ($installed_themes as $key_theme => $label_theme) {
$links['system.theme_settings_theme.' . $key_theme] = [
'title' => t($label_theme),
'provider' => 'admin_toolbar_tools',
'route_name' => 'system.theme_settings_theme',
'menu_name' => 'admin',
'parent' => 'system.theme_settings_',
'route_parameters' => [
'theme' => $key_theme,
],
];
}
}
// If module Language enabled. // If module Language enabled.
if ($moduleHandler->moduleExists('language')) { if ($moduleHandler->moduleExists('language')) {
$links['admin_toolbar_tools.language.negotiation'] = [ $links['admin_toolbar_tools.language.negotiation'] = [
......
...@@ -79,7 +79,6 @@ dependencies: ...@@ -79,7 +79,6 @@ dependencies:
- token - token
- toolbar - toolbar
- tour - tour
- update
- user - user
- video_embed_field - video_embed_field
- video_embed_media - video_embed_media
......
...@@ -23,10 +23,4 @@ function dar_install() { ...@@ -23,10 +23,4 @@ function dar_install() {
$node->save(); $node->save();
\Drupal::configFactory()->getEditable('system.site')->set('page.front', '/home')->save(); \Drupal::configFactory()->getEditable('system.site')->set('page.front', '/home')->save();
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler->moduleExists('update')) {
\Drupal::service('module_installer')->uninstall(['update']);
drupal_flush_all_caches();
}
} }
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