本文整理匯總了PHP中Inventory::set方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inventory::set方法的具體用法?PHP Inventory::set怎麽用?PHP Inventory::set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inventory
的用法示例。
在下文中一共展示了Inventory::set方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: trim
$cpucurrent = trim(base64_decode($_REQUEST["cpucurrent"]));
$cpumax = trim(base64_decode($_REQUEST["cpumax"]));
$mem = trim(base64_decode($_REQUEST["mem"]));
$hdinfo = trim(base64_decode($_REQUEST["hdinfo"]));
if ($hdinfo != null) {
$arHd = explode(",", $hdinfo);
$hdmodel = trim(str_replace("Model=", "", trim($arHd[0])));
$hdfirmware = trim(str_replace("FwRev=", "", trim($arHd[1])));
$hdserial = trim(str_replace("SerialNo=", "", trim($arHd[2])));
} else {
$hdmodel = '';
$hdfirmware = '';
$hdserial = '';
}
$caseman = trim(base64_decode($_REQUEST["caseman"]));
$casever = trim(base64_decode($_REQUEST["casever"]));
$caseserial = trim(base64_decode($_REQUEST["caseserial"]));
$casesasset = trim(base64_decode($_REQUEST["casesasset"]));
if (!$Inventory || !$Inventory->isValid()) {
$Inventory = new Inventory(array('hostID' => $Host->get('id'), 'sysman' => $sysman, 'sysproduct' => $sysproduct, 'sysversion' => $sysversion, 'sysserial' => $sysserial, 'systype' => $systype, 'biosversion' => $biosversion, 'mbman' => $mbman, 'mbproductname' => $mbproductname, 'mbversion' => $mbversion, 'mbserial' => $mbserial, 'mbasset' => $mbasset, 'cpuman' => $cpuman, 'cpuversion' => $cpuversion, 'cpucurrent' => $cpucurrent, 'cpumax' => $cpumax, 'mem' => $mem, 'hdmodel' => $hdmodel, 'hdfirmware' => $hdfirmware, 'hdserial' => $hdserial, 'caseman' => $caseman, 'casever' => $casever, 'caseserial' => $caseserial, 'caseasset' => $casesasset));
} else {
$Inventory->set('sysman', $sysman)->set('sysproduct', $sysproduct)->set('sysversion', $sysversion)->set('sysserial', $sysserial)->set('systype', $systype)->set('biosversion', $biosversion)->set('biosvendor', $biosvendor)->set('biosdate', $biosdate)->set('mbman', $mbman)->set('mbproductname', $mbproductname)->set('mbversion', $mbversion)->set('mbserial', $mbserial)->set('mbasset', $mbasset)->set('cpuman', $cpuman)->set('cpuversion', $cpuversion)->set('cpucurrent', $cpucurrent)->set('cpumax', $cpumax)->set('mem', $mem)->set('hdmodel', $hdmodel)->set('hdfirmware', $hdfirmware)->set('hdserial', $hdserial)->set('caseman', $caseman)->set('casever', $casever)->set('caseserial', $caseserial)->set('caseasset', $casesasset);
}
if ($Inventory->save()) {
print _('Done');
} else {
throw new Exception(_('Failed to create inventory for this host!'));
}
} catch (Exception $e) {
print $e->getMessage();
}