PHP Class DBConnection, glpi

Author: sabuj.das
Afficher le fichier Open project: glpi-project/glpi Class Usage Examples

Protected Properties

Свойство Type Description
$notable

Méthodes publiques

Méthode Description
changeCronTaskStatus ( $enable = true ) Enable or disable db replication check cron task
createDBSlaveConfig ( ) Create a default slave DB configuration file
createMainConfig ( $host, $user, $password, $DBname ) : boolean Create GLPI main configuration file
createSlaveConnectionFile ( $host, $user, $password, $DBname ) : boolean Create slave DB configuration file
cronCheckDBreplicate ( $task ) Cron process to check DB replicate state
cronInfo ( $name )
deleteDBSlaveConfig ( ) Delete slave DB configuration file
displayMySQLError ( ) Display a common mysql connection error
establishDBConnection ( $use_slave, $required, $display = true ) Establish a connection to a mysql server (main or replicate)
getDBSlaveConf ( $choice = NULL ) : DBmysql Read slave DB configuration file
getHistoryMaxDate ( $DBconnection ) Get history max date of a GLPI DB
getReadConnection ( ) : DBmysql Get Connection to slave, if exists, and if configured to be used for read only request
getReplicateDelay ( $choice = NULL ) : integer Get delay between slave and master
getTypeName ( $nb )
isDBSlaveActive ( ) : true Indicates is the DB replicate is active or not
saveDBSlaveConf ( $host, $user, $password, $DBname ) Save changes to the slave DB configuration file
showAllReplicateDelay ( ) Display in HTML, delay between master and slave 1 line per slave is multiple
showSystemInformations ( $width )
switchToMaster ( ) Switch database connection to master
switchToSlave ( ) Switch database connection to slave

Method Details

changeCronTaskStatus() static public méthode

Enable or disable db replication check cron task
static public changeCronTaskStatus ( $enable = true )

createDBSlaveConfig() static public méthode

Create a default slave DB configuration file
static public createDBSlaveConfig ( )

createMainConfig() static public méthode

Create GLPI main configuration file
Since: 9.1
static public createMainConfig ( $host, $user, $password, $DBname ) : boolean
$user
$password
$DBname
Résultat boolean

createSlaveConnectionFile() static public méthode

Create slave DB configuration file
static public createSlaveConnectionFile ( $host, $user, $password, $DBname ) : boolean
Résultat boolean for success

cronCheckDBreplicate() static public méthode

Cron process to check DB replicate state
static public cronCheckDBreplicate ( $task )
$task to log and get param

cronInfo() static public méthode

static public cronInfo ( $name )
$name

deleteDBSlaveConfig() static public méthode

Delete slave DB configuration file
static public deleteDBSlaveConfig ( )

displayMySQLError() static public méthode

Display a common mysql connection error
static public displayMySQLError ( )

establishDBConnection() static public méthode

Establish a connection to a mysql server (main or replicate)
static public establishDBConnection ( $use_slave, $required, $display = true )
$use_slave try to connect to slave server first not to main server
$required connection to the specified server is required (if connection failed, do not try to connect to the other server)
$display display error message (true by default)

getDBSlaveConf() static public méthode

Read slave DB configuration file
static public getDBSlaveConf ( $choice = NULL ) : DBmysql
$choice integer, host number (default NULL)
Résultat DBmysql object

getHistoryMaxDate() static public méthode

Get history max date of a GLPI DB
static public getHistoryMaxDate ( $DBconnection )
$DBconnection DB conneciton used

getReadConnection() static public méthode

Get Connection to slave, if exists, and if configured to be used for read only request
static public getReadConnection ( ) : DBmysql
Résultat DBmysql object

getReplicateDelay() static public méthode

Get delay between slave and master
static public getReplicateDelay ( $choice = NULL ) : integer
$choice integer, host number (default NULL)
Résultat integer

getTypeName() static public méthode

static public getTypeName ( $nb )

isDBSlaveActive() static public méthode

Indicates is the DB replicate is active or not
static public isDBSlaveActive ( ) : true
Résultat true if active / false if not active

saveDBSlaveConf() static public méthode

Save changes to the slave DB configuration file
static public saveDBSlaveConf ( $host, $user, $password, $DBname )
$host
$user
$password
$DBname

showAllReplicateDelay() static public méthode

Display in HTML, delay between master and slave 1 line per slave is multiple
static public showAllReplicateDelay ( )

showSystemInformations() public méthode

public showSystemInformations ( $width )
$width

switchToMaster() static public méthode

Switch database connection to master
static public switchToMaster ( )

switchToSlave() static public méthode

Switch database connection to slave
static public switchToSlave ( )

Property Details

$notable protected_oe static_oe property

protected static $notable