/** * Get templates_c directory. * * @return string */ public function getCompileDir() { if ($this->compileDir === NULL) { $this->compileDir = CRM_Core_CodeGen_Util_File::createTempDir('templates_c_'); } return $this->compileDir; }
/** * @return string */ public function getAbsFileName() { $directory = $this->config->phpCodePath . $this->tables[$this->name]['base']; CRM_Core_CodeGen_Util_File::createDir($directory); $absFileName = $directory . $this->getRelFileName(); return $absFileName; }
public function run() { CRM_Core_CodeGen_Util_File::createDir($this->config->sqlCodePath); $this->generateCreateSql(); $this->generateDropSql(); $this->generateLocaleDataSql(); // also create the archive tables // $this->generateCreateSql('civicrm_archive.mysql' ); // $this->generateDropSql('civicrm_archive_drop.mysql'); $this->generateNavigation(); $this->generateSample(); }
public function generateDAOs() { foreach (array_keys($this->tables) as $name) { echo "Generating {$name} as " . $this->tables[$name]['fileName'] . "\n"; if (empty($this->tables[$name]['base'])) { echo "No base defined for {$name}, skipping output generation\n"; continue; } $template = new CRM_Core_CodeGen_Util_Template('php'); $template->assign('table', $this->tables[$name]); $directory = $this->config->phpCodePath . $this->tables[$name]['base']; CRM_Core_CodeGen_Util_File::createDir($directory); $template->run('dao.tpl', $directory . $this->tables[$name]['fileName']); } }
/** * Compute a digest based on the inputs to the code-generator (ie the properties * of the codegen and the source files loaded by the codegen). * * @return string */ function getDigest() { if ($this->digest === NULL) { $srcDir = CRM_Core_CodeGen_Util_File::findCoreSourceDir(); $files = CRM_Core_CodeGen_Util_File::findManyFiles(array(array("{$srcDir}/CRM/Core/CodeGen", '*.php'), array("{$srcDir}/xml", "*.php"), array("{$srcDir}/xml", "*.tpl"), array("{$srcDir}/xml", "*.xml"))); $properties = var_export(array(CRM_Core_CodeGen_Util_File::digestAll($files), $this->buildVersion, $this->db_version, $this->cms, $this->CoreDAOCodePath, $this->sqlCodePath, $this->phpCodePath, $this->tplCodePath, $this->schemaPath, $this->getTasks()), TRUE); $this->digest = md5($properties); } return $this->digest; }
/** * Compute a digest based on the GenCode logic (PHP/tpl). * * @return string */ public function getSourceDigest() { if ($this->sourceDigest === NULL) { $srcDir = CRM_Core_CodeGen_Util_File::findCoreSourceDir(); $files = CRM_Core_CodeGen_Util_File::findManyFiles(array(array("{$srcDir}/CRM/Core/CodeGen", '*.php'), array("{$srcDir}/xml", "*.php"), array("{$srcDir}/xml", "*.tpl"))); $this->sourceDigest = CRM_Core_CodeGen_Util_File::digestAll($files); } return $this->sourceDigest; }
function __destruct() { CRM_Core_CodeGen_Util_File::removeDir($this->compileDir); }