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