mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-20 23:51:28 +01:00
[ticket/14831] Rename migration and replace preg_replace() with simpler methods
PHPBB3-14831
This commit is contained in:
parent
6f8c0df1c6
commit
ffc6623dd4
@ -14,7 +14,7 @@
|
||||
|
||||
namespace phpbb\db\migration\data\v31x;
|
||||
|
||||
class migrations_deduplicate_entries extends \phpbb\db\migration\migration
|
||||
class remove_duplicate_migrations extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
@ -44,7 +44,6 @@ class migrations_deduplicate_entries extends \phpbb\db\migration\migration
|
||||
$migration_state[$migration['migration_name']] = $migration;
|
||||
|
||||
$migration_state[$migration['migration_name']]['migration_depends_on'] = unserialize($migration['migration_depends_on']);
|
||||
$migration_state[$migration['migration_name']]['migration_data_state'] = !empty($migration['migration_data_state']) ? unserialize($migration['migration_data_state']) : '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,8 +51,8 @@ class migrations_deduplicate_entries extends \phpbb\db\migration\migration
|
||||
|
||||
foreach ($migration_state as $name => $migration)
|
||||
{
|
||||
$prepended_name = preg_replace('#^(?!\\\)#', '\\\$0', $name);
|
||||
$prefixless_name = preg_replace('#(^\\\)([^\\\].+)#', '$2', $name);
|
||||
$prepended_name = ($name[0] == '\\' ? '' : '\\') . $name;
|
||||
$prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name;
|
||||
|
||||
if ($prepended_name != $name && isset($migration_state[$prepended_name]) && $migration_state[$prepended_name]['migration_depends_on'] == $migration_state[$name]['migration_depends_on'])
|
||||
{
|
@ -212,8 +212,8 @@ class migrator
|
||||
// Try falling back to a valid migration name with or without leading backslash
|
||||
if (!isset($this->migration_state[$name]))
|
||||
{
|
||||
$prepended_name = preg_replace('#^(?!\\\)#', '\\\$0', $name);
|
||||
$prefixless_name = preg_replace('#(^\\\)([^\\\].+)#', '$2', $name);
|
||||
$prepended_name = ($name[0] == '\\' ? '' : '\\') . $name;
|
||||
$prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name;
|
||||
|
||||
if (isset($this->migration_state[$prepended_name]))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user