group.class.php (fogproject-1.5.5) | : | group.class.php (fogproject-1.5.6) | ||
---|---|---|---|---|
skipping to change at line 449 | skipping to change at line 449 | |||
$taskName = '', | $taskName = '', | |||
$shutdown = false, | $shutdown = false, | |||
$debug = false, | $debug = false, | |||
$deploySnapins = false, | $deploySnapins = false, | |||
$isGroupTask = true, | $isGroupTask = true, | |||
$username = '', | $username = '', | |||
$passreset = '', | $passreset = '', | |||
$sessionjoin = false, | $sessionjoin = false, | |||
$wol = false | $wol = false | |||
) { | ) { | |||
$taskName .= ' - ' . $this->get('name'); | ||||
$hostCount = $this->getHostCount(); | $hostCount = $this->getHostCount(); | |||
if ($hostCount < 1) { | if ($hostCount < 1) { | |||
throw new Exception(_('No hosts to task')); | throw new Exception(_('No hosts to task')); | |||
} | } | |||
$hostids = $this->get('hosts'); | $hostids = $this->get('hosts'); | |||
$TaskType = new TaskType($taskTypeID); | $TaskType = new TaskType($taskTypeID); | |||
if (!$TaskType->isValid()) { | if (!$TaskType->isValid()) { | |||
throw new Exception(self::$foglang['TaskTypeNotValid']); | throw new Exception(self::$foglang['TaskTypeNotValid']); | |||
} | } | |||
$hostids = array_diff( | $hostids = array_diff( | |||
skipping to change at line 559 | skipping to change at line 560 | |||
self::setSetting('FOG_UDPCAST_STARTINGPORT', $randomnumber); | self::setSetting('FOG_UDPCAST_STARTINGPORT', $randomnumber); | |||
} | } | |||
$hostIDs = $hostids; | $hostIDs = $hostids; | |||
$batchFields = array( | $batchFields = array( | |||
'name', | 'name', | |||
'createdBy', | 'createdBy', | |||
'hostID', | 'hostID', | |||
'isForced', | 'isForced', | |||
'stateID', | 'stateID', | |||
'typeID', | 'typeID', | |||
'storagenodeID', | ||||
'wol', | 'wol', | |||
'imageID', | 'imageID', | |||
'shutdown', | 'shutdown', | |||
'isDebug', | 'isDebug', | |||
'passreset', | 'passreset', | |||
); | ); | |||
$batchTask = array(); | $batchTask = array(); | |||
for ($i = 0; $i < $hostCount; ++$i) { | for ($i = 0; $i < $hostCount; ++$i) { | |||
$batchTask[] = array( | $batchTask[] = array( | |||
$taskName, | $taskName, | |||
$username, | $username, | |||
$hostIDs[$i], | $hostIDs[$i], | |||
0, | 0, | |||
self::getQueuedState(), | self::getQueuedState(), | |||
$TaskType->get('id'), | $TaskType->get('id'), | |||
$StorageNode->get('id'), | ||||
$wol, | $wol, | |||
$Image->get('id'), | $Image->get('id'), | |||
$shutdown, | $shutdown, | |||
$debug, | $debug, | |||
$passreset, | $passreset, | |||
); | ); | |||
} | } | |||
if (count($batchTask) > 0) { | if (count($batchTask) > 0) { | |||
list( | list( | |||
$first_id, | $first_id, | |||
skipping to change at line 640 | skipping to change at line 643 | |||
false, | false, | |||
'' | '' | |||
); | ); | |||
$batchFields = array( | $batchFields = array( | |||
'name', | 'name', | |||
'createdBy', | 'createdBy', | |||
'hostID', | 'hostID', | |||
'isForced', | 'isForced', | |||
'stateID', | 'stateID', | |||
'typeID', | 'typeID', | |||
'storagenodeID', | ||||
'wol', | 'wol', | |||
'imageID', | 'imageID', | |||
'shutdown', | 'shutdown', | |||
'isDebug', | 'isDebug', | |||
'passreset', | 'passreset', | |||
); | ); | |||
$batchTask = array(); | $batchTask = array(); | |||
for ($i = 0; $i < $hostCount; ++$i) { | for ($i = 0; $i < $hostCount; ++$i) { | |||
$batchTask[] = array( | $batchTask[] = array( | |||
$taskName, | $taskName, | |||
$username, | $username, | |||
$hostIDs[$i], | $hostIDs[$i], | |||
0, | 0, | |||
self::getQueuedState(), | self::getQueuedState(), | |||
$TaskType->get('id'), | $TaskType->get('id'), | |||
$StorageNode->get('id'), | ||||
$wol, | $wol, | |||
$imageIDs[$i], | $imageIDs[$i], | |||
$shutdown, | $shutdown, | |||
$debug, | $debug, | |||
$passreset, | $passreset, | |||
); | ); | |||
} | } | |||
if (count($batchTask) > 0) { | if (count($batchTask) > 0) { | |||
self::getClass('TaskManager') | self::getClass('TaskManager') | |||
->insertBatch( | ->insertBatch( | |||
skipping to change at line 807 | skipping to change at line 812 | |||
* @param mixed $now the current time | * @param mixed $now the current time | |||
* @param int $snapin the snapin to task (all is -1) | * @param int $snapin the snapin to task (all is -1) | |||
* | * | |||
* @return array | * @return array | |||
*/ | */ | |||
private function _createSnapinTasking($now, $snapin = -1) | private function _createSnapinTasking($now, $snapin = -1) | |||
{ | { | |||
if ($snapin === false) { | if ($snapin === false) { | |||
return; | return; | |||
} | } | |||
$hostIDs = array_values( | $hostIDs = $this->get('hosts'); | |||
self::getSubObjectIDs( | ||||
'SnapinAssociation', | ||||
array( | ||||
'hostID' => $this->get('hosts'), | ||||
), | ||||
'hostID' | ||||
) | ||||
); | ||||
$hostCount = count($hostIDs); | $hostCount = count($hostIDs); | |||
$snapinJobs = array(); | $snapinJobs = array(); | |||
for ($i = 0; $i < $hostCount; ++$i) { | for ($i = 0; $i < $hostCount; ++$i) { | |||
$hostID = $hostIDs[$i]; | $hostID = $hostIDs[$i]; | |||
$snapins[$hostID] = ( | $snapins[$hostID] = ( | |||
$snapin == -1 ? | $snapin == -1 ? | |||
self::getSubObjectIDs( | self::getSubObjectIDs( | |||
'SnapinAssociation', | 'SnapinAssociation', | |||
array( | array( | |||
'hostID' => $hostID, | 'hostID' => $hostID, | |||
End of changes. 6 change blocks. | ||||
9 lines changed or deleted | 6 lines changed or added |