• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Scalr_Util_DateTime类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: xListTasksAction

 public function xListTasksAction()
 {
     $this->request->defineParams(array('sort' => array('type' => 'json', 'default' => array('property' => 'dtadded', 'direction' => 'DESC'))));
     $sql = "SELECT id FROM dm_deployment_tasks WHERE status !='" . Scalr_Dm_DeploymentTask::STATUS_ARCHIVED . "' AND env_id = '{$this->getEnvironmentId()}'";
     $response = $this->buildResponseFromSql($sql, array("id"));
     foreach ($response["data"] as $k => $row) {
         $data = false;
         try {
             $deploymentTask = Scalr_Dm_DeploymentTask::init()->loadById($row['id']);
             $application = $deploymentTask->getApplication();
             try {
                 $dbServer = DBServer::LoadByID($deploymentTask->serverId);
                 $serverIndex = $dbServer->index;
             } catch (Exception $e) {
             }
             $data = array('id' => $deploymentTask->id, 'application_name' => $application->name, 'application_id' => $deploymentTask->applicationId, 'server_id' => $deploymentTask->serverId, 'server_index' => $serverIndex, 'remote_path' => $deploymentTask->remotePath, 'status' => $deploymentTask->status, 'dtadded' => $deploymentTask->dtAdded ? Scalr_Util_DateTime::convertTz($deploymentTask->dtAdded) : "", 'dtdeployed' => $deploymentTask->dtDeployed ? Scalr_Util_DateTime::convertTz($deploymentTask->dtDeployed) : "Never");
             try {
                 $dbFarmRole = DBFarmRole::LoadByID($deploymentTask->farmRoleId);
                 $data['farm_roleid'] = $dbFarmRole->ID;
                 $data['role_name'] = $dbFarmRole->GetRoleObject()->name;
                 $data['farm_id'] = $dbFarmRole->FarmID;
                 $data['farm_name'] = $dbFarmRole->GetFarmObject()->Name;
             } catch (Exception $e) {
             }
         } catch (Exception $e) {
         }
         $response["data"][$k] = $data;
     }
     $this->response->data($response);
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:30,代码来源:Tasks.php


示例2: xListEventsAction

 public function xListEventsAction()
 {
     $this->request->defineParams(array('farmId' => array('type' => 'int'), 'eventServerId', 'eventId', 'query' => array('type' => 'string'), 'sort' => array('type' => 'string', 'default' => 'id'), 'dir' => array('type' => 'string', 'default' => 'DESC')));
     $sql = "SELECT farmid, message, type, dtadded, event_server_id, event_id FROM events WHERE farmid='{$this->dbFarm->ID}'";
     if ($this->getParam('eventServerId')) {
         $sql .= " AND event_server_id = " . $this->db->qstr($this->getParam('eventServerId'));
     }
     if ($this->getParam('eventId')) {
         $sql .= " AND event_id = " . $this->db->qstr($this->getParam('eventId'));
     }
     $response = $this->buildResponseFromSql($sql, array("message", "type", "dtadded", "event_server_id", "event_id"));
     $cache = array();
     foreach ($response['data'] as &$row) {
         $row['message'] = nl2br($row['message']);
         $row["dtadded"] = Scalr_Util_DateTime::convertTz($row["dtadded"]);
         $row['scripts'] = $this->db->GetOne("SELECT COUNT(*) FROM scripting_log WHERE event_id = ?", array($row['event_id']));
         if ($row['event_server_id']) {
             $esInfo = $this->db->GetRow("SELECT role_id, farm_roleid, `index`, farm_id FROM servers WHERE server_id = ? LIMIT 1", array($row['event_server_id']));
             if ($esInfo) {
                 if (!$cache['farm_names'][$esInfo['farm_id']]) {
                     $cache['farm_names'][$esInfo['farm_id']] = $this->db->GetOne("SELECT name FROM farms WHERE id=?", array($esInfo['farm_id']));
                 }
                 $row['event_farm_name'] = $cache['farm_names'][$esInfo['farm_id']];
                 $row['event_farm_id'] = $esInfo['farm_id'];
                 $row['event_farm_roleid'] = $esInfo['farm_roleid'];
                 if (!$cache['role_names'][$esInfo['role_id']]) {
                     $cache['role_names'][$esInfo['role_id']] = $this->db->GetOne("SELECT name FROM roles WHERE id=?", array($esInfo['role_id']));
                 }
                 $row['event_role_name'] = $cache['role_names'][$esInfo['role_id']];
                 $row['event_server_index'] = $esInfo['index'];
             }
         }
     }
     $this->response->data($response);
 }
开发者ID:recipe,项目名称:scalr,代码行数:35,代码来源:Events.php


示例3: getAccountEnvironmentsList

 public function getAccountEnvironmentsList()
 {
     $environments = $this->user->getEnvironments();
     $result = array();
     foreach ($environments as &$row) {
         $env = Scalr_Environment::init()->loadById($row['id']);
         $row['platforms'] = $env->getEnabledPlatforms();
         $row['teams'] = array();
         if ($this->getContainer()->config->get('scalr.auth_mode') == 'ldap') {
             $row['teamIds'] = array();
         }
         foreach ($env->getTeams() as $teamId) {
             if ($this->getContainer()->config->get('scalr.auth_mode') == 'ldap') {
                 $team = new Scalr_Account_Team();
                 $team->loadById($teamId);
                 $row['teams'][] = $team->name;
                 $row['teamIds'][] = $teamId;
             } else {
                 $row['teams'][] = $teamId;
             }
         }
         $row['dtAdded'] = Scalr_Util_DateTime::convertTz($env->dtAdded);
         $row['status'] = $env->status;
         if ($this->getContainer()->analytics->enabled) {
             $row['ccId'] = $env->getPlatformConfigValue(Scalr_Environment::SETTING_CC_ID);
         }
         $result[] =& $row;
     }
     return $result;
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:30,代码来源:Account2.php


示例4: testIncrescentTimeInterval

 /**
  * @test
  * @dataProvider providerIncrescentTimeInterval
  */
 public function testIncrescentTimeInterval($date, $curDate, $expected)
 {
     $this->assertEquals($expected, \Scalr_Util_DateTime::getIncrescentTimeInterval($date, $curDate));
     $date = DateTime::createFromFormat('Y-m-d H:i:s', $date);
     $curDate = DateTime::createFromFormat('Y-m-d H:i:s', $curDate);
     $this->assertEquals($expected, \Scalr_Util_DateTime::getIncrescentTimeInterval($date, $curDate));
 }
开发者ID:scalr,项目名称:scalr,代码行数:11,代码来源:DateTimeTest.php


示例5: xListTasksAction

 public function xListTasksAction()
 {
     $this->request->defineParams(array('sort' => array('type' => 'json', 'default' => array('property' => 'dtadded', 'direction' => 'DESC'))));
     $sql = "\n            SELECT\n                dt.id, dma.name AS application_name, servers.index AS server_index, farms.name AS farm_name, roles.name AS role_name,\n                dt.status AS status, dt.dtadded AS dtadded\n            FROM dm_deployment_tasks dt\n            LEFT JOIN dm_applications dma ON dt.dm_application_id = dma.id\n            LEFT JOIN servers ON servers.id = dt.server_id\n            LEFT JOIN farms ON servers.farm_id = farms.id\n            LEFT JOIN roles ON servers.farm_roleid = roles.id\n            WHERE dt.`status` != ? AND dt.env_id = ?\n        ";
     $args = array(Scalr_Dm_DeploymentTask::STATUS_ARCHIVED, $this->getEnvironmentId());
     list($sql, $args) = $this->request->prepareFarmSqlQuery($sql, $args, 'farms');
     $response = $this->buildResponseFromSql2($sql, array('id', 'application_name', 'farm_name', 'role_name', 'server_index', 'status', 'dtadded', 'dtdeployed'), array(), $args);
     foreach ($response["data"] as $k => $row) {
         $data = false;
         try {
             $deploymentTask = Scalr_Dm_DeploymentTask::init()->loadById($row['id']);
             $application = $deploymentTask->getApplication();
             try {
                 $dbServer = DBServer::LoadByID($deploymentTask->serverId);
                 $serverIndex = $dbServer->index;
             } catch (Exception $e) {
             }
             $data = array('id' => $deploymentTask->id, 'application_name' => $application->name, 'application_id' => $deploymentTask->applicationId, 'server_id' => $deploymentTask->serverId, 'server_index' => $serverIndex, 'remote_path' => $deploymentTask->remotePath, 'status' => $deploymentTask->status, 'dtadded' => $deploymentTask->dtAdded ? Scalr_Util_DateTime::convertTz($deploymentTask->dtAdded) : "", 'dtdeployed' => $deploymentTask->dtDeployed ? Scalr_Util_DateTime::convertTz($deploymentTask->dtDeployed) : "Never");
             try {
                 $dbFarmRole = DBFarmRole::LoadByID($deploymentTask->farmRoleId);
                 $data['farm_roleid'] = $dbFarmRole->ID;
                 $data['role_name'] = $dbFarmRole->GetRoleObject()->name;
                 $data['farm_id'] = $dbFarmRole->FarmID;
                 $data['farm_name'] = $dbFarmRole->GetFarmObject()->Name;
             } catch (Exception $e) {
             }
         } catch (Exception $e) {
         }
         $response["data"][$k] = $data;
     }
     $this->response->data($response);
 }
开发者ID:mheydt,项目名称:scalr,代码行数:32,代码来源:Tasks.php


示例6: getBackupDetails

 private function getBackupDetails($backupId)
 {
     $links = array();
     $backup = Scalr_Db_Backup::init()->loadById($backupId);
     $this->user->getPermissions()->validate($backup);
     $data = array('backup_id' => $backup->id, 'farm_id' => $backup->farmId, 'type' => ROLE_BEHAVIORS::GetName($backup->service) ? ROLE_BEHAVIORS::GetName($backup->service) : 'unknown', 'date' => Scalr_Util_DateTime::convertTz($backup->dtCreated), 'size' => $backup->size ? round($backup->size / 1024 / 1024, 2) : 0, 'provider' => $backup->provider, 'cloud_location' => $backup->cloudLocation, 'farmName' => DBFarm::LoadByIDOnlyName($backup->farmId));
     $downloadParts = $backup->getParts();
     foreach ($downloadParts as $part) {
         $part['size'] = $part['size'] ? round($part['size'] / 1024 / 1024, 2) : '';
         if ($part['size'] == 0) {
             $part['size'] = 0.01;
         }
         if ($data['provider'] == 's3') {
             $part['link'] = $this->getS3SignedUrl($part['path']);
         } else {
             if ($data['provider'] == 'cf') {
                 if ($backup->platform == SERVER_PLATFORMS::RACKSPACE) {
                     $part['link'] = $this->getCfSignedUrl($part['path'], $data['cloud_location'], $backup->platform);
                 } else {
                     $part['link'] = "swift://{$part['path']}";
                 }
             } else {
                 continue;
             }
         }
         $part['path'] = pathinfo($part['path']);
         $links[$part['number']] = $part;
     }
     $data['links'] = $links;
     return $data;
 }
开发者ID:recipe,项目名称:scalr,代码行数:31,代码来源:Backups.php


示例7: xListTasksAction

 public function xListTasksAction()
 {
     $this->request->defineParams(array('bundleTaskId' => array('type' => 'int'), 'sort' => array('type' => 'string', 'default' => 'id'), 'dir' => array('type' => 'string', 'default' => 'DESC')));
     $sql = "SELECT * FROM bundle_tasks WHERE env_id = '" . $this->getEnvironmentId() . "'";
     if ($this->getParam('id') > 0) {
         $sql .= " AND id = " . $this->db->qstr($this->getParam('bundleTaskId'));
     }
     $response = $this->buildResponseFromSql($sql, array("server_id", "rolename", "failure_reason", "snapshot_id", "id"));
     foreach ($response["data"] as &$row) {
         $row['server_exists'] = DBServer::IsExists($row['server_id']);
         $row['dtadded'] = Scalr_Util_DateTime::convertTz($row['dtadded']);
         if (!$row['bundle_type']) {
             $row['bundle_type'] = "*";
         }
         if ($row['dtfinished'] && $row['dtstarted']) {
             $row['duration'] = Scalr_Util_DateTime::getDateTimeDiff($row['dtfinished'], $row['dtstarted']);
         }
         if ($row['dtfinished']) {
             $row['dtfinished'] = Scalr_Util_DateTime::convertTz($row['dtfinished']);
         }
         if ($row['dtstarted']) {
             $row['dtstarted'] = Scalr_Util_DateTime::convertTz($row['dtstarted']);
         }
     }
     $this->response->data($response);
 }
开发者ID:recipe,项目名称:scalr,代码行数:26,代码来源:Bundletasks.php


示例8: xGetListAction

 public function xGetListAction()
 {
     $this->request->defineParams(array('query', 'sort' => array('type' => 'json')));
     $hist = new WebhookHistory();
     $sql = "SELECT " . $hist->fields('h') . ", w.name AS webhookName, e.url\n                FROM " . $hist->table() . " h\n                INNER JOIN webhook_endpoints e ON h.endpoint_id = e.endpoint_id\n                INNER JOIN webhook_configs w ON h.webhook_id = w.webhook_id\n                WHERE e.env_id = ?\n                AND :FILTER:\n        ";
     $args = array($this->getEnvironmentId());
     if ($this->getParam('eventId')) {
         $sql .= ' AND h.event_id = ?';
         $args[] = $this->getParam('eventId');
     }
     $response = $this->buildResponseFromSql2($sql, array('created'), array('e.url', 'h.event_type'), $args);
     foreach ($response['data'] as $index => $row) {
         $hist = new WebhookHistory();
         $hist->load($row);
         $item = array();
         foreach (get_object_vars($hist) as $k => $v) {
             $item[$k] = $v;
         }
         $item['url'] = $row['url'];
         $item['webhookName'] = $row['webhookName'];
         $item['created'] = Scalr_Util_DateTime::convertTz($hist->created);
         unset($hist);
         $response['data'][$index] = $item;
     }
     $this->response->data($response);
 }
开发者ID:rickb838,项目名称:scalr,代码行数:26,代码来源:History.php


示例9: xListAction

 /**
  * @param string $query
  * @param string $platform
  * @param string $cloudLocation
  * @param JsonData $sort
  * @param int $start
  * @param int $limit
  * @throws Exception
  */
 public function xListAction($query = null, $platform = null, $cloudLocation = null, JsonData $sort, $start = 0, $limit = 20)
 {
     $this->request->restrictAccess(Acl::RESOURCE_FARMS_ROLES);
     $criteria = [];
     $criteria[] = ['envId' => $this->getEnvironmentId()];
     if ($query) {
         $querySql = '%' . $query . '%';
         $criteria[] = ['$or' => [['id' => ['$like' => $querySql]]]];
     }
     if ($platform) {
         $criteria[] = ['platform' => $platform];
     }
     if ($cloudLocation) {
         $criteria[] = ['cloudLocation' => $cloudLocation];
     }
     $result = Image::find($criteria, \Scalr\UI\Utils::convertOrder($sort, ['id' => 'ASC'], ['id', 'platform', 'cloudLocation', 'os', 'dtAdded', 'architecture', 'source']), $limit, $start, true);
     $data = [];
     foreach ($result as $image) {
         /* @var Image $image */
         $s = get_object_vars($image);
         $s['dtAdded'] = Scalr_Util_DateTime::convertTz($image->dtAdded);
         $s['status'] = $image->isUsed() ? 'In use' : 'Not used';
         $data[] = $s;
     }
     $this->response->data(['total' => $result->totalNumber, 'data' => $data]);
 }
开发者ID:rickb838,项目名称:scalr,代码行数:35,代码来源:Images.php


示例10: xListTasksAction

 public function xListTasksAction()
 {
     $this->request->defineParams(array('bundleTaskId' => array('type' => 'int'), 'sort' => array('type' => 'json', 'default' => array('property' => 'id', 'direction' => 'DESC'))));
     $sql = "SELECT * FROM bundle_tasks WHERE env_id = ?";
     $args = array($this->getEnvironmentId());
     if ($this->getParam('id') > 0) {
         $sql .= " AND id = ?";
         $args[] = $this->getParam('bundleTaskId');
     }
     $response = $this->buildResponseFromSql2($sql, array('id', 'server_id', 'rolename', 'status', 'os_family', 'dtadded', 'dtstarted', 'created_by_email'), array(), $args);
     foreach ($response["data"] as &$row) {
         $row['server_exists'] = DBServer::IsExists($row['server_id']);
         $row['dtadded'] = Scalr_Util_DateTime::convertTz($row['dtadded']);
         if (!$row['bundle_type']) {
             $row['bundle_type'] = "*";
         }
         if ($row['dtfinished'] && $row['dtstarted']) {
             $row['duration'] = Scalr_Util_DateTime::getDateTimeDiff($row['dtfinished'], $row['dtstarted']);
         }
         if ($row['dtfinished']) {
             $row['dtfinished'] = Scalr_Util_DateTime::convertTz($row['dtfinished']);
         }
         if ($row['dtstarted']) {
             $row['dtstarted'] = Scalr_Util_DateTime::convertTz($row['dtstarted']);
         }
     }
     $this->response->data($response);
 }
开发者ID:rickb838,项目名称:scalr,代码行数:28,代码来源:Bundletasks.php


示例11: getRevisions

 /**
  * @return array
  */
 public function getRevisions()
 {
     $revisions = $this->db->GetAll("SELECT id, revision, script, dtcreated as dtCreated, variables FROM script_revisions WHERE scriptid=? ORDER BY revision DESC", array($this->id));
     foreach ($revisions as $index => $rev) {
         $revisions[$index]['dtCreated'] = Scalr_Util_DateTime::convertTz($rev['dtCreated']);
         $revisions[$index]['variables'] = unserialize($revisions[$index]['variables']);
     }
     return $revisions;
 }
开发者ID:recipe,项目名称:scalr,代码行数:12,代码来源:Script.php


示例12: xListEventsAction

 public function xListEventsAction()
 {
     $this->request->defineParams(array('farmId' => array('type' => 'int'), 'query' => array('type' => 'string'), 'sort' => array('type' => 'string', 'default' => 'id'), 'dir' => array('type' => 'string', 'default' => 'DESC')));
     $sql = "SELECT farmid, message, type, dtadded FROM events WHERE farmid='{$this->dbFarm->ID}'";
     $response = $this->buildResponseFromSql($sql, array("message", "type", "dtadded"));
     foreach ($response['data'] as &$row) {
         $row['message'] = nl2br($row['message']);
         $row["dtadded"] = Scalr_Util_DateTime::convertTz($row["dtadded"]);
     }
     $this->response->data($response);
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:11,代码来源:Events.php


示例13: xGetClusterLogAction

 public function xGetClusterLogAction()
 {
     $dbFarmRole = $this->getFarmRole();
     $sql = "SELECT id, severity, dtadded, message FROM services_mongodb_cluster_log WHERE farm_roleid=" . $this->db->qstr($dbFarmRole->ID);
     $response = $this->buildResponseFromSql($sql, array("message", "severity"), " ORDER BY id DESC");
     foreach ($response["data"] as &$row) {
         $row['dtadded'] = Scalr_Util_DateTime::convertTz($row['dtadded']);
         $row['message'] = nl2br(htmlspecialchars($row['message']));
     }
     $this->response->data($response);
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:11,代码来源:Mongodb.php


示例14: xListAccountsAction

 public function xListAccountsAction()
 {
     $this->request->defineParams(array('sort' => array('type' => 'json'), 'accountId' => array('type' => 'int')));
     $sql = "SELECT id, name, dtadded, status FROM clients WHERE :FILTER:";
     $args = array();
     if ($this->getParam('serverId')) {
         $sql .= " AND `id` IN (SELECT `client_id` FROM `servers_history` WHERE `server_id` = ?)";
         $args[] = $this->getParam('serverId');
     }
     if ($this->getParam('farmId')) {
         $sql .= ' AND id IN (SELECT clientid FROM farms WHERE id = ?)';
         $args[] = $this->getParam('farmId');
     }
     if ($this->getParam('owner')) {
         $sql .= ' AND id IN (SELECT account_id FROM account_users WHERE `type` = ? AND email LIKE ?)';
         $args[] = Scalr_Account_User::TYPE_ACCOUNT_OWNER;
         $args[] = '%' . $this->getParam('owner') . '%';
     }
     if ($this->getParam('user')) {
         $sql .= ' AND id IN (SELECT account_id FROM account_users WHERE email LIKE ?)';
         $args[] = '%' . $this->getParam('user') . '%';
     }
     if ($this->getParam('envId')) {
         $sql .= ' AND id IN (SELECT client_id FROM client_environments WHERE id = ?)';
         $args[] = $this->getParam('envId');
     }
     $response = $this->buildResponseFromSql2($sql, array('id', 'name', 'dtadded', 'status'), array('id', 'name'), $args);
     foreach ($response['data'] as &$row) {
         $account = Scalr_Account::init()->loadById($row['id']);
         try {
             $owner = $account->getOwner();
             $row['ownerEmail'] = $owner->getEmail();
             $row['ownerLocked'] = $owner->status == User::STATUS_INACTIVE;
         } catch (Exception $e) {
             $row['ownerEmail'] = '*No owner*';
         }
         $row['dtadded'] = Scalr_Util_DateTime::convertTz($row['dtadded']);
         $row['isTrial'] = (int) $account->getSetting(Scalr_Account::SETTING_IS_TRIAL);
         $limit = Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $row['id']);
         $row['envs'] = $limit->getCurrentUsage();
         $row['limitEnvs'] = $limit->getLimitValue() > -1 ? $limit->getLimitValue() : '-';
         $limit = Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_FARMS, $row['id']);
         $row['farms'] = $limit->getCurrentUsage();
         $row['limitFarms'] = $limit->getLimitValue() > -1 ? $limit->getLimitValue() : '-';
         $limit = Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_USERS, $row['id']);
         $row['users'] = $limit->getCurrentUsage();
         $row['limitUsers'] = $limit->getLimitValue() > -1 ? $limit->getLimitValue() : '-';
         $limit = Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_SERVERS, $row['id']);
         $row['servers'] = $limit->getCurrentUsage();
         $row['limitServers'] = $limit->getLimitValue() > -1 ? $limit->getLimitValue() : '-';
         $row['dnsZones'] = $this->db->GetOne("SELECT COUNT(*) FROM dns_zones WHERE client_id = ?", array($row['id']));
     }
     $this->response->data($response);
 }
