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
, [
21 echo "Config file for '{$this->config->cms}' not known.";
24 elseif ($this->config
->cms
!== 'joomla') {
25 $configTemplate = $this->findConfigTemplate($this->config
->cms
);
26 if ($configTemplate) {
27 echo "Generating civicrm.config.php\n";
28 copy($configTemplate, '../civicrm.config.php');
31 throw new Exception("Failed to locate template for civicrm.config.php");
38 * "drupal"|"wordpress".
40 * path to config template
42 public function findConfigTemplate($cms) {
43 if (getenv('GENCODE_CONFIG_TEMPLATE')) {
44 return getenv('GENCODE_CONFIG_TEMPLATE');
51 $candidates[] = "../backdrop/civicrm.config.php.backdrop";
52 $candidates[] = "../../backdrop/civicrm.config.php.backdrop";
53 $candidates[] = "../drupal/civicrm.config.php.backdrop";
54 $candidates[] = "../../drupal/civicrm.config.php.backdrop";
58 $candidates[] = "../drupal/civicrm.config.php.drupal";
59 $candidates[] = "../../drupal/civicrm.config.php.drupal";
63 $candidates[] = "../../modules/civicrm/civicrm.config.php.drupal";
64 $candidates[] = "../../../modules/civicrm/civicrm.config.php.drupal";
65 $candidates[] = "../../../modules/civicrm-drupal/civicrm.config.php.drupal";
69 $candidates[] = "../../../../civicrm.config.php.standalone";
73 $candidates[] = "../../civicrm.config.php.wordpress";
74 $candidates[] = "../WordPress/civicrm.config.php.wordpress";
77 foreach ($candidates as $candidate) {
78 if (file_exists($candidate)) {