+
+ /**
+ * Clear the smarty cache and assign default values
+ */
+ function reset_smarty_assignments() {
+ $this->smarty->clear_all_assign();
+ $this->smarty->clear_all_cache();
+ $this->smarty->assign('generated', "DO NOT EDIT. Generated by " . basename(__FILE__));
+ }
+
+
+ /**
+ * 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_GenCode_Util_File::findCoreSourceDir();
+ $files = CRM_GenCode_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_GenCode_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;
+ }
+
+ function getExpectedFiles() {
+ return array(
+ $this->sqlCodePath . '/civicrm.mysql',
+ $this->phpCodePath . '/CRM/Contact/DAO/Contact.php',
+ );
+ }
+
+ function hasExpectedFiles() {
+ foreach ($this->getExpectedFiles() as $file) {
+ if (!file_exists($file)) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+ }