/** * Automatically generate a variety of files * */ function main() { if (!empty($this->digestPath) && file_exists($this->digestPath) && $this->hasExpectedFiles()) { if ($this->getDigest() === file_get_contents($this->digestPath)) { echo "GenCode has previously executed. To force execution, please (a) omit CIVICRM_GENCODE_DIGEST\n"; echo "or (b) remove {$this->digestPath} or (c) call GenCode with new parameters.\n"; exit; } // Once we start GenCode, the old build is invalid unlink($this->digestPath); } echo "\ncivicrm_domain.version := " . $this->db_version . "\n\n"; if ($this->buildVersion < 1.1) { echo "The Database is not compatible for this version"; exit; } if (substr(phpversion(), 0, 1) != 5) { echo phpversion() . ', ' . substr(phpversion(), 0, 1) . "\n"; echo "\nCiviCRM requires a PHP Version >= 5\nPlease upgrade your php / webserver configuration\nAlternatively you can get a version of CiviCRM that matches your PHP version\n"; exit; } $specification = new CRM_Core_CodeGen_Specification(); $specification->parse($this->schemaPath, $this->buildVersion); # cheese: $this->database = $specification->database; $this->tables = $specification->tables; $this->runAllTasks(); if (!empty($this->digestPath)) { file_put_contents($this->digestPath, $this->getDigest()); } }
protected function init() { if (!$this->database || !$this->tables) { $specification = new CRM_Core_CodeGen_Specification(); $specification->parse($this->schemaPath, $this->buildVersion); # cheese: $this->database = $specification->database; $this->tables = $specification->tables; } }