开发者ID:mheydt,项目名称:scalr,代码行数:54,代码来源:Accounts.php


示例15: xGetClusterLogAction

 public function xGetClusterLogAction()
 {
     $dbFarmRole = $this->getFarmRole();
     $sql = "SELECT id, severity, dtadded, message FROM services_mongodb_cluster_log WHERE farm_roleid = ? AND :FILTER:";
     $args = [$dbFarmRole->ID];
     $response = $this->buildResponseFromSql2($sql, ['id', 'severity', 'message', 'dtadded'], ['message', 'severity'], $args);
     foreach ($response["data"] as &$row) {
         $row['dtadded'] = Scalr_Util_DateTime::convertTz($row['dtadded']);
         $row['message'] = nl2br(htmlspecialchars($row['message']));
     }
     $this->response->data($response);
 }
开发者ID:mheydt,项目名称:scalr,代码行数:12,代码来源:Mongodb.php


示例16: xListLimitsAction

 public function xListLimitsAction()
 {
     $cloudLocation = $this->getParam('cloudLocation');
     $cs = Scalr_Service_Cloud_Rackspace::newRackspaceCS($this->environment->getPlatformConfigValue(Modules_Platforms_Rackspace::USERNAME, true, $cloudLocation), $this->environment->getPlatformConfigValue(Modules_Platforms_Rackspace::API_KEY, true, $cloudLocation), $cloudLocation);
     $limits = $cs->limits();
     $l = array();
     foreach ($limits->limits->rate as $limit) {
         $limit->resetTime = Scalr_Util_DateTime::convertTz(date("c", $limit->resetTime));
         $l[] = (array) $limit;
     }
     $response = $this->buildResponseFromData($l, array());
     $this->response->data($response);
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:13,代码来源:Rackspace.php


示例17: xListUsersAction

 public function xListUsersAction()
 {
     $this->request->defineParams(array('sort' => array('type' => 'json')));
     $sql = 'SELECT id, status, email, fullname, dtcreated, dtlastlogin, comments FROM account_users WHERE type = ? AND :FILTER:';
     $response = $this->buildResponseFromSql2($sql, array('id', 'status', 'email', 'fullname', 'dtcreated', 'dtlastlogin'), array('email', 'fullname'), array(Scalr_Account_User::TYPE_SCALR_ADMIN));
     foreach ($response["data"] as &$row) {
         $user = Scalr_Account_User::init();
         $user->loadById($row['id']);
         $row['dtcreated'] = Scalr_Util_DateTime::convertTz($row["dtcreated"]);
         $row['dtlastlogin'] = $row['dtlastlogin'] ? Scalr_Util_DateTime::convertTz($row["dtlastlogin"]) : 'Never';
     }
     $this->response->data($response);
 }
开发者ID:recipe,项目名称:scalr,代码行数:13,代码来源:Users.php


示例18: xGetSnapshotsAction

 public function xGetSnapshotsAction()
 {
     $aws = $this->getEnvironment()->aws($this->getParam('cloudLocation'));
     $response = $aws->ec2->snapshot->describe(null, null, array(array('name' => SnapshotFilterNameType::ownerId(), 'value' => $this->getEnvironment()->getPlatformConfigValue(Ec2PlatformModule::ACCOUNT_ID)), array('name' => SnapshotFilterNameType::status(), 'value' => SnapshotData::STATUS_COMPLETED)));
     $data = array();
     /* @var $pv \Scalr\Service\Aws\Ec2\DataType\SnapshotData */
     foreach ($response as $pv) {
         if ($pv->status == SnapshotData::STATUS_COMPLETED) {
             $data[] = array('snapid' => $pv->snapshotId, 'createdat' => Scalr_Util_DateTime::convertTz($pv->startTime), 'size' => $pv->volumeSize, 'snapshotId' => $pv->snapshotId, 'createdDate' => Scalr_Util_DateTime::convertTz($pv->startTime), 'size' => $pv->volumeSize, 'volumeId' => $pv->volumeId, 'description' => (string) $pv->description, 'encrypted' => $pv->encrypted);
         }
     }
     $this->response->data(array('data' => $data));
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:13,代码来源:Ec2.php


示例19: handleWork

 function handleWork($farmId)
 {
     try {
         $dbFarm = DBFarm::LoadByID($farmId);
         $governance = new Scalr_Governance($dbFarm->EnvID);
         $settings = $governance->getValue(Scalr_Governance::CATEGORY_GENERAL, Scalr_Governance::GENERAL_LEASE, 'notifications');
         $curDate = new DateTime();
         $td = new DateTime($dbFarm->GetSetting(DBFarm::SETTING_LEASE_TERMINATE_DATE));
         if ($td > $curDate) {
             // only inform user
             $days = $td->diff($curDate)->days;
             $notifications = json_decode($dbFarm->GetSetting(DBFarm::SETTING_LEASE_NOTIFICATION_SEND), true);
             if (is_array($settings)) {
                 foreach ($settings as $n) {
                     if (!$notifications[$n['key']] && $n['period'] >= $days) {
                         $mailer = Scalr::getContainer()->mailer;
                         $tdHuman = Scalr_Util_DateTime::convertDateTime($td, $dbFarm->GetSetting(DBFarm::SETTING_TIMEZONE), 'M j, Y');
                         if ($n['to'] == 'owner') {
                             $user = new Scalr_Account_User();
                             $user->loadById($dbFarm->createdByUserId);
                             if (Scalr::config('scalr.auth_mode') == 'ldap') {
                                 $email = $user->getSetting(Scalr_Account_User::SETTING_LDAP_EMAIL);
                                 if (!$email) {
                                     $email = $user->getEmail();
                                 }
                             } else {
                                 $email = $user->getEmail();
                             }
                             $mailer->addTo($email);
                         } else {
                             foreach (explode(',', $n['emails']) as $email) {
                                 $mailer->addTo(trim($email));
                             }
                         }
                         $mailer->sendTemplate(SCALR_TEMPLATES_PATH . '/emails/farm_lease_terminate.eml', array('{{terminate_date}}' => $tdHuman, '{{farm}}' => $dbFarm->Name, '{{envName}}' => $dbFarm->GetEnvironmentObject()->name, '{{envId}}' => $dbFarm->GetEnvironmentObject()->id));
                         $notifications[$n['key']] = 1;
                         $dbFarm->SetSetting(DBFarm::SETTING_LEASE_NOTIFICATION_SEND, json_encode($notifications));
                         $this->logger->info("Notification was sent by key: " . $n['key'] . " about farm: " . $dbFarm->Name . " by lease manager");
                     }
                 }
             }
         } else {
             // terminate farm
             $event = new FarmTerminatedEvent(0, 1, false, 1);
             Scalr::FireEvent($farmId, $event);
             $this->logger->info("Farm: " . $dbFarm->Name . " was terminated by lease manager");
         }
     } catch (Exception $e) {
         var_dump($e->getMessage());
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:51,代码来源:LeaseManager.php


示例20: xListLimitsAction

 public function xListLimitsAction()
 {
     //TODO: check correct platform name
     $ccProps = $this->environment->cloudCredentials($this->getParam('cloudLocation') . SERVER_PLATFORMS::RACKSPACE)->properties;
     $cs = Scalr_Service_Cloud_Rackspace::newRackspaceCS($ccProps[Entity\CloudCredentialsProperty::RACKSPACE_USERNAME], $ccProps[Entity\CloudCredentialsProperty::RACKSPACE_API_KEY], $this->getParam('cloudLocation'));
     $limits = $cs->limits();
     $l = array();
     foreach ($limits->limits->rate as $limit) {
         $limit->resetTime = Scalr_Util_DateTime::convertTz(date("c", $limit->resetTime));
         $l[] = (array) $limit;
     }
     $response = $this->buildResponseFromData($l, array());
     $this->response->data($response);
 }
开发者ID:mheydt,项目名称:scalr,代码行数:14,代码来源:Rackspace.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ScatterPlot类代码示例发布时间:2022-05-23
下一篇:
PHP Scalr_UI_Controller类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap