*
*/
function main() {
- if (!empty($this->digestPath) && file_exists($this->digestPath)) {
+ 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";
}
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;
+ }
}