本文整理汇总了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));
}