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


PHP Host::getHostname方法代码示例

本文整理汇总了PHP中Host::getHostname方法的典型用法代码示例。如果您正苦于以下问题:PHP Host::getHostname方法的具体用法?PHP Host::getHostname怎么用?PHP Host::getHostname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Host的用法示例。


在下文中一共展示了Host::getHostname方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update(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");
     }
     $dbHost = $this->getById($host->getId());
     if ($dbHost == null) {
         throw new Exception("Host cannot be retreived from the DB");
     }
     $entries = array();
     if ($host->getHostname() != $dbHost->getHostname()) {
         $entries['hostname'] = "'" . $this->db->escape($host->getHostname()) . "'";
     }
     if ($host->getIp() != $dbHost->getIp()) {
         $entries['ip'] = "'" . $this->db->escape($host->getIp()) . "'";
     }
     if ($host->getReporterHostname() != $dbHost->getReporterHostname()) {
         $entries['reporterHostname'] = "'" . $this->db->escape($host->getReporterHostname()) . "'";
     }
     if ($host->getReporterIp() != $dbHost->getReporterIp()) {
         $entries['reporterIp'] = "'" . $this->db->escape($host->getReporterIp()) . "'";
     }
     if ($host->getKernel() != $dbHost->getKernel()) {
         $entries['kernel'] = "'" . $this->db->escape($host->getKernel()) . "'";
     }
     if ($host->getOsId() != $dbHost->getOsId()) {
         $entries['osId'] = $this->db->escape($host->getOsId());
     }
     if ($host->getArchId() != $dbHost->getArchId()) {
         $entries['archId'] = $this->db->escape($host->getArchId());
     }
     if ($host->getDomainId() != $dbHost->getDomainId()) {
         $entries['domainId'] = $this->db->escape($host->getDomainId());
     }
     if ($host->getType() != $dbHost->getType()) {
         $entries['type'] = "'" . $this->db->escape($host->getType()) . "'";
     }
     if ($host->getOwnRepositoriesDef() != $dbHost->getOwnRepositoriesDef()) {
         $entries['ownRepositoriesDef'] = "'" . $this->db->escape($host->getOwnRepositoriesDef()) . "'";
     }
     if (sizeof($entries) > 0) {
         # Construct SQL query
         $sql = "update Host set";
         $sqle = "";
         foreach ($entries as $column => $value) {
             $sqle .= " {$column}={$value},";
         }
         # Remove last comma
         $sqle = preg_replace('/(.*),$/', '\\1', $sqle);
         $sql .= $sqle . " where id=" . $host->getId();
         $this->db->query($sql);
         Utils::log(LOG_DEBUG, "Host updated", __FILE__, __LINE__);
     }
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:55,代码来源:HostDao.php

示例2: onHostStatusChange

 public function onHostStatusChange(Host $host)
 {
     $isActive = $host->isActive();
     $hostname = $host->getHostname();
     if ($isActive) {
         $this->active[$hostname] = $this->hosts[$hostname];
     } else {
         unset($this->active[$hostname]);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:10,代码来源:Net.php

示例3: 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

示例4: 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


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