Changeset 887 for trunk/Modules/Scheduler/Scheduler.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Scheduler/Scheduler.php
r874 r887 3 3 class ModuleScheduler extends AppModule 4 4 { 5 function __construct( $System)5 function __construct(System $System) 6 6 { 7 7 parent::__construct($System); … … 14 14 } 15 15 16 function DoStart() 16 function DoStart(): void 17 17 { 18 18 $this->System->FormManager->RegisterClass('Scheduler', array( … … 48 48 'Filter' => '1', 49 49 )); 50 $this->System->RegisterCommandLine('run-scheduler', array($this->System->ModuleManager->Modules['Scheduler'], 'Run')); 50 $this->System->RegisterCommandLine('run-scheduler', 'Runs scheduled tasks', 51 array(ModuleScheduler::Cast($this->System->GetModule('Scheduler')), 'Run')); 51 52 } 52 53 53 function DoInstall() 54 function DoInstall(): void 54 55 { 55 56 } 56 57 57 function DoUnInstall() 58 function DoUnInstall(): void 58 59 { 59 60 } 60 61 61 function Run( $Parameters)62 function Run(array $Parameters): void 62 63 { 63 64 while (true) … … 100 101 } 101 102 } 103 104 static function Cast(AppModule $AppModule): ModuleScheduler 105 { 106 if ($AppModule instanceof ModuleScheduler) 107 { 108 return $AppModule; 109 } 110 throw new Exception('Expected ModuleScheduler type but got '.gettype($AppModule)); 111 } 102 112 } 103 113 104 114 class SchedulerTask extends Model 105 115 { 106 function Execute() 116 function Execute(): string 107 117 { 118 return ''; 108 119 } 109 120 } 110 121 111 112 122 class ScheduleTaskTest extends SchedulerTask 113 123 { 114 function Execute() 124 function Execute(): string 115 125 { 116 126 $Output = '#';
Note:
See TracChangeset
for help on using the changeset viewer.