Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(dev/joomla#10) Remove Joomla-specific error display and use native CiviCRM #15159

Merged
merged 1 commit into from
Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions CRM/Core/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,17 +466,12 @@ function_exists($config->fatalErrorHandler)
$template = CRM_Core_Smarty::singleton();
$template->assign($vars);
$content = $template->fetch('CRM/common/fatal.tpl');

if ($config->backtrace) {
$content = self::formatHtmlException($exception) . $content;
}
if ($config->userFramework == 'Joomla' &&
class_exists('JError')
) {
JError::raiseError('CiviCRM-001', $content);
}
else {
echo CRM_Utils_System::theme($content);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vingle wrote:

anyone currently using custom styled, front-end error pages that match their public-facing theme would, I guess, lose that with this commit.

civicrm-core has a setting fatalErrorHandler which you can use to define a custom function for emitting an error. I wonder if it work as an off-ramp to:

  • Put this old code-block in a separate function (e.g. CRM_Utils_System_Joomla::mapToJError or CRM_Core_Error::useJoomlaError)
  • In the post-upgrade message on Joomla sites, advise that the error-handling has been normalized to consistently display error messages - but that you can continue using JError by setting the option fatalErrorHandler to CRM_Utils_System_Joomla::mapToJError (or whatever it's called)

(Of course, that would be have to be tested, and I don't know off the top of my head the best place to put that function..)

OTOH, if no one is likely to use the option, then just KISS and carry on without...


echo CRM_Utils_System::theme($content);

// fin
self::abend(CRM_Core_Error::FATAL_ERROR);
Expand Down
17 changes: 0 additions & 17 deletions CRM/Utils/System/Joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -833,23 +833,6 @@ public function checkPermissionAddUser() {
}
}

/**
* Output code from error function.
* @param string $content
*/
public function outputError($content) {
if (class_exists('JErrorPage')) {
$error = new Exception($content);
JErrorPage::render($error);
}
elseif (class_exists('JError')) {
JError::raiseError('CiviCRM-001', $content);
}
else {
parent::outputError($content);
}
}

/**
* @inheritDoc
*/
Expand Down
4 changes: 2 additions & 2 deletions templates/CRM/common/fatal.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
+--------------------------------------------------------------------+
*}
{* error.tpl: Display page for fatal errors. Provides complete HTML doc.*}
{if $config->userFramework != 'Joomla' and $config->userFramework != 'WordPress'}
{if $config->userFramework != 'WordPress'}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

Expand Down Expand Up @@ -89,7 +89,7 @@ function toggle( element ) {
}
</script>
{/literal}
{if $config->userFramework != 'Joomla' and $config->userFramework != 'WordPress'}
{if $config->userFramework != 'WordPress'}
</body>
</html>
{/if}