當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。