mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 03:48:53 +00:00
[feature/migrations] Function to populate the migrations table (for install)
PHPBB3-9737
This commit is contained in:
parent
26c16559c3
commit
000b8fefd2
1 changed files with 36 additions and 0 deletions
|
@ -124,6 +124,42 @@ class phpbb_db_migrator
|
||||||
$this->migrations = $class_names;
|
$this->migrations = $class_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds all migrations in a specified directory 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 string $path Path to migration data files
|
||||||
|
* @param bool $recursive Set to true to also load data files from subdirectories
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function populate_migrations_from_directory($path, $recursive = true)
|
||||||
|
{
|
||||||
|
$existing_migrations = $this->migrations;
|
||||||
|
|
||||||
|
$this->migrations = array();
|
||||||
|
$this->load_migrations($path, true, $recursive);
|
||||||
|
|
||||||
|
foreach ($this->migrations as $name)
|
||||||
|
{
|
||||||
|
if ($this->migration_state($name) === false)
|
||||||
|
{
|
||||||
|
$state = array(
|
||||||
|
'migration_depends_on' => $name::depends_on(),
|
||||||
|
'migration_schema_done' => true,
|
||||||
|
'migration_data_done' => true,
|
||||||
|
'migration_data_state' => '',
|
||||||
|
'migration_start_time' => time(),
|
||||||
|
'migration_end_time' => time(),
|
||||||
|
);
|
||||||
|
$this->insert_migration($name, $state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->migrations = $existing_migrations;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load migration data files from a directory
|
* Load migration data files from a directory
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue