public function __construct(array $arguments = array()) { array_unshift($arguments, 'git'); $gitDir = \Mesamatrix::path(\Mesamatrix::$config->getValue("info", "private_dir")) . "/"; $gitDir .= \Mesamatrix::$config->getValue("git", "mesa_dir", "mesa.git"); foreach ($arguments as &$arg) { $arg = str_replace('@gitDir@', $gitDir, $arg); } parent::__construct($arguments); $this->setWorkingDirectory($gitDir); }
</td> <?php } } ?> </tr> </tfoot> </table> <?php } } } ///////////////////////////////////////////////// // Load XML. // $gl3Path = Mesamatrix::path(Mesamatrix::$config->getValue("info", "xml_file")); // Read "xml_file". $xml = simplexml_load_file($gl3Path); if (!$xml) { \Mesamatrix::$logger->critical("Can't read " . $gl3Path); exit; } // Set all the versions in an array so that it can be sorted out. $glVersions = array(); foreach ($xml->gl as $glVersion) { $glVersions[] = $glVersion; } // Sort the versions. usort($glVersions, function ($a, $b) { // Sort OpenGL before OpenGLES and higher versions before lower ones. if ((string) $a["name"] === (string) $b["name"]) {
/** * Take all the parsed commits and merged them to generate the final XML. * * @param array \Mesamatrix\Git\Commit $commits The commits to merge. */ protected function generateMergedXml(array $commits) { \Mesamatrix::$logger->info('Merge all the commits.'); $matrix = new OglMatrix(); foreach ($commits as $commit) { $hash = $commit->getHash(); $xmlPath = \Mesamatrix::path(\Mesamatrix::$config->getValue('info', 'private_dir')) . '/commits/commit_' . $hash . '.xml'; $mesa = simplexml_load_file($xmlPath); $matrix->merge($mesa, $commit); } \Mesamatrix::$logger->info('Generating XML file'); $xml = new \SimpleXMLElement("<mesa></mesa>"); $gitDir = \Mesamatrix::path(\Mesamatrix::$config->getValue('info', 'private_dir')) . '/'; $gitDir .= \Mesamatrix::$config->getValue('git', 'mesa_dir', 'mesa.git'); $updated = filemtime($gitDir . '/FETCH_HEAD'); $xml->addAttribute('updated', $updated); $drivers = $xml->addChild("drivers"); $this->populateDrivers($drivers); $statuses = $xml->addChild("statuses"); $this->populateStatuses($statuses); $xmlCommits = $xml->addChild('commits'); $this->generateCommitsLog($xmlCommits, $commits); $this->generateGlSections($xml, $matrix); $xmlPath = \Mesamatrix::path(\Mesamatrix::$config->getValue("info", "xml_file")); $dom = dom_import_simplexml($xml)->ownerDocument; $dom->formatOutput = true; file_put_contents($xmlPath, $dom->saveXML()); \Mesamatrix::$logger->info('XML saved to ' . $xmlPath); }