PHP Класс DBConnection, glpi

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

Защищенные свойства (Protected)

Свойство Тип Описание
$notable

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

Метод Описание
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

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

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

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

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

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

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

Create GLPI main configuration file
С версии: 9.1
static public createMainConfig ( $host, $user, $password, $DBname ) : boolean
$user
$password
$DBname
Результат boolean

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

Create slave DB configuration file
static public createSlaveConnectionFile ( $host, $user, $password, $DBname ) : boolean
Результат boolean for success

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

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

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

static public cronInfo ( $name )
$name

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

Delete slave DB configuration file
static public deleteDBSlaveConfig ( )

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

Display a common mysql connection error
static public displayMySQLError ( )

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

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() статический публичный Метод

Read slave DB configuration file
static public getDBSlaveConf ( $choice = NULL ) : DBmysql
$choice integer, host number (default NULL)
Результат DBmysql object

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

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

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

Get Connection to slave, if exists, and if configured to be used for read only request
static public getReadConnection ( ) : DBmysql
Результат DBmysql object

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

Get delay between slave and master
static public getReplicateDelay ( $choice = NULL ) : integer
$choice integer, host number (default NULL)
Результат integer

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

static public getTypeName ( $nb )

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

Indicates is the DB replicate is active or not
static public isDBSlaveActive ( ) : true
Результат true if active / false if not active

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

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

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

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

showSystemInformations() публичный Метод

public showSystemInformations ( $width )
$width

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

Switch database connection to master
static public switchToMaster ( )

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

Switch database connection to slave
static public switchToSlave ( )

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

$notable защищенное статическое свойство

protected static $notable