/** * @param WorkingCopy $wc * @param string $path * @param string $current_branch * * @return DOMDocument */ public function getReleaseXML($wc, $path, $current_branch) { /*$release_log_file = "$path/release-log.xml"; if (file_exists($release_log_file)) { $log = file_get_contents($release_log_file); } else { $log = $wc->log($path, 1000, true); }*/ $log = $wc->log($path, 1000, true); $dom_log = new DOMDocument(); $dom_log->loadXML($log); $xpath_log = new DOMXPath($dom_log); /** @var DOMElement $last_log_lement */ $last_log_lement = $xpath_log->query("(/log/logentry)[last()]")->item(0); $release_date = $xpath_log->query("date", $last_log_lement)->item(0)->nodeValue; $release_rev = $last_log_lement->getAttribute("revision"); // release.xml file $release_element = new DOMElement("release"); $dom_release = new DOMDocument(); $dom_release->appendChild($release_element); $release_element->setAttribute("code", $current_branch); $release_element->setAttribute("date", $release_date); $release_element->setAttribute("revision", $release_rev); return $dom_release; }