本文整理汇总了PHP中Host::createImagePackage方法的典型用法代码示例。如果您正苦于以下问题:PHP Host::createImagePackage方法的具体用法?PHP Host::createImagePackage怎么用?PHP Host::createImagePackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Host
的用法示例。
在下文中一共展示了Host::createImagePackage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hostdeploy
public function hostdeploy()
{
$Host = new Host($this->REQUEST['id']);
$taskTypeID = $this->REQUEST['type'];
$TaskType = new TaskType($_REQUEST['type']);
$snapin = '-1';
$enableShutdown = false;
$enableSnapins = $_REQUEST['type'] == 17 ? false : -1;
$taskName = 'Quick Deploy';
try {
if ($TaskType->isUpload() && $Host->getImage()->isValid() && $Host->getImage()->get('protected')) {
throw new Exception(sprintf('%s: %s %s: %s %s', _('Hostname'), $Host->get('name'), _('Image'), $Host->getImage()->get('name'), _('is protected')));
}
$Host->createImagePackage($taskTypeID, $taskName, false, false, $enableSnapins, false, $this->FOGUser->get('name'));
$this->FOGCore->setMessage('Successfully created tasking!');
$this->FOGCore->redirect('?node=task&sub=active');
} catch (Exception $e) {
printf('<div class="task-start-failed"><p>%s</p><p>%s</p></div>', _('Failed to create deploy task'), $e->getMessage());
}
}
示例2: deploy
public function deploy()
{
try {
$Host = new Host($_REQUEST['id']);
// Title
$this->title = $this->foglang['QuickImageMenu'];
unset($this->headerData);
$this->attributes = array(array());
$this->templates = array('${task_started}');
if (!$Host->getImageMemberFromHostID($_REQUEST['id'])) {
throw new Exception($this->foglang['ErrorImageAssoc']);
}
if (!$Host->createImagePackage('1', "Mobile: " . $ImageMembers->getHost()->get('name'), false, false, true, false, $_SESSION['FOG_USERNAME'])) {
throw new Exception($this->foglang['FailedTask']);
}
$this->data[] = array($this->foglang['TaskStarted']);
} catch (Exception $e) {
$this->data[] = array($e->getMessage());
}
$this->render();
$this->FOGCore->redirect('?node=tasks');
}
示例3: strtoupper
$FOGCore->setSetting('FOG_QUICKREG_SYS_NUMBER', $autoregSysNumber + 1);
} else {
$realhost = strtoupper($autoregSysName) == 'MAC' ? $macsimple : $autoregSysName;
}
if (!$Host || !$Host->isValid()) {
$Host = new Host(array('name' => $realhost, 'description' => sprintf('%s %s', _('Created by FOG Reg on'), date('F j, Y, g:i a')), 'imageID' => $realimageid, 'createdTime' => $FOGCore->formatTime('now', 'Y-m-d H:i:s'), 'createdBy' => 'FOGREG'));
}
$Host->addModule($ids);
$Host->addGroup($groupid);
$Host->addPriMAC($PriMAC);
$Host->addAddMAC($MACs);
if (!$Host->save()) {
throw new Exception(_('Failed to save new Host!'));
}
if ($Image->isValid() && $Host->getImageMemberFromHostID()) {
if ($Host->createImagePackage(1, 'AutoRegTask')) {
print _('Done, with imaging!');
} else {
print _('Done, but unable to create task!');
}
} else {
print _('Done!');
}
} else {
$realhost = $macsimple;
if (!$Host || !$Host->isValid()) {
$Host = new Host(array('name' => $realhost, 'description' => sprintf('%s %s', _('Created by FOG Reg on'), date('F j, Y, g:i a')), 'createdTime' => $FOGCore->formatTime('now', 'Y-m-d H:i:s'), 'createdBy' => 'FOGREG'));
$Host->addPriMAC($PriMAC);
$Host->addAddMAC($MACs);
$Host->addModule($ids);
if (!$Host->save()) {
示例4: commonOutput
private function commonOutput()
{
try {
$DateInterval = $this->nice_date('-30 minutes');
foreach ($this->getClass('HostManager')->find() as $Host) {
if ($Host && $Host->isValid()) {
if ($this->validDate($Host->get('sec_time'))) {
$DateTime = $this->nice_date($Host->get('sec_time'));
if ($DateTime->format('Y-m-d H:i:s') >= $DateInterval->format('Y-m-d H:i:s')) {
$Host->set('pub_key', null)->set('sec_time', null)->save();
}
}
}
}
$Tasks = $this->getClass('TaskManager')->find(array('stateID' => 1, 'typeID' => array(1, 15, 17)));
if ($Tasks) {
$this->outall(sprintf(" * %s active task(s) awaiting check-in sending WOL request(s).", $this->getClass('TaskManager')->count(array('stateID' => 1, 'typeID' => array(1, 15, 17)))));
foreach ($Tasks as $Task) {
$Host = new Host($Task->get('hostID'));
$this->FOGCore->wakeOnLan($Host->get('mac'));
$this->outall(sprintf("\t\t- Host: %s WOL sent using MAC: %s", $Host->get('name'), $Host->get('mac')));
usleep(500000);
}
} else {
$this->outall(" * 0 active task(s) awaiting check-in.");
}
$Tasks = $this->getClass('ScheduledTaskManager')->find(array('isActive' => 1));
if ($Tasks) {
$this->outall(sprintf(" * %s task(s) found.", count($Tasks)));
foreach ($Tasks as $Task) {
$deploySnapin = ($Task->get('taskType') == 12 || $Task->get('taskType') == 13) && $Task->get('taskType') != 17 ? $Task->get('other2') : false;
$Timer = $Task->getTimer();
$this->outall(sprintf(" * Task run time: %s", $Timer->toString()));
if ($Timer->shouldRunNow()) {
$this->outall(" * Found a task that should run...");
if ($Task->isGroupBased()) {
$this->outall(sprintf("\t\t - Is a group based task."));
$Group = $Task->getGroup();
if ($Task->get('taskType') == 8) {
$this->outall("\t\t - Multicast task found!");
$this->outall(sprintf("\t\t - Group %s", $Group->get('name')));
$i = 0;
foreach ((array) $Group->get('hosts') as $Host) {
$Host->createImagePackage($Task->get('taskType'), $Task->get('name'), $Task->get('shutdown'), false, true, 'FOG_SCHED');
$this->outall(sprintf("\t\t - Task Started for host %s!", $Host->get('name')));
}
if ($Timer->isSingleRun()) {
if ($this->FOGCore->stopScheduledTask($Task)) {
$this->outall("\t\t - Scheduled Task cleaned.");
} else {
$this->outall("\t\t - failed to clean task.");
}
} else {
$this->outall("\t\t - Cron style - No cleaning!");
}
} else {
$this->outall("\t\t - Regular task found!");
$this->outall(sprintf("\t\t - Group %s", $Group->get('name')));
foreach ((array) $Group->get('hosts') as $Host) {
$Host->createImagePackage($Task->get('taskType'), $Task->get('name'), $Task->get('shutdown'), false, $deploySnapin, true, $Task->get('other3'));
$this->outall(sprintf("\t\t - Task Started for host %s!", $Host->get('name')));
}
if ($Timer->isSingleRun()) {
if ($this->FOGCore->stopScheduledTask($Task)) {
$this->outall("\t\t - Scheduled Task cleaned.");
} else {
$this->outall("\t\t - failed to clean task.");
}
} else {
$this->outall("\t\t - Cron style - No cleaning!");
}
}
} else {
$this->outall("\t\t - Is a host based task.");
$Host = $Task->getHost();
$Host->createImagePackage($Task->get('taskType'), $Task->get('name'), $Task->get('shutdown'), false, $deploySnapin, false, $Task->get('other3'));
$this->outall(sprintf("\t\t - Task Started for host %s!", $Host->get('name')));
if ($Timer->isSingleRun()) {
if ($this->FOGCore->stopScheduledTask($Task)) {
$this->outall("\t\t - Scheduled Task cleaned.");
} else {
$this->outall("\t\t - failed to clean task.");
}
} else {
$this->outall("\t\t - Cron style - No cleaning!");
}
}
} else {
$this->outall(" * Task doesn't run now.");
}
}
} else {
$this->outall(" * No tasks found!");
}
} catch (Exception $e) {
$this->outall("\t\t - " . $e->getMessage());
}
}