本文整理汇总了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();
}