From 390bd31aa9966d40d6c4404ad9791a44a3e217f4 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 26 Jul 2016 22:50:50 -0700 Subject: [PATCH] CRM-14885 - CRM_Core_CodeGen - Split `Config` and `Version` tasks --- CRM/Core/CodeGen/Config.php | 12 ------------ CRM/Core/CodeGen/Main.php | 1 + CRM/Core/CodeGen/Version.php | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 CRM/Core/CodeGen/Version.php diff --git a/CRM/Core/CodeGen/Config.php b/CRM/Core/CodeGen/Config.php index 90cb4151fc..c01834d3bb 100644 --- a/CRM/Core/CodeGen/Config.php +++ b/CRM/Core/CodeGen/Config.php @@ -5,15 +5,9 @@ */ class CRM_Core_CodeGen_Config extends CRM_Core_CodeGen_BaseTask { public function run() { - $this->generateTemplateVersion(); - $this->setupCms(); } - public function generateTemplateVersion() { - file_put_contents($this->config->tplCodePath . "/CRM/common/version.tpl", $this->config->db_version); - } - public function setupCms() { if (!in_array($this->config->cms, array( 'backdrop', @@ -35,12 +29,6 @@ class CRM_Core_CodeGen_Config extends CRM_Core_CodeGen_BaseTask { throw new Exception("Failed to locate template for civicrm.config.php"); } } - - echo "Generating civicrm-version file\n"; - $template = new CRM_Core_CodeGen_Util_Template('php'); - $template->assign('db_version', $this->config->db_version); - $template->assign('cms', ucwords($this->config->cms)); - $template->run('civicrm_version.tpl', $this->config->phpCodePath . "civicrm-version.php"); } /** diff --git a/CRM/Core/CodeGen/Main.php b/CRM/Core/CodeGen/Main.php index 0c3674fb9e..0fdab711a6 100644 --- a/CRM/Core/CodeGen/Main.php +++ b/CRM/Core/CodeGen/Main.php @@ -100,6 +100,7 @@ Alternatively you can get a version of CiviCRM that matches your PHP version public function getTasks() { $tasks = array(); $tasks[] = new CRM_Core_CodeGen_Config($this); + $tasks[] = new CRM_Core_CodeGen_Version($this); $tasks[] = new CRM_Core_CodeGen_Reflection($this); $tasks[] = new CRM_Core_CodeGen_Schema($this); foreach (array_keys($this->tables) as $name) { diff --git a/CRM/Core/CodeGen/Version.php b/CRM/Core/CodeGen/Version.php new file mode 100644 index 0000000000..eb7272edde --- /dev/null +++ b/CRM/Core/CodeGen/Version.php @@ -0,0 +1,18 @@ +config->tplCodePath . "/CRM/common/version.tpl", $this->config->db_version); + + $template = new CRM_Core_CodeGen_Util_Template('php'); + $template->assign('db_version', $this->config->db_version); + $template->assign('cms', ucwords($this->config->cms)); + $template->run('civicrm_version.tpl', $this->config->phpCodePath . "civicrm-version.php"); + } + +} -- 2.25.1