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