Commit 17511f38 authored by totten's avatar totten Committed by Seamus Lee
Browse files

CRM-20600 - Upgrader - Display warning if asset-caching is likely to fail

After releasing v4.7.21, there were several inquiries about sites in which
Angular pages failed to load.  In cases diagnosed so far, this has been a
result of inconsistent configurations or overzealous HTTP restrictions
applied to the `imageUploadDir`.

Ordinarily, we would address this kind of thing with a status check.
Unfortunately, the problem breaks that "Status" page...  so we have to
display a bit sooner.
parent 149b6561
......@@ -62,6 +62,16 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base
if ($rev == '4.7.13') {
$preUpgradeMessage .= '<p>' . ts('A new permission has been added called %1 This Permission is now used to control access to the Manage Tags screen', array(1 => 'manage tags')) . '</p>';
}
if ($rev == '4.7.22') {
// Based on support inquiries for 4.7.21, show message during 4.7.22.
// For affected users, this issue prevents loading the regular status screen.
if (!$this->checkImageUploadDir()) {
$preUpgradeMessage .= '<p>' . ts('There appears to be an inconsistency in the configuration of "Image Upload URL" and "Image Upload Directory".') . '</p>'
. '<p>'
. ts('Further advice will be displayed at the end of the upgrade.')
. '</p>';
}
}
}
/**
......@@ -122,6 +132,26 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base
$postUpgradeMessage .= '<p>civicrm_sms_provider ' . ts('has now had a domain id column added. As there is more than 1 domains in this install you need to manually set the domain id for the providers in this install') . '</p>';
}
}
if ($rev == '4.7.22') {
// Based on support inquiries for 4.7.21, show message during 4.7.22.
// For affected users, this issue prevents loading the regular status screen.
if (!$this->checkImageUploadDir()) {
$config = CRM_Core_Config::singleton();
$postUpgradeMessage .=
'<h3>' . ts('Warning') . '</h3>'
. '<p>' . ts('There appears to be an inconsistency in the configuration of "Image Upload URL" and "Image Upload Directory".') . '</p>'
. sprintf("<ul><li><b>imageUploadDir</b>: <code>%s</code></li><li><b>imageUploadURL</b>: <code>%s</code></li></ul>", htmlentities($config->imageUploadDir), htmlentities($config->imageUploadURL))
. '<p>'
. ts('You may need to check that: <ul><li>(a) the path and URL match,</li><li> (b) the httpd/htaccess policy allows requests for files inside this folder,</li><li>and (c) the web domain matches the normal web domain.</ul>')
. '</p>'
. '<p><em>'
. ts('(Note: Although files should be readable, it is best if they are not listable or browseable.)')
. '</em></p>'
. '<p>'
. ts('If this remains unresolved, then some important screens may fail to load.')
. '</p>';
}
}
if ($rev == '4.7.23') {
$postUpgradeMessage .= '<br /><br />' . ts('Default version of the following System Workflow Message Templates have been modified: <ul><li>Contribution Invoice</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).');
}
......@@ -1158,4 +1188,13 @@ FROM `civicrm_dashboard_contact` JOIN `civicrm_contact` WHERE civicrm_dashboard_
return TRUE;
}
/**
* @return bool
*/
protected function checkImageUploadDir() {
$config = CRM_Core_Config::singleton();
$check = new CRM_Utils_Check_Component_Security();
return $config->imageUploadDir && $config->imageUploadURL && $check->isDirAccessible($config->imageUploadDir, $config->imageUploadURL);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment