mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 20:13:22 +01:00
[feature/migrations] Function to populate the migrations table (for install)
PHPBB3-9737
This commit is contained in:
parent
26c16559c3
commit
000b8fefd2
@ -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…
x
Reference in New Issue
Block a user