private function _getHistoryBuilds(Xinc_Project $project, $start, $limit = null) { /**$statusDir = Xinc_Gui_Handler::getInstance()->getStatusDir(); $historyFile = $statusDir . DIRECTORY_SEPARATOR . $project->getName() . '.history'; $buildHistoryArr = unserialize(file_get_contents($historyFile)); $totalCount = count($buildHistoryArr); if ($limit==null) { $limit = $totalCount; } /** * turn it upside down so the latest builds appear first */ /** $buildHistoryArr = array_reverse($buildHistoryArr, true); $buildHistoryArr = array_slice($buildHistoryArr, $start, $limit, true);*/ $buildHistoryArr = Xinc_Build_History::getFromTo($project, $start, $limit); $totalCount = Xinc_Build_History::getCount($project); $builds = array(); foreach ($buildHistoryArr as $buildTimestamp => $buildFileName) { try { //$buildObject = Xinc_Build::unserialize($project, // $buildTimestamp, // Xinc_Gui_Handler::getInstance()->getStatusDir()); $buildObject = Xinc_Build_Repository::getBuild($project, $buildTimestamp); $builds[] = array('number' => $buildObject->getNumber(), 'y' => $buildObject->getStatistics()->get('build.duration'), 'xlabel' => $buildObject->getNumber()); } catch (Exception $e) { // TODO: Handle } } $builds = array_reverse($builds, true); return $builds; }
private function _getHistoryBuilds($projectName, $start, $limit = null) { $project = new Xinc_Project(); $project->setName($projectName); try { $buildHistoryArr = Xinc_Build_History::getFromTo($project, $start, $limit); $totalCount = Xinc_Build_History::getCount($project); $builds = array(); foreach ($buildHistoryArr as $buildTimestamp => $buildFileName) { try { //echo $buildTimestamp . ' - '. $buildFileName . "<br>"; //Xinc_Build_Repository::getBuild($project, $buildTimestamp); //$buildObject = Xinc_Build::unserialize($project, // $buildTimestamp, // Xinc_Gui_Handler::getInstance()->getStatusDir()); $buildObject = Xinc_Build_Repository::getBuild($project, $buildTimestamp); $timezone = $buildObject->getConfigDirective('timezone'); if ($timezone !== null) { Xinc_Timezone::set($timezone); } $builds[] = array('buildtime' => date('Y-m-d H:i:s', $buildObject->getBuildTime()), 'timezone' => Xinc_Timezone::get(), 'buildtimeRaw' => $buildObject->getBuildTime(), 'label' => $buildObject->getLabel(), 'status' => $buildObject->getStatus()); /** * restore to system timezone */ $xincTimezone = Xinc_Gui_Handler::getInstance()->getConfigDirective('timezone'); if ($xincTimezone !== null) { Xinc_Timezone::set($xincTimezone); } else { Xinc_Timezone::reset(); } } catch (Exception $e) { // TODO: Handle } } //$builds = array_reverse($builds); } catch (Exception $e) { $builds = array(); $totalCount = 0; } $object = new stdClass(); $object->totalcount = $totalCount; $object->builds = $builds; //return new Xinc_Build_Iterator($builds); return $object; }