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

Add new events for better integration with spatie-ignition #3957

Closed
wants to merge 10 commits into from
9 changes: 2 additions & 7 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -965,14 +965,8 @@ public static function getIsDeveloperMode()
*/
public static function printException(Throwable $e, $extra = '')
empiricompany marked this conversation as resolved.
Show resolved Hide resolved
{
self::dispatchEvent('mage_print_exception_before', ['exception' => $e, 'extra' => $extra]);
if (self::$_isDeveloperMode) {
if (class_exists('\Spatie\Ignition\Ignition')) {
\Spatie\Ignition\Ignition::make()
->applicationPath(Mage::getBaseDir())
->handleException($e);
die();
}

print '<pre>';
if (!empty($extra)) {
print $extra . "\n\n";
Expand Down Expand Up @@ -1003,6 +997,7 @@ public static function printException(Throwable $e, $extra = '')

require_once(self::getBaseDir() . DS . 'errors' . DS . 'report.php');
}
self::dispatchEvent('mage_print_exception_after', ['exception' => $e, 'extra' => $extra]);
fballiano marked this conversation as resolved.
Show resolved Hide resolved

die();
}
Expand Down
11 changes: 3 additions & 8 deletions app/code/core/Mage/Core/Model/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,10 @@ public function run($params)
*/
protected function _initEnvironment()
{
if (Mage::getIsDeveloperMode() && class_exists('\Spatie\Ignition\Ignition')) {
\Spatie\Ignition\Ignition::make()
->applicationPath(Mage::getBaseDir())
->register();
} else {
$this->setErrorHandler(self::DEFAULT_ERROR_HANDLER);
}

$this->setErrorHandler(self::DEFAULT_ERROR_HANDLER);
date_default_timezone_set(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
Mage::dispatchEvent('core_app_init_environment_after', ['app' => $this]);

empiricompany marked this conversation as resolved.
Show resolved Hide resolved
return $this;
}

Expand Down
3 changes: 3 additions & 0 deletions docs/EVENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
| controller_front_send_response_before | 1.9.4.5 |
| controller_response_redirect | 1.9.4.5 |
| core_app_run_after | 20.1.0 |
| core_app_init_environment_after | 20.7.0 |
| core_block_abstract_prepare_layout_after | 1.9.4.5 |
| core_block_abstract_prepare_layout_before | 1.9.4.5 |
| core_block_abstract_to_html_after | 1.9.4.5 |
Expand Down Expand Up @@ -237,6 +238,8 @@
| log_visitor_collection_load_before | 1.9.4.5 |
| mage_run_installed_exception | 20.7.0 |
| mage_run_exception | 1.9.4.5 |
| mage_print_exception_before | 20.7.0 |
| mage_print_exception_after | 20.7.0 |
| model_config_data_save_before | 1.9.4.5 |
| model_delete_after | 1.9.4.5 |
| model_delete_before | 1.9.4.5 |
Expand Down
Loading