//CRM-5679
foreach ($params as $name => & $val) {
if ($val && in_array($name, array(
- 'newBaseURL', 'newBaseDir', 'newSiteName'))) {
+ 'newBaseDir', 'newSiteName'))) {
$val = CRM_Utils_File::addTrailingSlash($val);
}
}
+
+ //CRM-15365 - Fix BaseURL to avoid wrong trailing slash on Windows installs
+ foreach ($params as $name => & $val) {
+ if ($val && in_array($name, array(
+ 'newBaseURL'))) {
+ $val = CRM_Utils_File::addTrailingSlash($val,"/");
+ }
+ }
$from = array($this->_oldBaseURL, $this->_oldBaseDir);
$to = array(trim($params['newBaseURL']),
// lets use imageUploadDir since we dont mess around with its values
// in the config object, lets kep it a bit generic since folks
// might have different values etc
- $dir = preg_replace(
- '|civicrm/templates_c/.*$|',
- '',
- $config->templateCompileDir
- );
+
+ //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths
+ if(DIRECTORY_SEPARATOR == '\\')
+ {
+ $dir = preg_replace(
+ '|civicrm[/\\\\]templates_c[/\\\\].*$|',
+ '',
+ $config->templateCompileDir
+ );
+ }
+ else
+ {
+ $dir = preg_replace(
+ '|civicrm/templates_c/.*$|',
+ '',
+ $config->templateCompileDir
+ );
+ }
+
$siteRoot = preg_replace(
'|/media/civicrm/.*$|',
'',
// lets use imageUploadDir since we dont mess around with its values
// in the config object, lets kep it a bit generic since folks
// might have different values etc
- $dir = preg_replace(
- '|civicrm/templates_c/.*$|',
- '',
- $config->templateCompileDir
- );
+
+ //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths
+ if(DIRECTORY_SEPARATOR == '\\')
+ {
+ $dir = preg_replace(
+ '|civicrm[/\\\\]templates_c[/\\\\].*$|',
+ '',
+ $config->templateCompileDir
+ );
+ }
+ else
+ {
+ $dir = preg_replace(
+ '|civicrm/templates_c/.*$|',
+ '',
+ $config->templateCompileDir
+ );
+ }
+
$siteRoot = preg_replace(
'|/wp-content/plugins/files/civicrm/.*$|',
'',
// lets use imageUploadDir since we dont mess around with its values
// in the config object, lets kep it a bit generic since folks
// might have different values etc
- $dir = preg_replace(
- '|/files/civicrm/.*$|',
- '/files/',
- $config->imageUploadDir
- );
-
+
+ //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths
+ if(DIRECTORY_SEPARATOR == '\\')
+ {
+ $dir = preg_replace(
+ '|[/\\\\]files[/\\\\]civicrm[/\\\\].*$|',
+ '\\\\files\\\\',
+ $config->imageUploadDir
+ );
+ }
+ else
+ {
+ $dir = preg_replace(
+ '|/files/civicrm/.*$|',
+ '/files/',
+ $config->imageUploadDir
+ );
+ }
+
$matches = array();
if (preg_match(
'|/sites/([\w\.\-\_]+)/|',
}
}
-
return array($url, $dir, $siteName, $siteRoot);
}
*/
static function getBestGuessSettings() {
$config = CRM_Core_Config::singleton();
- $dir = preg_replace(
- '|civicrm/templates_c/.*$|',
+
+ //CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths
+ if(DIRECTORY_SEPARATOR == '\\')
+ $needle = 'civicrm[/\\\\]templates_c[/\\\\].*$';
+ else
+ $needle = 'civicrm/templates_c/.*$';
+
+ $dir = preg_replace(
+ "|$needle|",
'',
$config->templateCompileDir
);