Changeset 730 for trunk/Modules/Scheduler/Scheduler.php
- Timestamp:
- Jan 13, 2015, 12:18:19 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Scheduler/Scheduler.php
r729 r730 24 24 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '0'), 25 25 'ScheduledTime' => array('Type' => 'DateTime', 'Caption' => 'Plánovaný čas', 'Default' => ''), 26 ' Class' => array('Type' => 'String', 'Caption' => 'Vykonat třídu', 'Default' => ''),26 'Action' => array('Type' => 'TSchedulerAction', 'Caption' => 'Akce', 'Default' => ''), 27 27 'Period' => array('Type' => 'Integer', 'Caption' => 'Opakovat po', 'Default' => '', 'Null' => true, 'Suffix' => 'sekund'), 28 28 'Log' => array('Type' => 'Text', 'Caption' => 'Poslední záznam', 'Default' => '', 'ReadOnly' => true), 29 29 'LastExecutedTime' => array('Type' => 'DateTime', 'Caption' => 'Čas posledního spuštění', 'Default' => '', 'ReadOnly' => true), 30 30 ), 31 )); 32 $this->System->FormManager->RegisterClass('SchedulerAction', array( 33 'Title' => 'Akce plánovače', 34 'Table' => 'SchedulerAction', 35 'DefaultSortColumn' => 'Name', 36 'ReadOnly' => true, 37 'Items' => array( 38 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => '', 'ReadOnly' => true), 39 'Class' => array('Type' => 'String', 'Caption' => 'Vykonat třídu', 'Default' => '', 'ReadOnly' => true), 40 ), 41 )); 42 $this->System->FormManager->RegisterFormType('TSchedulerAction', array( 43 'Type' => 'Reference', 44 'Table' => 'SchedulerAction', 45 'Id' => 'Id', 46 'Name' => 'Name', 47 'Filter' => '1', 31 48 )); 32 49 $this->System->RegisterCommandLine('run-scheduler', array('ModuleScheduler', 'Run')); … … 45 62 while(true) 46 63 { 47 $DbResult = $this->Database->select('Scheduler', '*', '(Enabled=1) AND (ScheduledTime < NOW())'); 64 $DbResult = $this->Database->query('SELECT `Scheduler`.*, `SchedulerAction`.`Class` AS `Class` FROM `Scheduler` '. 65 'LEFT JOIN `SchedulerAction` ON `SchedulerAction`.`Id` = `Scheduler`.`Action` '. 66 'WHERE (`Scheduler`.`Enabled`=1) AND (`Scheduler`.`ScheduledTime` > `Scheduler`.`LastExecutedTime`)'); 48 67 while($DbRow = $DbResult->fetch_assoc()) 49 68 { … … 60 79 array('ScheduledTime' => TimeToMysqlDateTime((MysqlDateTimeToTime($DbRow['ScheduledTime']) + $DbRow['Period'])))); 61 80 } 81 echo('.'); 62 82 sleep(1); 63 83 }
Note:
See TracChangeset
for help on using the changeset viewer.