Skip to content

Commit

Permalink
Rebuild complete changelog in setNotes().
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Dec 11, 2017
1 parent 56d7676 commit 76465b8
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/Horde/Pear/Package/Xml.php
Expand Up @@ -468,26 +468,24 @@ public function addNote($note)
public function setNotes(array $notes)
{
$thisVersion = $this->getVersion();
foreach ($this->findNodes('/p:package/p:changelog/p:release') as $release) {
$this->removeWhitespace($release->previousSibling);
$release->parentNode->removeChild($release);
}
foreach ($notes as $version => $info) {
$new_notes = "\n* "
. implode("\n* ", explode("\n", trim($info['notes'])))
. "\n ";
if ($version == $thisVersion) {
$this->replaceTextNode('/p:package/p:notes', $new_notes);
}
if ($node = $this->_fetchRelease($version)) {
$this->replaceTextNodeRelativeTo(
'./p:notes', $node, $new_notes . ' '
);
} elseif (isset($info['date'])) {
$this->addVersion(
$version, $info['api'],
$info['state']['release'], $info['state']['api'],
$info['date'],
$info['license']['identifier'], $info['license']['uri'],
$new_notes
);
}
$this->addVersion(
$version, $info['api'],
$info['state']['release'], $info['state']['api'],
$info['date'],
$info['license']['identifier'], $info['license']['uri'],
$new_notes
);
}
}

Expand Down

0 comments on commit 76465b8

Please sign in to comment.