$baseURL = str_replace('http://', 'https://', $baseURL);
}
- if ($config->userFramework == 'Joomla') {
- $userFrameworkResourceURL = $baseURL . "components/com_civicrm/civicrm/";
- }
- elseif ($config->userFramework == 'WordPress') {
- $userFrameworkResourceURL = CIVICRM_PLUGIN_URL . "civicrm/";
- }
- elseif ($this->is_drupal) {
+ // @todo this function is only called / code is only reached when is_drupal is true - move this to the drupal classes
+ // and don't implement here.
+ if ($this->is_drupal) {
// Drupal setting
// check and see if we are installed in sites/all (for D5 and above)
// we dont use checkURL since drupal generates an error page and throws
];
}
+ /**
+ * Determine the location of the CiviCRM source tree.
+ *
+ * FIXME:
+ * 1. This was pulled out from a bigger function. It should be split
+ * into even smaller pieces and marked abstract.
+ * 2. This would be easier to compute by a calling a CMS API, but
+ * for whatever reason we take the hard way.
+ *
+ * @return array
+ * - url: string. ex: "http://example.com/sites/all/modules/civicrm"
+ * - path: string. ex: "/var/www/sites/all/modules/civicrm"
+ */
+ public function getCiviSourceStorage() {
+ global $civicrm_root;
+ if (!defined('CIVICRM_UF_BASEURL')) {
+ throw new RuntimeException('Undefined constant: CIVICRM_UF_BASEURL');
+ }
+ $baseURL = CRM_Utils_File::addTrailingSlash(CIVICRM_UF_BASEURL, '/');
+ if (CRM_Utils_System::isSSL()) {
+ $baseURL = str_replace('http://', 'https://', $baseURL);
+ }
+
+ // For Joomla CiviCRM Core files always live within the admistrator folder and $base_url is different on the frontend compared to the backend.
+ if (strpos($baseURL, 'administrator') === FALSE) {
+ $userFrameworkResourceURL = $baseURL . "administrator/components/com_civicrm/civicrm/";
+ }
+ else {
+ $userFrameworkResourceURL = $baseURL . "components/com_civicrm/civicrm/";
+ }
+
+ return [
+ 'url' => CRM_Utils_File::addTrailingSlash($userFrameworkResourceURL, '/'),
+ 'path' => CRM_Utils_File::addTrailingSlash($civicrm_root),
+ ];
+ }
+
}