Merge pull request #11678 from mukeshcompucorp/CRM-21770-change-position-of-help...
[civicrm-core.git] / install / civicrm.php
index 50e42710811059fb85a438bcf007c5259777be22..591079d3cd73cb6a31f42d3617c1fb8b6d7c4ca7 100644 (file)
@@ -84,8 +84,7 @@ function civicrm_main(&$config) {
 
   if ($installType == 'drupal') {
     $siteDir = isset($config['site_dir']) ? $config['site_dir'] : getSiteDir($cmsPath, $_SERVER['SCRIPT_FILENAME']);
-    civicrm_setup($cmsPath . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR .
-      $siteDir . DIRECTORY_SEPARATOR . 'files'
+    civicrm_setup($cmsPath . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . $siteDir . DIRECTORY_SEPARATOR . 'files'
     );
   }
   elseif ($installType == 'backdrop') {
@@ -139,7 +138,6 @@ function civicrm_main(&$config) {
   civicrm_write_file($configFile,
     $string
   );
-
 }
 
 /**
@@ -217,6 +215,9 @@ function civicrm_config(&$config) {
   global $compileDir;
   global $tplPath, $installType;
 
+  // Ex: $extraSettings[] = '$civicrm_settings["domain"]["foo"] = "bar";';
+  $extraSettings = array();
+
   $params = array(
     'crmRoot' => $crmPath,
     'templateCompileDir' => $compileDir,
@@ -274,6 +275,18 @@ function civicrm_config(&$config) {
 
     // CRM-12386
     $params['crmRoot'] = addslashes($params['crmRoot']);
+    //CRM-16421
+
+    $extraSettings[] = sprintf('$civicrm_paths[\'wp.frontend.base\'][\'url\'] = %s;', var_export(home_url() . '/', 1));
+    $extraSettings[] = sprintf('$civicrm_paths[\'wp.backend.base\'][\'url\'] = %s;', var_export(admin_url(), 1));
+    $extraSettings[] = sprintf('$civicrm_setting[\'URL Preferences\'][\'userFrameworkResourceURL\'] = %s;', var_export(plugin_dir_url(CIVICRM_PLUGIN_FILE) . 'civicrm', 1));
+  }
+
+  if ($extraSettings) {
+    $params['extraSettings'] = "Additional settings generated by installer:\n" . implode("\n", $extraSettings);
+  }
+  else {
+    $params['extraSettings'] = "";
   }
 
   $params['siteKey'] = md5(rand() . mt_rand() . rand() . uniqid('', TRUE) . $params['baseURL']);