ErrorController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. * @link http://cakephp.org CakePHP(tm) Project
  12. * @since 2.0.0
  13. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Controller;
  16. use Cake\Routing\Router;
  17. /**
  18. * Error Handling Controller
  19. *
  20. * Controller used by ErrorHandler to render error views.
  21. */
  22. class ErrorController extends Controller {
  23. /**
  24. * Constructor
  25. *
  26. * @param \Cake\Network\Request $request Request instance.
  27. * @param \Cake\Network\Response $response Reponse instance.
  28. */
  29. public function __construct($request = null, $response = null) {
  30. parent::__construct($request, $response);
  31. if (count(Router::extensions()) &&
  32. !isset($this->RequestHandler)
  33. ) {
  34. $this->addComponent('RequestHandler');
  35. }
  36. $eventManager = $this->eventManager();
  37. if (isset($this->Auth)) {
  38. $eventManager->detach($this->Auth);
  39. }
  40. if (isset($this->Security)) {
  41. $eventManager->detach($this->Security);
  42. }
  43. $this->cacheAction = false;
  44. $this->viewPath = 'Error';
  45. }
  46. }