Changeset 887 for trunk/Modules/Notify/Notify.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Notify/Notify.php
r874 r887 5 5 class ModuleNotify extends AppModule 6 6 { 7 var$Checks;8 9 function __construct( $System)7 public array $Checks; 8 9 function __construct(System $System) 10 10 { 11 11 parent::__construct($System); … … 19 19 } 20 20 21 function DoStart() 21 function DoStart(): void 22 22 { 23 23 $this->System->FormManager->RegisterClass('NotifyUser', array( … … 38 38 ), 39 39 )); 40 $this->System->RegisterCommandLine('notify', array($this, 'RunCheck'));41 $this->System->ModuleManager->Modules['RSS']->RegisterRSS(array('Title' => 'Notify log',42 'Channel' => 'notifylog', 'Callback' => array( 'ModuleNotify', 'ShowLogRSS'),40 $this->System->RegisterCommandLine('notify', 'Perform notifications processing.', array($this, 'RunCheck')); 41 ModuleRSS::Cast($this->System->GetModule('RSS'))->RegisterRSS(array('Title' => 'Notify log', 42 'Channel' => 'notifylog', 'Callback' => array($this, 'ShowLogRSS'), 43 43 'Permission' => array('Module' => 'Notify', 'Operation' => 'RSS'))); 44 44 } 45 45 46 function RegisterCheck( $Name, $Callback)46 function RegisterCheck(string $Name, callable $Callback): void 47 47 { 48 48 if (array_key_exists($Name, $this->Checks)) … … 51 51 } 52 52 53 function UnregisterCheck( $Name)53 function UnregisterCheck(string $Name): void 54 54 { 55 55 if (!array_key_exists($Name, $this->Checks)) … … 58 58 } 59 59 60 function Check() 60 function Check(): string 61 61 { 62 62 $Output = ''; … … 123 123 } 124 124 125 function RunCheck( $Parameters)125 function RunCheck(array $Parameters): void 126 126 { 127 127 RepeatFunction(30, array($this, 'Check')); 128 128 } 129 129 130 function DoInstall() 130 function DoInstall(): void 131 131 { 132 132 $this->Database->query('CREATE TABLE IF NOT EXISTS `NotifyCategory` ( … … 160 160 } 161 161 162 function DoUninstall() 162 function DoUninstall(): void 163 163 { 164 164 $this->Database->query('DROP TABLE `NotifyUser`'); … … 166 166 } 167 167 168 function ShowLogRSS() 168 function ShowLogRSS(): string 169 169 { 170 170 $this->ClearPage = true; … … 197 197 return $RSS->Generate(); 198 198 } 199 200 static function Cast(AppModule $AppModule): ModuleNotify 201 { 202 if ($AppModule instanceof ModuleNotify) 203 { 204 return $AppModule; 205 } 206 throw new Exception('Expected ModuleNotify type but got '.gettype($AppModule)); 207 } 199 208 }
Note:
See TracChangeset
for help on using the changeset viewer.