當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Scalr_Util_DateTime::getFuzzyTime方法代碼示例

本文整理匯總了PHP中Scalr_Util_DateTime::getFuzzyTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP Scalr_Util_DateTime::getFuzzyTime方法的具體用法?PHP Scalr_Util_DateTime::getFuzzyTime怎麽用?PHP Scalr_Util_DateTime::getFuzzyTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Scalr_Util_DateTime的用法示例。


在下文中一共展示了Scalr_Util_DateTime::getFuzzyTime方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: xGetTerminationDetailsAction

 public function xGetTerminationDetailsAction()
 {
     $this->request->restrictAccess(Acl::RESOURCE_FARMS, Acl::PERM_FARMS_TERMINATE);
     $dbFarm = DBFarm::LoadByID($this->getParam('farmId'));
     $this->user->getPermissions()->validate($dbFarm);
     $dbFarm->isLocked();
     $outdatedFarmRoles = $this->db->GetAll("SELECT id FROM farm_roles WHERE farmid=?", array($dbFarm->ID));
     $data = array();
     $isMongoDbClusterRunning = false;
     $isMysql = false;
     $isRabbitMQ = false;
     foreach ($outdatedFarmRoles as $farmRole) {
         $dbFarmRole = DBFarmRole::LoadByID($farmRole['id']);
         if (!$isMongoDbClusterRunning) {
             $isMongoDbClusterRunning = $dbFarmRole->GetRoleObject()->hasBehavior(ROLE_BEHAVIORS::MONGODB) && $dbFarmRole->GetSetting(Scalr_Role_Behavior_MongoDB::ROLE_CLUSTER_STATUS) != Scalr_Role_Behavior_MongoDB::STATUS_TERMINATED;
         }
         if (!$isMysql) {
             $isMysql = $dbFarmRole->GetRoleObject()->hasBehavior(ROLE_BEHAVIORS::MYSQL);
         }
         if (!$isRabbitMQ) {
             $isRabbitMQ = $dbFarmRole->GetRoleObject()->hasBehavior(ROLE_BEHAVIORS::RABBITMQ);
         }
         $row = array('dtLastSync' => strtotime($dbFarmRole->dtLastSync) ? Scalr_Util_DateTime::getFuzzyTime(strtotime($dbFarmRole->dtLastSync), false) : "Never", 'name' => $dbFarmRole->GetRoleObject()->name, 'id' => $dbFarmRole->ID, 'isBundleRunning' => $this->db->GetOne("\n                    SELECT id FROM bundle_tasks\n                    WHERE status NOT IN ('success','failed')\n                    AND role_id=?\n                    AND farm_id IN (SELECT id FROM farms WHERE client_id=?)\n                 ", array($dbFarmRole->RoleID, $dbFarm->ClientID)));
         foreach ($dbFarmRole->GetServersByFilter(array('status' => SERVER_STATUS::RUNNING)) as $dbServer) {
             $row['servers'][] = array('server_id' => $dbServer->serverId, 'remoteIp' => $dbServer->remoteIp);
         }
         $data[] = $row;
     }
     $this->response->data(array('roles' => $data, 'isMongoDbClusterRunning' => $isMongoDbClusterRunning, 'isMysqlRunning' => $isMysql, 'isRabbitMQ' => $isRabbitMQ, 'farmId' => $dbFarm->ID, 'farmName' => $dbFarm->Name));
 }
開發者ID:rickb838,項目名稱:scalr,代碼行數:30,代碼來源:Farms.php


注:本文中的Scalr_Util_DateTime::getFuzzyTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。