PHP Class Scalr

Afficher le fichier Open project: scalr/scalr Class Usage Examples

Méthodes publiques

Свойство Type Description
$emergencyMemory string Emergency memory that is used in the case of the memory limit error to handle error safely

Méthodes publiques

Méthode Description
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 )

Private Methods

Méthode Description
setupObservers ( )

Method Details

AttachObserver() public static méthode

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

FireEvent() public static méthode

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

GenerateAPIKeys() public static méthode

public static GenerateAPIKeys ( )

GenerateRandomKey() public static méthode

Generates random key of specified length
public static GenerateRandomKey ( integer $length = 128 ) : string
$length integer optional The length of the key
Résultat string Returns the random string of specified length

GenerateSecurePassword() public static méthode

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
Résultat string Returns generated password

GenerateUID() public static méthode

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

LaunchServer() public static méthode

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
Résultat DBServer | null Returns the DBServer object on cussess or null otherwise

ReconfigureObservers() public static méthode

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

StoreEvent() public static méthode

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

camelize() public static méthode

Camelizes string
public static camelize ( string $input ) : string
$input string A string to camelize
Résultat string Returns Camelized string

config() public static méthode

Gets config value
public static config ( string $name ) : mixed
$name string An option name
Résultat mixed Returns configuration value for the specified key

decamelize() public static méthode

Decamelizes a string
public static decamelize ( string $str ) : string
$str string A string
Résultat string Returns decamelized string

errorHandler() public static méthode

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

getAllHeaders() public static méthode

Get all http headers in camel-case form
public static getAllHeaders ( ) : array
Résultat array

getContainer() public static méthode

Gets DI container
public static getContainer ( ) : Container
Résultat Scalr\DependencyInjection\Container

getDb() public static méthode

Gets an ADO Database Connection as singleton
public static getDb ( boolean $forceNewConnection = null ) : ADODB_mysqli
$forceNewConnection boolean optional Force new connection. (false by default)
Résultat ADODB_mysqli

initializeContainer() public static méthode

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

isAllowedAnalyticsOnHostedScalrAccount() public static méthode

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
Résultat boolean Returns true if it is allowed of false otherwise

isHostedScalr() public static méthode

Checks whether current install is hosted scalr
public static isHostedScalr ( ) : boolean
Résultat boolean Returns true if current install is a hosted Scalr

logException() public static méthode

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

processHostDown() public static méthode

public static processHostDown ( DBServer $dbServer )
$dbServer DBServer

Property Details

$emergencyMemory public_oe static_oe property

Emergency memory that is used in the case of the memory limit error to handle error safely
public static string $emergencyMemory
Résultat string