本文整理汇总了PHP中DBServer类的典型用法代码示例。如果您正苦于以下问题:PHP DBServer类的具体用法?PHP DBServer怎么用?PHP DBServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBServer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: PutAccessData
public function PutAccessData(\DBServer $DBServer, \Scalr_Messaging_Msg $message)
{
$put = false;
$put |= $message instanceof \Scalr_Messaging_Msg_Rebundle;
$put |= $message instanceof \Scalr_Messaging_Msg_BeforeHostUp;
$put |= $message instanceof \Scalr_Messaging_Msg_HostInitResponse;
$put |= $message instanceof \Scalr_Messaging_Msg_Mysql_PromoteToMaster;
$put |= $message instanceof \Scalr_Messaging_Msg_Mysql_NewMasterUp;
$put |= $message instanceof \Scalr_Messaging_Msg_Mysql_CreateDataBundle;
$put |= $message instanceof \Scalr_Messaging_Msg_Mysql_CreateBackup;
$put |= $message instanceof \Scalr_Messaging_Msg_DbMsr_PromoteToMaster;
$put |= $message instanceof \Scalr_Messaging_Msg_DbMsr_CreateDataBundle;
$put |= $message instanceof \Scalr_Messaging_Msg_DbMsr_CreateBackup;
$put |= $message instanceof \Scalr_Messaging_Msg_DbMsr_NewMasterUp;
if ($put) {
$ccProps = $DBServer->GetEnvironmentObject()->keychain($DBServer->platform)->properties;
$accessData = new \stdClass();
$accessData->apiKey = $ccProps[CloudCredentialsProperty::CLOUDSTACK_API_KEY];
$accessData->secretKey = $ccProps[CloudCredentialsProperty::CLOUDSTACK_SECRET_KEY];
$apiUrl = $ccProps[CloudCredentialsProperty::CLOUDSTACK_API_URL];
if ($apiUrl == 'https://apis.i.noahcloud.jp/portal/client/api') {
$accessData->apiUrl = "https://api.noahcloud.jp/portal/client/api";
} else {
$accessData->apiUrl = $apiUrl;
}
$message->platformAccessData = $accessData;
}
}
开发者ID:scalr,项目名称:scalr,代码行数:28,代码来源:IdcfPlatformModule.php
示例2: setVolumes
public function setVolumes(\DBServer $server, $volumes)
{
$vlms = array();
foreach ($volumes as $volume) {
$vlms[$volume->scalrStorageId] = $volume;
}
foreach ($this->getConfigs() as $config) {
if ($vlms[$config->id]) {
$volume = new FarmRoleStorageDevice();
if (!$volume->loadById($volume->id)) {
$volume->farmRoleId = $this->farmRole->ID;
$volume->storageConfigId = $config->id;
$volume->serverIndex = $server->index;
$volume->storageId = $vlms[$config->id]->id;
$volume->cloudLocation = $server->GetCloudLocation();
$volume->envId = $server->envId;
}
switch ($config->type) {
case FarmRoleStorageConfig::TYPE_RAID_EBS:
$volume->placement = $vlms[$config->id]->disks[0]->availZone;
break;
case FarmRoleStorageConfig::TYPE_EBS:
$volume->placement = $vlms[$config->id]->availZone;
break;
}
$volume->config = $vlms[$config->id];
$volume->status = FarmRoleStorageDevice::STATUS_ACTIVE;
$volume->save();
unset($vlms[$config->id]);
}
}
//TODO: Handle zombies
}
开发者ID:rickb838,项目名称:scalr,代码行数:33,代码来源:FarmRoleStorage.php
示例3: GetServerIPAddresses
public function GetServerIPAddresses(DBServer $DBServer)
{
$client = $this->getOsClient($DBServer->GetEnvironmentObject(), $DBServer->GetProperty(OPENSTACK_SERVER_PROPERTIES::CLOUD_LOCATION));
$result = $client->servers->getServerDetails($DBServer->GetProperty(OPENSTACK_SERVER_PROPERTIES::SERVER_ID));
if ($result->accessIPv4) {
$remoteIp = $result->accessIPv4;
}
if (!$remoteIp) {
if (is_array($result->addresses->public)) {
foreach ($result->addresses->public as $addr) {
if ($addr->version == 4) {
$remoteIp = $addr->addr;
break;
}
}
}
}
if (is_array($result->addresses->private)) {
foreach ($result->addresses->private as $addr) {
if ($addr->version == 4) {
$localIp = $addr->addr;
break;
}
}
}
if (!$localIp) {
$localIp = $remoteIp;
}
return array('localIp' => $localIp, 'remoteIp' => $remoteIp);
}
开发者ID:recipe,项目名称:scalr,代码行数:30,代码来源:RackspaceNgUs.php
示例4: GetServerIPAddresses
/**
* {@inheritdoc}
* @see \Scalr\Modules\Platforms\Openstack\OpenstackPlatformModule::GetServerIPAddresses()
*/
public function GetServerIPAddresses(\DBServer $DBServer)
{
$config = \Scalr::getContainer()->config;
$client = $this->getOsClient($DBServer->GetEnvironmentObject(), $DBServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::CLOUD_LOCATION));
$result = $client->servers->getServerDetails($DBServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::SERVER_ID));
$publicNetworkName = 'public';
$privateNetworkName = 'private';
if (is_array($result->addresses->{$publicNetworkName})) {
foreach ($result->addresses->{$publicNetworkName} as $addr) {
if ($addr->version == 4) {
$remoteIp = $addr->addr;
break;
}
}
}
if (!$remoteIp && $result->accessIPv4) {
$remoteIp = $result->accessIPv4;
}
if (is_array($result->addresses->{$privateNetworkName})) {
foreach ($result->addresses->{$privateNetworkName} as $addr) {
if ($addr->version == 4) {
$localIp = $addr->addr;
break;
}
}
}
if (!$localIp) {
$localIp = $remoteIp;
}
return array('localIp' => $localIp, 'remoteIp' => $remoteIp);
}
开发者ID:mheydt,项目名称:scalr,代码行数:35,代码来源:RackspaceNgUsPlatformModule.php
示例5: PutAccessData
public function PutAccessData(\DBServer $DBServer, \Scalr_Messaging_Msg $message)
{
$put = false;
$put |= $message instanceof \Scalr_Messaging_Msg_Rebundle;
$put |= $message instanceof \Scalr_Messaging_Msg_BeforeHostUp;
$put |= $message instanceof \Scalr_Messaging_Msg_HostInitResponse;
$put |= $message instanceof \Scalr_Messaging_Msg_Mysql_PromoteToMaster;
$put |= $message instanceof \Scalr_Messaging_Msg_Mysql_NewMasterUp;
$put |= $message instanceof \Scalr_Messaging_Msg_Mysql_CreateDataBundle;
$put |= $message instanceof \Scalr_Messaging_Msg_Mysql_CreateBackup;
$put |= $message instanceof \Scalr_Messaging_Msg_DbMsr_PromoteToMaster;
$put |= $message instanceof \Scalr_Messaging_Msg_DbMsr_CreateDataBundle;
$put |= $message instanceof \Scalr_Messaging_Msg_DbMsr_CreateBackup;
$put |= $message instanceof \Scalr_Messaging_Msg_DbMsr_NewMasterUp;
if ($put) {
$environment = $DBServer->GetEnvironmentObject();
$accessData = new \stdClass();
$accessData->apiKey = $this->getConfigVariable(self::API_KEY, $environment);
$accessData->secretKey = $this->getConfigVariable(self::SECRET_KEY, $environment);
$apiUrl = $this->getConfigVariable(self::API_URL, $environment);
if ($apiUrl == 'https://apis.i.noahcloud.jp/portal/client/api') {
$accessData->apiUrl = "https://api.noahcloud.jp/portal/client/api";
} else {
$accessData->apiUrl = $apiUrl;
}
$message->platformAccessData = $accessData;
}
}
开发者ID:sacredwebsite,项目名称:scalr,代码行数:28,代码来源:IdcfPlatformModule.php
示例6: __construct
public function __construct(DBFarmRole $dbFarmRole, DBServer $dbServer, $type)
{
$this->dbFarmRole = $dbFarmRole;
$this->dbServer = $dbServer;
$this->logger = Logger::getLogger(__CLASS__);
$this->replicationMaster = (int) $dbServer->GetProperty(Scalr_Db_Msr::REPLICATION_MASTER);
$this->buildStorageSettings();
}
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:8,代码来源:Info.php
示例7: ResumeServer
public function ResumeServer(\DBServer $DBServer)
{
if ($this->getResumeStrategy() == \Scalr_Role_Behavior::RESUME_STRATEGY_INIT) {
$DBServer->status = \SERVER_STATUS::PENDING;
}
$DBServer->SetProperty(\SERVER_PROPERTIES::RESUMING, 1);
$DBServer->dateAdded = date("Y-m-d H:i:s");
$DBServer->Save();
}
开发者ID:sacredwebsite,项目名称:scalr,代码行数:9,代码来源:AbstractPlatformModule.php
示例8: TerminateServer
public function TerminateServer(DBServer $DBServer)
{
$cs = $this->getCloudStackClient($DBServer->GetEnvironmentObject(), $this->GetServerCloudLocation($DBServer));
if (!$DBServer->GetProperty(CLOUDSTACK_SERVER_PROPERTIES::IS_STOPPED_BEFORE_TERMINATE)) {
$cs->stopVirtualMachine($DBServer->GetProperty(CLOUDSTACK_SERVER_PROPERTIES::SERVER_ID), true);
$DBServer->SetProperty(CLOUDSTACK_SERVER_PROPERTIES::IS_STOPPED_BEFORE_TERMINATE, 1);
}
return parent::TerminateServer($DBServer);
}
开发者ID:recipe,项目名称:scalr,代码行数:9,代码来源:uCloud.php
示例9: getConfiguration
public function getConfiguration(DBServer $dbServer)
{
$config = new stdClass();
$config->cookie = $dbServer->GetFarmRoleObject()->GetSetting(self::ROLE_COOKIE_NAME);
$config->volumeConfig = $this->getVolumeConfig($dbServer->GetFarmRoleObject(), $dbServer);
$config->nodeType = $this->getNodeType($dbServer->GetFarmRoleObject(), $dbServer);
$config->password = $dbServer->GetFarmRoleObject()->GetSetting(self::ROLE_PASSWORD);
$dbServer->SetProperty(self::SERVER_NODE_TYPE, $config->nodeType);
return $config;
}
开发者ID:recipe,项目名称:scalr,代码行数:10,代码来源:RabbitMQ.php
示例10: __construct
public function __construct(DBServer $DBServer, $reasonId = 0, $reasonMsg = "")
{
parent::__construct();
$this->DBServer = $DBServer;
try {
$history = $this->DBServer->getServerHistory();
$this->launchReasonId = $history->launchReasonId;
$this->launchReason = $history->launchReason;
} catch (Exception $e) {
}
}
开发者ID:sacredwebsite,项目名称:scalr,代码行数:11,代码来源:class.BeforeInstanceLaunchEvent.php
示例11: __construct
public function __construct(DBServer $DBServer)
{
parent::__construct();
$this->DBServer = $DBServer;
try {
$history = $this->DBServer->getServerHistory();
$this->terminationReasonId = $history->terminateReasonId;
$this->terminationReason = $history->terminateReason;
} catch (Exception $e) {
}
}
开发者ID:mheydt,项目名称:scalr,代码行数:11,代码来源:class.HostDownEvent.php
示例12: removeIpFromServer
public static function removeIpFromServer(\DBServer $dbServer)
{
try {
if ($dbServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::FLOATING_IP)) {
if ($dbServer->farmRoleId) {
if ($dbServer->GetFarmRoleObject()->GetSetting(\DBFarmRole::SETTING_OPENSTACK_KEEP_FIP_ON_SUSPEND)) {
if (in_array($dbServer->status, array(\SERVER_STATUS::PENDING_SUSPEND, \SERVER_STATUS::SUSPENDED)) || $dbServer->GetRealStatus()->isSuspended()) {
return false;
}
}
}
$environment = $dbServer->GetEnvironmentObject();
$osClient = $environment->openstack($dbServer->platform, $dbServer->GetCloudLocation());
$ipId = $dbServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::FLOATING_IP_ID);
if ($osClient->hasService('network')) {
$osClient->network->floatingIps->delete($ipId);
} else {
$osClient->servers->deleteFloatingIp($ipId);
}
$dbServer->SetProperties(array(\OPENSTACK_SERVER_PROPERTIES::FLOATING_IP => null, \OPENSTACK_SERVER_PROPERTIES::FLOATING_IP_ID => null));
}
} catch (\Exception $e) {
\Logger::getLogger("OpenStackObserver")->fatal("OpenStackObserver observer failed: " . $e->getMessage());
}
}
开发者ID:sacredwebsite,项目名称:scalr,代码行数:25,代码来源:OpenstackHelper.php
示例13: __construct
public function __construct(DBServer $DBServer, $suspend = false)
{
parent::__construct();
$this->DBServer = $DBServer;
$this->suspend = $suspend;
if (!$this->suspend) {
try {
$history = $this->DBServer->getServerHistory();
$this->terminationReasonId = $history->terminateReasonId;
$this->terminationReason = $history->terminateReason;
} catch (Exception $e) {
}
}
}
开发者ID:mheydt,项目名称:scalr,代码行数:14,代码来源:class.BeforeHostTerminateEvent.php
示例14: setupScalrAgent
public static function setupScalrAgent(\DBServer $dbServer)
{
$baseurl = \Scalr::config('scalr.endpoint.scheme') . "://" . \Scalr::config('scalr.endpoint.host');
$env = $dbServer->GetEnvironmentObject();
$azure = $env->azure();
$branch = $dbServer->getScalarizrRepository()['repository'];
$develRepos = \Scalr::getContainer()->config->get('scalr.scalarizr_update.devel_repos');
$scmBranch = $dbServer->GetFarmRoleObject()->GetSetting('user-data.scm_branch');
if ($scmBranch != '' && $develRepos) {
$branch = $dbServer->GetFarmRoleObject()->GetSetting('base.devel_repository');
$scmBranch = "{$scmBranch}/";
} else {
$scmBranch = '';
}
if ($dbServer->osType == 'linux') {
$extensionProperties = new ResourceExtensionProperties('Microsoft.OSTCExtensions', 'CustomScriptForLinux', '1.2');
$extensionProperties->setSettings(['commandToExecute' => "bash -c 'curl -k -L \"{$baseurl}/public/linux/{$branch}/azure/{$scmBranch}install_scalarizr.sh\" | bash && service scalr-upd-client start'"]);
} else {
$extensionProperties = new ResourceExtensionProperties('Microsoft.Compute', 'CustomScriptExtension', '1.4');
$extensionProperties->setSettings(["commandToExecute" => "powershell -NoProfile -ExecutionPolicy Bypass -Command \"iex ((new-object net.webclient).DownloadString('{$baseurl}/public/windows/{$branch}/{$scmBranch}install_scalarizr.ps1')); start-service ScalrUpdClient\""]);
}
$createExtension = new CreateResourceExtension('scalarizr', $dbServer->cloudLocation, $extensionProperties);
try {
$response = $azure->compute->resourceExtension->create($env->keychain(SERVER_PLATFORMS::AZURE)->properties[Entity\CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID], $dbServer->GetProperty(\AZURE_SERVER_PROPERTIES::RESOURCE_GROUP), $dbServer->GetProperty(\AZURE_SERVER_PROPERTIES::SERVER_NAME), $createExtension);
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->info(new \FarmLogMessage($dbServer, sprintf(_("Created azure resource extension to install and launch scalr agent"))));
$dbServer->SetProperty(\AZURE_SERVER_PROPERTIES::SZR_EXTENSION_DEPLOYED, 1);
} catch (\Exception $e) {
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->fatal(new \FarmLogMessage($dbServer, sprintf(_("Unable to create azure resource extension to install and launch scalr agent: %s"), $e->getMessage())));
}
}
开发者ID:scalr,项目名称:scalr,代码行数:30,代码来源:AzureHelper.php
示例15: __construct
public function __construct(DBServer $DBServer)
{
parent::__construct();
$this->DBServer = $DBServer;
$r_server = \Scalr::getDb()->GetRow("SELECT server_id FROM servers WHERE replace_server_id=? LIMIT 1", array($DBServer->serverId));
if ($r_server) {
$this->replacementDBServer = DBServer::LoadByID($r_server['server_id']);
}
try {
$history = $this->DBServer->getServerHistory();
$this->terminationReasonId = $history->terminateReasonId;
$this->terminationReason = $history->terminateReason;
} catch (Exception $e) {
}
}
开发者ID:sacredwebsite,项目名称:scalr,代码行数:15,代码来源:class.HostDownEvent.php
示例16: 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
示例17: xListVolumesAction
public function xListVolumesAction()
{
$this->request->defineParams(array('sort' => array('type' => 'json', 'default' => array('property' => 'volumeId', 'direction' => 'ASC')), 'volumeId'));
$platformName = $this->getParam('platform');
if (!$platformName) {
throw new Exception("Cloud should be specified");
}
$client = $this->environment->openstack($platformName, $this->getParam('cloudLocation'));
$volumes = $client->volume->listVolumes(true);
$vols = array();
foreach ($volumes as $pk => $pv) {
if ($this->getParam('volumeId') && $this->getParam('volumeId') != $pv->id) {
continue;
}
$item = array('volumeId' => $pv->id, 'size' => $pv->size, 'status' => $pv->status, 'attachmentStatus' => isset($pv->attachments[0]) ? 'attached' : 'available', 'device' => isset($pv->attachments[0]) ? $pv->attachments[0]->device : "", 'instanceId' => isset($pv->attachments[0]) ? $pv->attachments[0]->server_id : "", 'type' => $pv->volume_type, 'availability_zone' => $pv->availability_zone);
if ($item['instanceId']) {
try {
$dbServer = DBServer::LoadByPropertyValue(OPENSTACK_SERVER_PROPERTIES::SERVER_ID, $item['instanceId']);
$item['farmId'] = $dbServer->farmId;
$item['farmRoleId'] = $dbServer->farmRoleId;
$item['serverIndex'] = $dbServer->index;
$item['serverId'] = $dbServer->serverId;
$item['farmName'] = $dbServer->GetFarmObject()->Name;
$item['mountStatus'] = false;
$item['roleName'] = $dbServer->GetFarmRoleObject()->GetRoleObject()->name;
} catch (Exception $e) {
}
}
$vols[] = $item;
}
$response = $this->buildResponseFromData($vols, array('serverId', 'volumeId', 'farmId', 'farmRoleId'));
$this->response->data($response);
}
开发者ID:recipe,项目名称:scalr,代码行数:33,代码来源:Volumes.php
示例18: xCreateAction
public function xCreateAction()
{
$this->request->defineParams(array('volumeId', 'cloudLocation'));
$aws = $this->getEnvironment()->aws($this->getParam('cloudLocation'));
$snapshot = $aws->ec2->snapshot->create($this->getParam('volumeId'));
if (isset($snapshot->snapshotId)) {
/* @var $volume \Scalr\Service\Aws\Ec2\DataType\VolumeData */
$volume = $aws->ec2->volume->describe($snapshot->volumeId)->get(0);
if (count($volume->attachmentSet) && !empty($volume->attachmentSet[0]->instanceId)) {
$instanceId = $volume->attachmentSet[0]->instanceId;
try {
$dBServer = DBServer::LoadByPropertyValue(EC2_SERVER_PROPERTIES::INSTANCE_ID, $instanceId);
$dBFarm = $dBServer->GetFarmObject();
} catch (Exception $e) {
}
if (isset($dBServer) && isset($dBFarm)) {
$comment = sprintf(_("Created on farm '%s', server '%s' (Instance ID: %s)"), $dBFarm->Name, $dBServer->serverId, $instanceId);
}
} else {
$comment = '';
}
$this->db->Execute("\n INSERT INTO ebs_snaps_info\n SET snapid = ?,\n comment = ?,\n dtcreated = NOW(),\n region = ?\n ", array($snapshot->snapshotId, $comment, $this->getParam('cloudLocation')));
$this->response->data(array('data' => array('snapshotId' => $snapshot->snapshotId)));
} else {
throw new Exception("Unable to create snapshot. Please try again later.");
}
}
开发者ID:rickb838,项目名称:scalr,代码行数:27,代码来源:Snapshots.php
示例19: 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
示例20: 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
注:本文中的DBServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论