Свойство | Type | Description | |
---|---|---|---|
$version |
Méthode | Description | |
---|---|---|
__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 |
Méthode | Description | |
---|---|---|
fieldFormat ( $type, $default_value, $nodefault = false ) | Define field's format |
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 |
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) |
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) |
public copyTable ( $oldtable, $newtable ) | ||
$oldtable | string The name of the table already inside the database | |
$newtable | string The copy of the old table |
public displayMessage ( $msg ) | ||
$msg | text to display |
public displayWarning ( $msg, $red = false ) | ||
$msg | string | |
$red | boolean (false by default) |
public dropField ( $table, $field ) | ||
$table | string | |
$field | string field to drop |
public dropKey ( $table, $indexname ) | ||
$table | string | |
$indexname | string |
public flushLogDisplayMessage ( ) |
public insertInTable ( $table, array $input ) : id | ||
$table | string The table to alter | |
$input | array | array The elements to add inside the table |
Résultat | id | of the last item inserted by mysql |
public log ( $message, $warning ) | ||
$message | ||
$warning |
public migrationOneTable ( $table ) | ||
$table | string |
public renameTable ( $oldtable, $newtable ) | ||
$oldtable | string | |
$newtable | string |
public updateDisplayPrefs ( $toadd = [], $todel = [] ) | ||
$toadd | array items to add : itemtype => array of values | |
$todel | array items to del : itemtype => array of values |