source: trunk/Modules/Error/Error.php

Last change on this file was 893, checked in by chronos, 21 months ago
  • Fixed: Class types casting for better type checking.
  • Fixed: XML direct export.
  • Modified: User class instance moved from Core class to ModuleUser class.
File size: 989 bytes
Line 
1<?php
2
3class ModuleError extends Module
4{
5 var $OnError;
6 var $ErrorHandler;
7
8 function __construct(System $System)
9 {
10 parent::__construct($System);
11 $this->Name = 'Error';
12 $this->Version = '1.0';
13 $this->Creator = 'Chronos';
14 $this->License = 'GNU/GPLv3';
15 $this->Description = 'Error logging and reporting';
16 $this->Dependencies = array();
17
18 $this->OnError = array();
19 $this->ErrorHandler = new ErrorHandler();
20 $this->ErrorHandler->OnError[] = array($this, 'DoError');
21 }
22
23 function DoStart(): void
24 {
25 if (isset(Core::Cast($this->System)->Config['Web']['ShowPHPError']))
26 $this->ErrorHandler->ShowError = Core::Cast($this->System)->Config['Web']['ShowPHPError'];
27 else $this->ErrorHandler->ShowError = true;
28 $this->ErrorHandler->Start();
29 }
30
31 function DoStop(): void
32 {
33 $this->ErrorHandler->Stop();
34 }
35
36 function DoError($Error)
37 {
38 foreach ($this->OnError as $OnError)
39 call_user_func($OnError, $Error);
40 }
41}
Note: See TracBrowser for help on using the repository browser.