From 693f0bff2aa10f0317b662e09162ba51740f246c Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 15 Jan 2014 15:17:59 -0800 Subject: [PATCH] GenCode - Ignore cache/digest if some key files are missing --- CRM/Core/CodeGen/Main.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CRM/Core/CodeGen/Main.php b/CRM/Core/CodeGen/Main.php index f115ba7a27..a5d85822bb 100644 --- a/CRM/Core/CodeGen/Main.php +++ b/CRM/Core/CodeGen/Main.php @@ -52,7 +52,7 @@ class CRM_Core_CodeGen_Main { * */ 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"; @@ -155,4 +155,20 @@ Alternatively you can get a version of CiviCRM that matches your PHP version } 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; + } } -- 2.25.1