Skip to content

Commit

Permalink
Better feedback when missing entries from the $notes structure.
Browse files Browse the repository at this point in the history
Our earlier releases do not have all of this information. Instead
of spamming STDOUT with exception and stack traces, output these
NOTICES instead.
  • Loading branch information
mrubinsk committed Jul 4, 2018
1 parent 6295de5 commit 3991745
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions lib/Horde/Pear/Package/Xml.php
Expand Up @@ -479,16 +479,36 @@ public function setNotes(array $notes)
if ($version == $thisVersion) {
$this->replaceTextNode('/p:package/p:notes', $new_notes);
}
$this->_warnOnEmptyInfo($version, $info);
$this->addVersion(
$version, $info['api'],
$info['state']['release'], $info['state']['api'],
$info['date'],
$info['license']['identifier'], $info['license']['uri'],
$version,
!empty($info['api']) ? $info['api'] : null,
!empty($info['state']['release']) ? $info['state']['release'] : null,
!empty($info['state']['api']) ? $info['state']['api'] : null,
!empty($info['date']) ? $info['date'] : null,
!empty($info['license']['identifier']) ? $info['license']['identifier'] : null,
!empty($info['license']['uri']) ? $info['license']['uri'] : null,
$new_notes
);
}
}

/**
* Write a warning to STDERR when missing the specified entries in the
* $info array.
*
* @param string $version The version the note entry is for.
* @param array $info The note info entry.
*/
protected function _warnOnEmptyInfo($version, $info)
{
foreach (array('api', 'state', 'date', 'license') as $entry) {
if (empty($info[$entry])) {
fwrite(STDERR, "NOTICE: Missing '$entry' entry in version $version\n");
}
}
}

/**
* Set the version in the package.xml
*
Expand Down

0 comments on commit 3991745

Please sign in to comment.