Changeset 34 for trunk/www/task.php
- Timestamp:
- Jun 15, 2009, 9:09:30 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/task.php
r31 r34 15 15 16 16 $CommandList = implode("\n", $Task)."\n"; 17 $this->Database->insert('Task', array('User' => $System->Modules['User']->User['Id'], 'Title' => $Title, 'Time ' => 'NOW()', 'CommandList' => $CommandList));17 $this->Database->insert('Task', array('User' => $System->Modules['User']->User['Id'], 'Title' => $Title, 'TimeCreate' => 'NOW()', 'CommandList' => $CommandList)); 18 18 } 19 19 … … 23 23 24 24 chdir($Config['BaseDir']); 25 $DbResult = $this->Database->query('SELECT * FROM Task WHERE State = 0 ORDER BY Id,Time ASC');25 $DbResult = $this->Database->query('SELECT * FROM Task WHERE State = 0 ORDER BY Id,TimeCreate ASC'); 26 26 $this->Database->query('UPDATE Task SET State=2 WHERE State=1'); // Change not finished running tasks to finished 27 27 while($Task = $DbResult->fetch_assoc()) 28 28 { 29 $this->Database->query('UPDATE Task SET State=1 WHERE Id='.$Task['Id']);29 $this->Database->query('UPDATE Task SET TimeStart=NOW(), State=1 WHERE Id='.$Task['Id']); 30 30 echo('Provádím úlohu '.$Task['Id'].': '.$Task['Title']."...\n"); 31 31 $Task['CommandList'] = "#!/bin/sh\n".str_replace("\r", '', $Task['CommandList']); … … 37 37 echo($Output); 38 38 echo("Hotovo\n"); 39 $this->Database->query('UPDATE Task SET State=2, Output="'.addslashes($Output).'" WHERE Id='.$Task['Id']);39 $this->Database->query('UPDATE Task SET TimeEnd=NOW(), State=2, Output="'.addslashes($Output).'" WHERE Id='.$Task['Id']); 40 40 } 41 41 } … … 44 44 { 45 45 $this->Database->query('DELETE FROM Task WHERE Id='.$Id); 46 } 46 } 47 47 } 48 48
Note:
See TracChangeset
for help on using the changeset viewer.