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


PHP Scalr_Account_User::getDashboard方法代碼示例

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


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

示例1: run1

 /**
  * Performs upgrade literally for the stage ONE.
  *
  * Implementation of this method performs update steps needs to be taken
  * to accomplish upgrade successfully.
  *
  * If there are any error during an execution of this scenario it must
  * throw an exception.
  *
  * @param   int  $stage  optional The stage number
  * @throws  \Exception
  */
 protected function run1($stage)
 {
     $dashboards = $this->db->Execute('SELECT user_id, env_id FROM account_user_dashboard');
     foreach ($dashboards as $keys) {
         try {
             $user = new \Scalr_Account_User();
             $user->loadById($keys['user_id']);
             $dash = $user->getDashboard($keys['env_id']);
             if (!(is_array($dash) && isset($dash['configuration']) && is_array($dash['configuration']) && isset($dash['flags']) && is_array($dash['flags']))) {
                 // old configuration, remove it
                 $this->db->Execute('DELETE FROM account_user_dashboard WHERE user_id = ? AND env_id = ?', array($keys['user_id'], $keys['env_id']));
                 continue;
             }
             foreach ($dash['configuration'] as &$column) {
                 foreach ($column as &$widget) {
                     if ($widget['name'] == 'dashboard.monitoring') {
                         $metrics = array('CPUSNMP' => 'cpu', 'LASNMP' => 'la', 'NETSNMP' => 'net', 'ServersNum' => 'snum', 'MEMSNMP' => 'mem');
                         $params = array('farmId' => $widget['params']['farmid'], 'period' => $widget['params']['graph_type'], 'metrics' => $metrics[$widget['params']['watchername']], 'title' => $widget['params']['title'], 'hash' => $this->db->GetOne('SELECT hash FROM farms WHERE id = ?', array($widget['params']['farmid'])));
                         if (stristr($widget['params']['role'], "INSTANCE_")) {
                             $ar = explode('_', $widget['params']['role']);
                             $params['farmRoleId'] = $ar[1];
                             $params['index'] = $ar[2];
                         } else {
                             if ($widget['params']['role'] != 'FARM' && $widget['params']['role'] != 'role') {
                                 $params['farmRoleId'] = $widget['params']['role'];
                             }
                         }
                         $widget['params'] = $params;
                     }
                 }
             }
             $user->setDashboard($keys['env_id'], $dash);
         } catch (\Exception $e) {
             $this->console->warning($e->getMessage());
         }
     }
 }
開發者ID:sacredwebsite,項目名稱:scalr,代碼行數:49,代碼來源:Update20140306123554.php


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