本文整理匯總了PHP中Host::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Host::getId方法的具體用法?PHP Host::getId怎麽用?PHP Host::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Host
的用法示例。
在下文中一共展示了Host::getId方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isPermited
function isPermited(Host &$host, VM &$vm)
{
if (is_null($this->matrix)) {
throw new Exception("TestingWithoutMatrix", 1);
}
return isset($this->matrix[$host->getId()][$vm->getId()]) ? $this->matrix[$host->getId()][$vm->getId()] : false;
}
示例2: calculateVulnerablePkgsForSpecificHost
/**
* Find vulnerable packages for a specific host
* Save vulnerable pkgId and corresponding cveDefId and osGroupId to PkgCveDef table
* @throws Exception
* @param Host $host
*
*/
public function calculateVulnerablePkgsForSpecificHost(Host $host)
{
if ($host == null || $host->getId() == -1) {
Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
throw new Exception("Host object is not valid or Host.id is not set");
}
Utils::log(LOG_DEBUG, "Searching for vulnerable packages for specific host ", __FILE__, __LINE__);
// If not in Os Group
$osGroup = $this->getPakiti()->getManager("OsGroupsManager")->getOsGroupByOsId($host->getOsId());
if ($osGroup == null) {
throw new Exception("Host's OS is not a member of any OsGroup");
}
//Get installed Pkgs on Host
$installedPkgs = $this->getPakiti()->getManager("PkgsManager")->getInstalledPkgs($host);
//For each vulnerable package get Cvedef
foreach ($installedPkgs as $installedPkg) {
$confirmedVulnerabilities = array();
$potentialVulnerabilities = $this->getPakiti()->getDao("Vulnerability")->getVulnerabilitiesByPkgNameOsGroupIdArch($installedPkg->getName(), $osGroup->getId(), $installedPkg->getArch());
if (!empty($potentialVulnerabilities)) {
foreach ($potentialVulnerabilities as $potentialVulnerability) {
switch ($potentialVulnerability->getOperator()) {
//TODO: Add more operator cases
case "<":
if ($this->vercmp($host->getType(), $installedPkg->getVersion(), $installedPkg->getRelease(), $potentialVulnerability->getVersion(), $potentialVulnerability->getRelease()) < 0) {
array_push($confirmedVulnerabilities, $potentialVulnerability);
}
}
}
//For each confirmed Vulnerability get CveDefs
if (!empty($confirmedVulnerabilities)) {
$cveDefs = array();
foreach ($confirmedVulnerabilities as $confirmedVulnerability) {
# Assign the Cvedef to the Package
$this->getPakiti()->getManager("CveDefsManager")->assignPkgToCveDef($installedPkg->getId(), $this->getPakiti()->getDao("CveDef")->getCveDefForVulnerability($confirmedVulnerability)->getId(), $osGroup->getId());
}
}
}
}
}
示例3: delete
public function delete(Host &$host)
{
if ($host == null || $host->getId() == -1) {
Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
throw new Exception("Host object is not valid or Host.id is not set");
}
$this->db->query("delete from Host where id=" . $host->getId());
Utils::log(LOG_DEBUG, "Host deleted", __FILE__, __LINE__);
}
示例4: removeHostFromHostGroups
public function removeHostFromHostGroups(Host &$host)
{
if ($host == null || $host->getId() == -1) {
Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
throw new Exception("Host object is not valid or Host.id is not set");
}
Utils::log(LOG_DEBUG, "Removing the host from all host groups [host=" . $host->getHostname() . "]", __FILE__, __LINE__);
$this->getPakiti()->getDao("HostGroup")->removeHostFromHostGroups($host->getId());
}
示例5: getInstalledPkgsCount
public function getInstalledPkgsCount(Host &$host)
{
$sql = "select count(*) from InstalledPkg where hostId={$host->getId()}";
return $this->db->queryToSingleValue($sql);
}
示例6: removeHostTags
public function removeHostTags(Host &$host)
{
if ($host == null || $host->getId() == -1) {
Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
throw new Exception("Host object is not valid or Host.id is not set");
}
Utils::log(LOG_DEBUG, "Removing all tags associated with the host [hostname='{$host->getHostname()}']", __FILE__, __LINE__);
$this->getPakiti()->getDao("Tag")->deleteTagsByHostId($host->getId());
}
示例7: setLastReportId
public function setLastReportId(Host &$host, Report &$report)
{
if ($host == null || $host->getId() == -1 || $report == null || $report->getId() == -1) {
Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
throw new Exception("Host or Report pobject is not valid or Host.id or Report.id is not set");
}
return $this->getPakiti()->getDao("Host")->setLastReportId($host->getId(), $report->getId());
}
示例8: removePossibleHost
/**
* removePossibleHost
* remove o host enviado como um dos possiveis hosts a ser alocado em
* @param Host $host
*/
function removePossibleHost(&$host)
{
unset($this->possibleHost[$host->getId()]);
}