Changeset 31 for trunk/www/task.php
- Timestamp:
- Jun 14, 2009, 12:34:03 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/task.php
r29 r31 14 14 global $System; 15 15 16 $this->Database->insert('Task', array('User' => $System->Modules['User']->User['Id'], 'Title' => $Title, 'Time' => 'NOW()', 'CommandList' => implode("\n", $Task)."\n")); 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 18 } 18 19 … … 23 24 chdir($Config['BaseDir']); 24 25 $DbResult = $this->Database->query('SELECT * FROM Task WHERE State = 0 ORDER BY Id,Time ASC'); 26 $this->Database->query('UPDATE Task SET State=2 WHERE State=1'); // Change not finished running tasks to finished 25 27 while($Task = $DbResult->fetch_assoc()) 26 28 { 27 29 $this->Database->query('UPDATE Task SET State=1 WHERE Id='.$Task['Id']); 28 30 echo('Provádím úlohu '.$Task['Id'].': '.$Task['Title']."...\n"); 29 $Task['CommandList'] = "#!/bin/sh\n". $Task['CommandList'];31 $Task['CommandList'] = "#!/bin/sh\n".str_replace("\r", '', $Task['CommandList']); 30 32 file_put_contents($this->TempScript, $Task['CommandList']); 31 33 chmod($this->TempScript, 0755);
Note:
See TracChangeset
for help on using the changeset viewer.