当前位置: 首页>>代码示例>>PHP>>正文


PHP Host::getId方法代码示例

本文整理汇总了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;
 }
开发者ID:arthurd2,项目名称:placements,代码行数:7,代码来源:rule.php

示例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());
                 }
             }
         }
     }
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:46,代码来源:VulnerabilitiesManager.php

示例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__);
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:9,代码来源:HostDao.php

示例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());
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:9,代码来源:HostGroupsManager.php

示例5: getInstalledPkgsCount

 public function getInstalledPkgsCount(Host &$host)
 {
     $sql = "select count(*) from InstalledPkg where hostId={$host->getId()}";
     return $this->db->queryToSingleValue($sql);
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:5,代码来源:InstalledPkgDao.php

示例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());
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:9,代码来源:TagsManager.php

示例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());
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:8,代码来源:HostsManager.php

示例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()]);
 }
开发者ID:arthurd2,项目名称:placements,代码行数:9,代码来源:VM.php


注:本文中的Host::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。