Skip to content

Commit

Permalink
Fix warning when parsing release xml from Drupal.org (#4715)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Mar 30, 2021
1 parent 436a581 commit 687f954
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions lib/Drush/UpdateService/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,24 +229,26 @@ private static function parseXml(\SimpleXMLElement $xml) {

// Extract files.
$release_info['files'] = array();
foreach ($release->files->children() as $file) {
// Normalize keys to match the ones in the release info.
$item = array(
'download_link' => (string) $file->url,
'date' => (string) $file->filedate,
'mdhash' => (string) $file->md5,
'filesize' => (string) $file->size,
'archive_type' => (string) $file->archive_type,
);
if (!empty($file->variant)) {
$item['variant'] = (string) $file->variant;
}
$release_info['files'][] = $item;
if (!empty($release->files)) {
foreach ($release->files->children() as $file) {
// Normalize keys to match the ones in the release info.
$item = array(
'download_link' => (string) $file->url,
'date' => (string) $file->filedate,
'mdhash' => (string) $file->md5,
'filesize' => (string) $file->size,
'archive_type' => (string) $file->archive_type,
);
if (!empty($file->variant)) {
$item['variant'] = (string) $file->variant;
}
$release_info['files'][] = $item;

// Copy the mdhash from the matching download file into the
// root of the release object (make /current structure like /8.x)
if ($item['download_link'] == $release_info['download_link'] && !isset($release_info['mdhash'])) {
$release_info['mdhash'] = $item['mdhash'];
// Copy the mdhash from the matching download file into the
// root of the release object (make /current structure like /8.x)
if ($item['download_link'] == $release_info['download_link'] && !isset($release_info['mdhash'])) {
$release_info['mdhash'] = $item['mdhash'];
}
}
}

Expand Down

0 comments on commit 687f954

Please sign in to comment.