[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/db/ -> migrator.php (summary)

This file is part of the phpBB Forum Software package.

Copyright: (c) phpBB Limited
License: GNU General Public License, version 2 (GPL-2.0)
File Size: 1038 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

migrator:: (25 methods):
  __construct()
  set_output_handler()
  load_migration_state()
  get_last_run_migration()
  set_migrations()
  get_migrations()
  get_installable_migrations()
  update()
  get_valid_name()
  update_do()
  try_apply()
  revert()
  revert_do()
  try_revert()
  process_data_step()
  run_step()
  get_callable_from_step()
  set_migration_state()
  unfulfillable()
  finished()
  migration_state()
  get_migration()
  populate_migrations()
  create_migrations_table()
  is_migration()


Class: migrator  - X-Ref

The migrator is responsible for applying new migrations in the correct order.

__construct(ContainerInterface $container, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper)   X-Ref
Constructor of the database migrator


set_output_handler(migrator_output_handler_interface $handler)   X-Ref
Set the output handler.

param: migrator_output_handler_interface $handler The output handler

load_migration_state()   X-Ref
Loads all migrations and their application state from the database.

return: null

get_last_run_migration()   X-Ref
Get an array with information about the last migration run.

The array contains 'name', 'class' and 'state'. 'effectively_installed' is set
and set to true if the last migration was effectively_installed.

return: array

set_migrations($class_names)   X-Ref
Sets the list of available migration class names to the given array.

param: array $class_names An array of migration class names
return: null

get_migrations()   X-Ref
Get the list of available migration class names

return: array Array of all migrations available to be run

get_installable_migrations()   X-Ref
Get the list of available and not installed migration class names

return: array

update()   X-Ref
Runs a single update step from the next migration to be applied.

The update step can either be a schema or a (partial) data update. To
check if update() needs to be called again use the finished() method.

return: null

get_valid_name($name)   X-Ref
Get a valid migration name from the migration state array in case the
supplied name is not in the migration state list.

param: string $name Migration name
return: string Migration name

update_do()   X-Ref
Effectively runs a single update step from the next migration to be applied.

return: null

try_apply($name)   X-Ref
Attempts to apply a step of the given migration or one of its dependencies

param: string    $name The class name of the migration
return: bool    Whether any update step was successfully run

revert($migration)   X-Ref
Runs a single revert step from the last migration installed

YOU MUST ADD/SET ALL MIGRATIONS THAT COULD BE DEPENDENT ON THE MIGRATION TO REVERT TO BEFORE CALLING THIS METHOD!
The revert step can either be a schema or a (partial) data revert. To
check if revert() needs to be called again use the migration_state() method.

param: string $migration String migration name to revert (including any that depend on this migration)

revert_do($migration)   X-Ref
Effectively runs a single revert step from the last migration installed

param: string $migration String migration name to revert (including any that depend on this migration)
return: null

try_revert($name)   X-Ref
Attempts to revert a step of the given migration or one of its dependencies

param: string    $name The class name of the migration
return: bool    Whether any update step was successfully run

process_data_step($steps, $state, $revert = false)   X-Ref
Process the data step of the migration

param: array $steps The steps to run
param: bool|string $state Current state of the migration
param: bool $revert true to revert a data step
return: bool|string migration state. True if completed, serialized array if not finished

run_step($step, $last_result = 0, $reverse = false)   X-Ref
Run a single step

An exception should be thrown if an error occurs

param: mixed $step Data step from migration
param: mixed $last_result Result to pass to the callable (only for 'custom' method)
param: bool $reverse False to install, True to attempt uninstallation by reversing the call
return: null

get_callable_from_step(array $step, $last_result = 0, $reverse = false)   X-Ref
Get a callable statement from a data step

param: array $step Data step from migration
param: mixed $last_result Result to pass to the callable (only for 'custom' method)
param: bool $reverse False to install, True to attempt uninstallation by reversing the call
return: array Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters

set_migration_state($name, $state)   X-Ref
Insert/Update migration row into the database

param: string $name Name of the migration
param: array $state
return: null

unfulfillable($name)   X-Ref
Checks if a migration's dependencies can even theoretically be satisfied.

param: string    $name The class name of the migration
return: bool|string False if fulfillable, string of missing migration name if unfulfillable

finished()   X-Ref
Checks whether all available, fulfillable migrations have been applied.

return: bool Whether the migrations have been applied

migration_state($migration)   X-Ref
Gets a migration state (whether it is installed and to what extent)

param: string $migration String migration name to check if it is installed
return: bool|array False if the migration has not at all been installed, array

get_migration($name)   X-Ref
Helper to get a migration

param: string $name Name of the migration
return: \phpbb\db\migration\migration

populate_migrations($migrations)   X-Ref
This function adds all migrations sent to it to the migrations table

THIS SHOULD NOT GENERALLY BE USED! THIS IS FOR THE PHPBB INSTALLER.
THIS WILL THROW ERRORS IF MIGRATIONS ALREADY EXIST IN THE TABLE, DO NOT CALL MORE THAN ONCE!

param: array $migrations Array of migrations (names) to add to the migrations table
return: null

create_migrations_table()   X-Ref
Creates the migrations table if it does not exist.

return: null

is_migration($migration)   X-Ref
Check if a class is a migration.

param: string $migration A migration class name
return: bool Return true if class is a migration, false otherwise



Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1