当前位置: 首页>>代码示例>>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;未经允许,请勿转载。