public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Settings - Cleanup Caches and Update Paths'));
- list($this->_oldBaseURL,
+ list(
+ $this->_oldBaseURL,
$this->_oldBaseDir,
$this->_oldSiteName
) = CRM_Core_BAO_ConfigSetting::getConfigSettings();
$this->assign('oldBaseDir', $this->_oldBaseDir);
$this->assign('oldSiteName', $this->_oldSiteName);
- $this->addElement('submit', $this->getButtonName('next', 'cleanup'), 'Cleanup Caches', array('class' => 'form-submit', 'id' => 'cleanup-cache'));
+ $this->addElement(
+ 'submit', $this->getButtonName('next', 'cleanup'), 'Cleanup Caches',
+ array('class' => 'form-submit', 'id' => 'cleanup-cache')
+ );
$this->add('text', 'newBaseURL', ts('New Base URL'), NULL, TRUE);
$this->add('text', 'newBaseDir', ts('New Base Directory'), NULL, TRUE);
parent::setDefaultValues();
$config = CRM_Core_Config::singleton();
- list($this->_defaults['newBaseURL'],
+ list(
+ $this->_defaults['newBaseURL'],
$this->_defaults['newBaseDir'],
$this->_defaults['newSiteName']
) = CRM_Core_BAO_ConfigSetting::getBestGuessSettings();
$url = $dir = $siteName = $siteRoot = NULL;
if ($config->userFramework == 'Joomla') {
- $url = preg_replace('|administrator/components/com_civicrm/civicrm/|',
+ $url = preg_replace(
+ '|administrator/components/com_civicrm/civicrm/|',
'',
$config->userFrameworkResourceURL
);
// 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/.*$|',
+ $dir = preg_replace(
+ '|civicrm/templates_c/.*$|',
'',
$config->templateCompileDir
);
- $siteRoot = preg_replace('|/media/civicrm/.*$|',
+ $siteRoot = preg_replace(
+ '|/media/civicrm/.*$|',
+ '',
+ $config->imageUploadDir
+ );
+ }
+ else if ($config->userFramework == 'WordPress') {
+ $url = preg_replace(
+ '|wp-content/plugins/civicrm/civicrm/|',
+ '',
+ $config->userFrameworkResourceURL
+ );
+
+ // 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
+ );
+ $siteRoot = preg_replace(
+ '|/wp-content/plugins/files/civicrm/.*$|',
'',
$config->imageUploadDir
);
}
else {
- $url = preg_replace('|sites/[\w\.\-\_]+/modules/civicrm/|',
+ $url = preg_replace(
+ '|sites/[\w\.\-\_]+/modules/civicrm/|',
'',
$config->userFrameworkResourceURL
);
// 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/.*$|',
+ $dir = preg_replace(
+ '|/files/civicrm/.*$|',
'/files/',
$config->imageUploadDir
);
$matches = array();
- if (preg_match('|/sites/([\w\.\-\_]+)/|',
+ if (preg_match(
+ '|/sites/([\w\.\-\_]+)/|',
$config->imageUploadDir,
$matches
)) {
$url = $config->userFrameworkBaseURL;
$siteName = $siteRoot = NULL;
if ($config->userFramework == 'Joomla') {
- $url = preg_replace('|/administrator|',
+ $url = preg_replace(
+ '|/administrator|',
'',
$config->userFrameworkBaseURL
);
- $siteRoot = preg_replace('|/media/civicrm/.*$|',
+ $siteRoot = preg_replace(
+ '|/media/civicrm/.*$|',
'',
$config->imageUploadDir
);
}
- $dir = preg_replace('|civicrm/templates_c/.*$|',
+
+ $dir = preg_replace(
+ '|civicrm/templates_c/.*$|',
'',
$config->templateCompileDir
);
- if ($config->userFramework != 'Joomla') {
+ if ($config->userFramework->is_drupal) {
$matches = array();
- if (preg_match('|/sites/([\w\.\-\_]+)/|',
+ if (preg_match(
+ '|/sites/([\w\.\-\_]+)/|',
$config->templateCompileDir,
$matches
)) {
{ts}Use this form if you need to reset the Base Directory Path and Base URL settings for your CiviCRM installation. These settings are stored in the database, and generally need adjusting after moving a CiviCRM installation to another location in the file system and/or to another URL.{/ts}</p>
<p>
{ts}CiviCRM will attempt to detect the new values that should be used. These are provided below as the default values for the <strong>New Base Directory</strong> and <strong>New Base URL</strong> fields.{/ts}</p>
-</div>
- <div>{$form._qf_UpdateConfigBackend_next_cleanup.html}</div>
+</div>
+ <div>{$form._qf_UpdateConfigBackend_next_cleanup.html}</div>
<table>
<tr class="crm-config-backend-form-block-oldBaseDir">
<td class="label">{ts}Old Base Directory{/ts}</td>
<tr class="crm-config-backend-form-block-newBaseDir">
<td class="label">{$form.newBaseDir.label}</td>
<td>{$form.newBaseDir.html|crmAddClass:'huge'}<br />
- <span class="description">{ts}For Drupal installs, this is the absolute path to the location of the 'files' directory. For Joomla installs this is the absolute path to the location of the 'media' directory.{/ts}</span></td>
+ <span class="description">{ts}For Drupal and WordPress installs, this is the absolute path to the location of the 'files' directory. For Joomla installs this is the absolute path to the location of the 'media' directory.{/ts}</span></td>
</tr>
<tr class="crm-config-backend-form-block-oldBaseURL">
<td class="label">{ts}Old Base URL{/ts}</td>
<tr class="crm-config-backend-form-block-newBaseURL">
<td class="label">{$form.newBaseURL.label}</td>
<td>{$form.newBaseURL.html|crmAddClass:'huge'}<br />
- <span class="description">{ts}This is the URL for your Drupal or Joomla site URL (e.g. http://www.mysite.com/drupal/).{/ts}</span></td>
+ <span class="description">{ts}This is the URL for your Drupal, Joomla or WordPress site (e.g. http://www.mysite.com/drupal/).{/ts}</span></td>
</tr>
{if $oldSiteName}
<tr class="crm-config-backend-form-block-oldSiteName">
<td>{$form.newSiteName.html|crmAddClass:'huge'}<br />
<span class="description">{ts}This is the your site name for a multisite install.{/ts}</span></td>
</tr>
-{/if}
+{/if}
</table>
<div>{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
<div class="spacer"></div>