-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorControllerSelector.php
More file actions
27 lines (20 loc) · 1.04 KB
/
ErrorControllerSelector.php
File metadata and controls
27 lines (20 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
class WS_ErrorControllerSelector extends Zend_Controller_Plugin_Abstract {
public function routeShutdown(Zend_Controller_Request_Abstract $request) {
$front = Zend_Controller_Front::getInstance();
//If the ErrorHandler plugin is not registered, bail out
if (!($front->getPlugin('Zend_Controller_Plugin_ErrorHandler') instanceOf Zend_Controller_Plugin_ErrorHandler))
return;
$error = $front->getPlugin('Zend_Controller_Plugin_ErrorHandler');
//Generate a test request to use to determine if the error controller in our module exists
$testRequest = new Zend_Controller_Request_Http();
$testRequest->setModuleName($request->getModuleName())
->setControllerName($error->getErrorHandlerController())
->setActionName($error->getErrorHandlerAction());
//Does the controller even exist?
if ($front->getDispatcher()->isDispatchable($testRequest)) {
$error->setErrorHandlerModule($request->getModuleName());
}
}
}
?>