PHP Класс Scalr

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$emergencyMemory string Emergency memory that is used in the case of the memory limit error to handle error safely

Открытые методы

Метод Описание
AttachObserver ( AbstractEventObserver $observer ) Attach observer
FireEvent ( integer $farmid, AbstractServerEvent $event ) File event in database
GenerateAPIKeys ( )
GenerateRandomKey ( integer $length = 128 ) : string Generates random key of specified length
GenerateSecurePassword ( integer $length = 16, array $sets = null, array $enabledSets = null ) : string Generates password that includes at least one symbols from each set: l - lower case characters u - upper case characters d - digits s - special characters
GenerateUID ( $short = false, $startWithLetter = false )
LaunchServer ( ServerCreateInfo $ServerCreateInfo = null, DBServer $DBServer = null, boolean $delayed = false, integer | array $reason, Scalr_Account_User | integer $user = null ) : DBServer | null Launches server
ReconfigureObservers ( ) Method for multiprocess scripts. We must recreate DB connection created in constructor
StoreEvent ( integer $farmid, AbstractServerEvent $event, $eventTime = null ) Store event in database
camelize ( string $input ) : string Camelizes string
config ( string $name ) : mixed Gets config value
decamelize ( string $str ) : string Decamelizes a string
errorHandler ( integer $errno, string $errstr, string $errfile, integer $errline ) Scalr error handler
getAllHeaders ( ) : array Get all http headers in camel-case form
getContainer ( ) : Container Gets DI container
getDb ( boolean $forceNewConnection = null ) : ADODB_mysqli Gets an ADO Database Connection as singleton
initializeContainer ( ) Performs preliminary initialization of the DI container
isAllowedAnalyticsOnHostedScalrAccount ( integer $accountId ) : boolean Checks whether specified account is allowed to manage Cost centers and Projects on hosted scalr account
isHostedScalr ( ) : boolean Checks whether current install is hosted scalr
logException ( Exception $e ) Adds catchable exception to standart PHP error log
processHostDown ( DBServer $dbServer )

Приватные методы

Метод Описание
setupObservers ( )

Описание методов

AttachObserver() публичный статический Метод

Attach observer
public static AttachObserver ( AbstractEventObserver $observer )
$observer Scalr\Observer\AbstractEventObserver

FireEvent() публичный статический Метод

File event in database
public static FireEvent ( integer $farmid, AbstractServerEvent $event )
$farmid integer
$event AbstractServerEvent

GenerateAPIKeys() публичный статический Метод

public static GenerateAPIKeys ( )

GenerateRandomKey() публичный статический Метод

Generates random key of specified length
public static GenerateRandomKey ( integer $length = 128 ) : string
$length integer optional The length of the key
Результат string Returns the random string of specified length

GenerateSecurePassword() публичный статический Метод

Generates password that includes at least one symbols from each set: l - lower case characters u - upper case characters d - digits s - special characters
public static GenerateSecurePassword ( integer $length = 16, array $sets = null, array $enabledSets = null ) : string
$length integer optional Password length
$sets array optional User (re-)defined characters sets
$enabledSets array optional Names of enabled sets, if null — all sets are enabled
Результат string Returns generated password

GenerateUID() публичный статический Метод

public static GenerateUID ( $short = false, $startWithLetter = false )

LaunchServer() публичный статический Метод

Launches server
public static LaunchServer ( ServerCreateInfo $ServerCreateInfo = null, DBServer $DBServer = null, boolean $delayed = false, integer | array $reason, Scalr_Account_User | integer $user = null ) : DBServer | null
$ServerCreateInfo ServerCreateInfo optional The server create info
$DBServer DBServer optional The DBServer object
$delayed boolean optional
$reason integer | array optional
$user Scalr_Account_User | integer optional The Scalr_Account_User object or its unique identifier
Результат DBServer | null Returns the DBServer object on cussess or null otherwise

ReconfigureObservers() публичный статический Метод

Method for multiprocess scripts. We must recreate DB connection created in constructor
public static ReconfigureObservers ( )

StoreEvent() публичный статический Метод

Store event in database
public static StoreEvent ( integer $farmid, AbstractServerEvent $event, $eventTime = null )
$farmid integer
$event AbstractServerEvent

camelize() публичный статический Метод

Camelizes string
public static camelize ( string $input ) : string
$input string A string to camelize
Результат string Returns Camelized string

config() публичный статический Метод

Gets config value
public static config ( string $name ) : mixed
$name string An option name
Результат mixed Returns configuration value for the specified key

decamelize() публичный статический Метод

Decamelizes a string
public static decamelize ( string $str ) : string
$str string A string
Результат string Returns decamelized string

errorHandler() публичный статический Метод

Scalr error handler
public static errorHandler ( integer $errno, string $errstr, string $errfile, integer $errline )
$errno integer
$errstr string
$errfile string
$errline integer

getAllHeaders() публичный статический Метод

Get all http headers in camel-case form
public static getAllHeaders ( ) : array
Результат array

getContainer() публичный статический Метод

Gets DI container
public static getContainer ( ) : Container
Результат Scalr\DependencyInjection\Container

getDb() публичный статический Метод

Gets an ADO Database Connection as singleton
public static getDb ( boolean $forceNewConnection = null ) : ADODB_mysqli
$forceNewConnection boolean optional Force new connection. (false by default)
Результат ADODB_mysqli

initializeContainer() публичный статический Метод

Performs preliminary initialization of the DI container
public static initializeContainer ( )

isAllowedAnalyticsOnHostedScalrAccount() публичный статический Метод

Checks whether specified account is allowed to manage Cost centers and Projects on hosted scalr account
public static isAllowedAnalyticsOnHostedScalrAccount ( integer $accountId ) : boolean
$accountId integer Identifier of the client's account
Результат boolean Returns true if it is allowed of false otherwise

isHostedScalr() публичный статический Метод

Checks whether current install is hosted scalr
public static isHostedScalr ( ) : boolean
Результат boolean Returns true if current install is a hosted Scalr

logException() публичный статический Метод

Adds catchable exception to standart PHP error log
public static logException ( Exception $e )
$e Exception The exception to log

processHostDown() публичный статический Метод

public static processHostDown ( DBServer $dbServer )
$dbServer DBServer

Описание свойств

$emergencyMemory публичное статическое свойство

Emergency memory that is used in the case of the memory limit error to handle error safely
public static string $emergencyMemory
Результат string