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


PHP DBServer类代码示例

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


在下文中一共展示了DBServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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