PHP 클래스 Migration, glpi

파일 보기 프로젝트 열기: glpi-project/glpi 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$version

공개 메소드들

메소드 설명
__construct ( $ver )
addField ( $table, $field, $type, $options = [] ) Add a new GLPI normalized field
addKey ( $table, $fields, $indexname = '', $type = 'INDEX', $len ) Add index for migration
addNewMessageArea ( $id )
changeField ( $table, $oldfield, $newfield, $type, $options = [] ) Modify field for migration
copyTable ( $oldtable, $newtable ) Copy table for migration
createRule ( array $rule, array $criteria, array $actions ) : integer Register a new rule
displayMessage ( $msg ) Additional message in global message
displayTitle ( $title ) Display a title
displayWarning ( $msg, $red = false ) Display a Warning
dropField ( $table, $field ) Drop field for migration
dropKey ( $table, $indexname ) Drop index for migration
dropTable ( $table ) Drop immediatly a table if it exists
executeMigration ( ) Execute global migration
flushLogDisplayMessage ( ) Flush previous display message in log file
insertInTable ( $table, array $input ) : id Insert an entry inside a table
log ( $message, $warning ) log message for this migration
migrationOneTable ( $table ) Execute migration for only one table
renameTable ( $oldtable, $newtable ) Rename table for migration
setVersion ( $ver )
updateDisplayPrefs ( $toadd = [], $todel = [] ) Update display preferences

비공개 메소드들

메소드 설명
fieldFormat ( $type, $default_value, $nodefault = false ) Define field's format

메소드 상세

__construct() 공개 메소드

public __construct ( $ver )
$ver number of new version of GLPI

addField() 공개 메소드

Add a new GLPI normalized field
public addField ( $table, $field, $type, $options = [] )
$table string
$field string to add
$type string (see fieldFormat)
$options array - update : if not empty = value of $field (must be protected) - condition : if needed - value : default_value new field's default value, if a specific default value needs to be used - nodefault : do not define default value (default false) - comment : comment to be added during field creation - after : where adding the new field

addKey() 공개 메소드

Add index for migration
public addKey ( $table, $fields, $indexname = '', $type = 'INDEX', $len )
$table string
$fields string or array
$indexname string if empty =$fields (default '')
$type string index or unique (default 'INDEX')
$len integer for field length (default 0)

addNewMessageArea() 공개 메소드

public addNewMessageArea ( $id )
$id

changeField() 공개 메소드

Modify field for migration
public changeField ( $table, $oldfield, $newfield, $type, $options = [] )
$table string
$oldfield string old name of the field
$newfield string new name of the field
$type string (see fieldFormat)
$options array - default_value new field's default value, if a specific default value needs to be used - comment comment to be added during field creation - nodefault : do not define default value (default false)

copyTable() 공개 메소드

Copy table for migration
public copyTable ( $oldtable, $newtable )
$oldtable string The name of the table already inside the database
$newtable string The copy of the old table

createRule() 공개 메소드

Register a new rule
public createRule ( array $rule, array $criteria, array $actions ) : integer
$rule array Array of fields of glpi_rules
$criteria array Array of Array of fields of glpi_rulecriterias
$actions array Array of Array of fields of glpi_ruleactions
리턴 integer : new rule id

displayMessage() 공개 메소드

Additional message in global message
public displayMessage ( $msg )
$msg text to display

displayTitle() 공개 메소드

Display a title
public displayTitle ( $title )
$title string

displayWarning() 공개 메소드

Display a Warning
public displayWarning ( $msg, $red = false )
$msg string
$red boolean (false by default)

dropField() 공개 메소드

Drop field for migration
public dropField ( $table, $field )
$table string
$field string field to drop

dropKey() 공개 메소드

Drop index for migration
public dropKey ( $table, $indexname )
$table string
$indexname string

dropTable() 공개 메소드

Drop immediatly a table if it exists
public dropTable ( $table )

executeMigration() 공개 메소드

Execute global migration
public executeMigration ( )

flushLogDisplayMessage() 공개 메소드

Flush previous display message in log file

insertInTable() 공개 메소드

Insert an entry inside a table
public insertInTable ( $table, array $input ) : id
$table string The table to alter
$input array array The elements to add inside the table
리턴 id of the last item inserted by mysql

log() 공개 메소드

log message for this migration
public log ( $message, $warning )
$message
$warning

migrationOneTable() 공개 메소드

Execute migration for only one table
public migrationOneTable ( $table )
$table string

renameTable() 공개 메소드

Rename table for migration
public renameTable ( $oldtable, $newtable )
$oldtable string
$newtable string

setVersion() 공개 메소드

public setVersion ( $ver )
$ver number of new version

updateDisplayPrefs() 공개 메소드

Update display preferences
public updateDisplayPrefs ( $toadd = [], $todel = [] )
$toadd array items to add : itemtype => array of values
$todel array items to del : itemtype => array of values

프로퍼티 상세

$version 보호되어 있는 프로퍼티

protected $version