4 * Generate configuration files
6 class CRM_Core_CodeGen_Config
extends CRM_Core_CodeGen_BaseTask
{
7 public function run() {
11 public function setupCms() {
12 if (!in_array($this->config
->cms
, array(
19 echo "Config file for '{$this->config->cms}' not known.";
22 elseif ($this->config
->cms
!== 'joomla') {
23 $configTemplate = $this->findConfigTemplate($this->config
->cms
);
24 if ($configTemplate) {
25 echo "Generating civicrm.config.php\n";
26 copy($configTemplate, '../civicrm.config.php');
29 throw new Exception("Failed to locate template for civicrm.config.php");
36 * "drupal"|"wordpress".
38 * path to config template
40 public function findConfigTemplate($cms) {
41 $candidates = array();
45 $candidates[] = "../backdrop/civicrm.config.php.backdrop";
46 $candidates[] = "../../backdrop/civicrm.config.php.backdrop";
47 $candidates[] = "../drupal/civicrm.config.php.backdrop";
48 $candidates[] = "../../drupal/civicrm.config.php.backdrop";
52 $candidates[] = "../drupal/civicrm.config.php.drupal";
53 $candidates[] = "../../drupal/civicrm.config.php.drupal";
57 $candidates[] = "../../modules/civicrm/civicrm.config.php.drupal";
58 $candidates[] = "../../../modules/civicrm/civicrm.config.php.drupal";
62 $candidates[] = "../../civicrm.config.php.wordpress";
63 $candidates[] = "../WordPress/civicrm.config.php.wordpress";
66 foreach ($candidates as $candidate) {
67 if (file_exists($candidate)) {