当前位置: 首页>>代码示例>>PHP>>正文


PHP DBFarm::LoadByIDOnlyName方法代码示例

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


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

示例1: 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

示例2: xListAction

 /**
  * @param JsonData $sort
  * @param int $start
  * @param int $limit
  */
 public function xListAction(JsonData $sort, $start = 0, $limit = 20)
 {
     $result = ScriptShortcut::find(['farmId' => ['$in' => $this->getAllowedFarmId()]], null, Scalr\UI\Utils::convertOrder($sort, ['scriptId' => true], ['scriptId', 'farmId', 'farmRoleId']), $limit, $start, true);
     $data = [];
     foreach ($result as $shortcut) {
         /* @var $shortcut ScriptShortcut */
         $s = get_object_vars($shortcut);
         $s['farmName'] = DBFarm::LoadByIDOnlyName($shortcut->farmId);
         $s['scriptName'] = $shortcut->getScriptName();
         try {
             $farmRole = DBFarmRole::LoadByID($shortcut->farmRoleId);
             $s['farmRoleName'] = $farmRole->Alias ? $farmRole->Alias : $farmRole->GetRoleObject()->name;
         } catch (Exception $e) {
         }
         $data[] = $s;
     }
     $this->response->data(['total' => $result->totalNumber, 'data' => $data]);
 }
开发者ID:mheydt,项目名称:scalr,代码行数:23,代码来源:Shortcuts.php


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