From f431d51f2c5e148359ba2d6e9c932298d93ed850 Mon Sep 17 00:00:00 2001 From: JKingsnorth Date: Mon, 27 Jul 2015 11:43:29 +0100 Subject: [PATCH] CRM-16478 Initial changes to remove custom error template path --- CRM/Admin/Form/Setting/Debugging.php | 1 - CRM/Core/Config/Variables.php | 7 ----- CRM/Core/Error.php | 6 ++-- CRM/Upgrade/Incremental/php/FourSeven.php | 30 +++++++++++++++++++ .../Incremental/sql/4.7.alpha1.mysql.tpl | 5 +++- api/v3/examples/Setting/GetFields.php | 15 ---------- settings/Developer.setting.php | 15 ---------- .../CRM/Admin/Form/Setting/Debugging.tpl | 5 ---- 8 files changed, 36 insertions(+), 48 deletions(-) diff --git a/CRM/Admin/Form/Setting/Debugging.php b/CRM/Admin/Form/Setting/Debugging.php index a980afe747..993a95faee 100644 --- a/CRM/Admin/Form/Setting/Debugging.php +++ b/CRM/Admin/Form/Setting/Debugging.php @@ -42,7 +42,6 @@ class CRM_Admin_Form_Setting_Debugging extends CRM_Admin_Form_Setting { protected $_settings = array( 'debug_enabled' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME, 'backtrace' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME, - 'fatalErrorTemplate' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME, 'fatalErrorHandler' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME, ); diff --git a/CRM/Core/Config/Variables.php b/CRM/Core/Config/Variables.php index 09f82b2ee5..9220bbe3a9 100644 --- a/CRM/Core/Config/Variables.php +++ b/CRM/Core/Config/Variables.php @@ -363,13 +363,6 @@ class CRM_Core_Config_Variables extends CRM_Core_Config_Defaults { */ public $enableSSL = FALSE; - /** - * Error template to use for fatal errors - * - * @var string - */ - public $fatalErrorTemplate = 'CRM/common/fatal.tpl'; - /** * Fatal error handler * diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index 3afdd9b206..24ecba1c65 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -378,10 +378,8 @@ class CRM_Core_Error extends PEAR_ErrorStack { } $template = CRM_Core_Smarty::singleton(); - $template->assign($vars); - - $config->userSystem->outputError($template->fetch($config->fatalErrorTemplate)); + $config->userSystem->outputError($template->fetch('CRM/common/fatal.tpl')); self::abend(CRM_Core_Error::FATAL_ERROR); } @@ -447,7 +445,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { // print to screen $template = CRM_Core_Smarty::singleton(); $template->assign($vars); - $content = $template->fetch($config->fatalErrorTemplate); + $content = $template->fetch('CRM/common/fatal.tpl'); if ($config->backtrace) { $content = self::formatHtmlException($exception) . $content; } diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php index 9398979f9b..cf30494a6d 100644 --- a/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/CRM/Upgrade/Incremental/php/FourSeven.php @@ -29,6 +29,34 @@ */ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base { + /** + * Compute any messages which should be displayed beforeupgrade. + * + * Note: This function is called iteratively for each upcoming + * revision to the database. + * + * @param $preUpgradeMessage + * @param string $rev + * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'. + * @param null $currentVer + * + * @return void + */ + public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) { + if ($rev == '4.7.alpha1') { + + // CRM-16478 Remove custom fatal error template path option + $config = CRM_Core_Config::singleton(); + if ($config->fatalErrorTemplate != 'CRM/common/fatal.tpl') { + $preUpgradeMessage .= '

' . ts('The custom fatal error template setting will be removed during the upgrade. You are currently using this custom template: %1 . Following the upgrade you will need to use the standard approach to overriding template files, as described in the documentation.', array(1 => $config->fatalErrorTemplate)) . '

'; + } + else { + $preUpgradeMessage .= '

' . ts('The custom fatal error template setting will be removed during the upgrade, but you are not currently using this option.') . '

'; + } + + } + } + /** * Compute any messages which should be displayed after upgrade. * @@ -65,6 +93,8 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base $postUpgradeMessage .= '

' . ts('CiviCRM now includes the easy-to-use CKEditor Configurator. To customize the features and display of your wysiwyg editor, visit the Display Preferences page. Learn more...', array(1 => $dsp_href, 2 => $blog_href)) . '

'; $postUpgradeMessage .= '

' . ts('Default version of the following System Workflow Message Templates have been modified: 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).'); + + $postUpgradeMessage .= '

' . ts('The custom fatal error template setting has been removed.') . '

'; } } diff --git a/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl index 260c07b272..d9aaee70e3 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl @@ -24,6 +24,9 @@ UPDATE civicrm_option_value SET {localize field="label"}label = 'Activity Summar {include file='../CRM/Upgrade/4.7.alpha1.msg_template/civicrm_msg_template.tpl'} +-- CRM-16478 Remove custom fatal error template path +DELETE FROM civicrm_setting WHERE name = 'fatalErrorTemplate'; + UPDATE civicrm_state_province SET name = 'Bataan' WHERE name = 'Batasn'; --CRM-16914 @@ -39,4 +42,4 @@ ADD COLUMN UPDATE civicrm_country SET `name` = UPPER( `name` ); -- CRM-16447 -UPDATE civicrm_state_province SET name = 'Northern Ostrobothnia' WHERE name = 'Nothern Ostrobothnia'; \ No newline at end of file +UPDATE civicrm_state_province SET name = 'Northern Ostrobothnia' WHERE name = 'Nothern Ostrobothnia'; diff --git a/api/v3/examples/Setting/GetFields.php b/api/v3/examples/Setting/GetFields.php index 87a74e7be0..40036da3b5 100644 --- a/api/v3/examples/Setting/GetFields.php +++ b/api/v3/examples/Setting/GetFields.php @@ -947,21 +947,6 @@ function setting_getfields_expectedresult() { 'description' => 'Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites', 'prefetch' => 1, ), - 'fatalErrorTemplate' => array( - 'group_name' => 'Developer Preferences', - 'group' => 'developer', - 'name' => 'fatalErrorTemplate', - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'default' => 'CRM/common/fatal.tpl', - 'add' => '4.3', - 'title' => 'Fatal Error Template', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Enter the path and filename for a custom Smarty template if you want to define your own screen for displaying fatal errors.', - 'prefetch' => 1, - ), 'fatalErrorHandler' => array( 'group_name' => 'Developer Preferences', 'group' => 'developer', diff --git a/settings/Developer.setting.php b/settings/Developer.setting.php index cdd2cc471f..e462adeb95 100644 --- a/settings/Developer.setting.php +++ b/settings/Developer.setting.php @@ -82,21 +82,6 @@ return array( 'description' => "Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites", 'prefetch' => 1, ), - 'fatalErrorTemplate' => array( - 'group_name' => 'Developer Preferences', - 'group' => 'developer', - 'name' => 'fatalErrorTemplate', - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'default' => 'CRM/common/fatal.tpl', - 'add' => '4.3', - 'title' => 'Fatal Error Template', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => "Enter the path and filename for a custom Smarty template if you want to define your own screen for displaying fatal errors.", - 'prefetch' => 1, - ), 'fatalErrorHandler' => array( 'group_name' => 'Developer Preferences', 'group' => 'developer', diff --git a/templates/CRM/Admin/Form/Setting/Debugging.tpl b/templates/CRM/Admin/Form/Setting/Debugging.tpl index 22ce0760b1..257dcaf4a7 100644 --- a/templates/CRM/Admin/Form/Setting/Debugging.tpl +++ b/templates/CRM/Admin/Form/Setting/Debugging.tpl @@ -46,11 +46,6 @@ {$form.backtrace.html}
{ts}This feature should NOT be enabled for production sites.
Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered.{/ts}
- - {$form.fatalErrorTemplate.label} - {$form.fatalErrorTemplate.html}
- {ts}Enter the path and filename for a custom Smarty template if you want to define your own screen for displaying fatal errors.{/ts} - {$form.fatalErrorHandler.label} {$form.fatalErrorHandler.html}
-- 2.25.1