コード例 #1
0
        // If client count is equal, place session task in-progress as it will likely start soon.
        if ($MSAs == $MultiSess->get('clients') || $MultiSess->get('sessclients') > 0 && $MultiSess->get('clients') > 0) {
            $MultiSess->set('stateID', 3);
        } else {
            $MultiSess->set('stateID', 1);
        }
    }
    // Save the info.
    if ($Task->save() && ($Task->get('typeID') == 8 ? $MultiSess->save() : true)) {
        if ($MultiSess && $MultiSess->isValid()) {
            $Host->set('imageID', $MultiSess->get('image'));
        }
        // Log it
        $ImagingLogs = $FOGCore->getClass('ImagingLogManager')->find(array('hostID' => $Host->get('id'), 'type' => $_REQUEST['type'], 'complete' => '0000-00-00 00:00:00'));
        foreach ($ImagingLogs as $ImagingLog) {
            $id[] = $ImagingLog->get('id');
        }
        if (!$id) {
            $il = new ImagingLog(array('hostID' => $Host->get('id'), 'start' => $FOGCore->nice_date()->format('Y-m-d H:i:s'), 'image' => $Task->getImage()->get('name'), 'type' => $_REQUEST['type']));
        } else {
            $il = new ImagingLog(max($id));
            $il->set('start', $FOGCore->nice_set()->format('Y-m-d H:i:s'));
        }
        $il->save();
        $TaskLog = new TaskLog(array('taskID' => $Task->get('id'), 'taskStateID' => $Task->get('stateID'), 'createdTime' => $Task->get('createdTime'), 'createdBy' => $Task->get('createdBy')));
        $TaskLog->save();
        print '##@GO';
    }
} catch (Exception $e) {
    print $e->getMessage();
}