/**
* Store patchfile entry to the changelog table
*
* @param array $patchFile
* @param string $description
* @return void
*/
protected function addToChangelog($patchFile, $description = null)
{
if ($description == null) {
$description = $patchFile->description;
}
if ($this->isPatchApplied($patchFile->patch_number, $patchFile->branch)) {
$this->writer->warning(sprintf('Skip %s, already exists in the changelog', $patchFile->basename));
} else {
$db = $this->getDb();
$sql = sprintf("\n INSERT INTO %s (patch_number, branch, completed, filename, description, hash)\n VALUES(%d, %s, NOW(), %s, %s, %s)", $db->quoteIdentifier(self::TABLE), $patchFile->patch_number, $db->quote($patchFile->branch), $db->quote($patchFile->basename), $db->quote($description), $db->quote($patchFile->hash));
$db->query($sql);
$db->commit();
$this->writer->line(sprintf('added %s to the changelog ', $patchFile->basename));
}
}