4 * Generate configuration files
6 class CRM_Core_CodeGen_Config
extends CRM_Core_CodeGen_BaseTask
{
8 public function run() {
12 public function setupCms() {
13 if (!in_array($this->config
->cms
, [
20 echo "Config file for '{$this->config->cms}' not known.";
23 elseif ($this->config
->cms
!== 'joomla') {
24 $configTemplate = $this->findConfigTemplate($this->config
->cms
);
25 if ($configTemplate) {
26 echo "Generating civicrm.config.php\n";
27 copy($configTemplate, '../civicrm.config.php');
30 throw new Exception("Failed to locate template for civicrm.config.php");
37 * "drupal"|"wordpress".
39 * path to config template
41 public function findConfigTemplate($cms) {
42 if (getenv('GENCODE_CONFIG_TEMPLATE')) {
43 return getenv('GENCODE_CONFIG_TEMPLATE');
50 $candidates[] = "../backdrop/civicrm.config.php.backdrop";
51 $candidates[] = "../../backdrop/civicrm.config.php.backdrop";
52 $candidates[] = "../drupal/civicrm.config.php.backdrop";
53 $candidates[] = "../../drupal/civicrm.config.php.backdrop";
57 $candidates[] = "../drupal/civicrm.config.php.drupal";
58 $candidates[] = "../../drupal/civicrm.config.php.drupal";
62 $candidates[] = "../../modules/civicrm/civicrm.config.php.drupal";
63 $candidates[] = "../../../modules/civicrm/civicrm.config.php.drupal";
64 $candidates[] = "../../../modules/civicrm-drupal/civicrm.config.php.drupal";
68 $candidates[] = "../../civicrm.config.php.wordpress";
69 $candidates[] = "../WordPress/civicrm.config.php.wordpress";
72 foreach ($candidates as $candidate) {
73 if (file_exists($candidate)) {