mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/11103
# By Nathaniel Guse # Via David King (2) and Nathaniel Guse (1) * 'develop' of github.com:phpbb/phpbb3: [ticket/11370] Effectively installed migrations not inserted into table [ticket/11369] Reverting migration throws error
This commit is contained in:
commit
f665a4b5cf
1 changed files with 18 additions and 23 deletions
|
@ -332,7 +332,6 @@ class phpbb_db_migrator
|
|||
if (!isset($this->migration_state[$name]))
|
||||
{
|
||||
$state['migration_start_time'] = time();
|
||||
$this->insert_migration($name, $state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,14 +360,7 @@ class phpbb_db_migrator
|
|||
}
|
||||
}
|
||||
|
||||
$insert = $state;
|
||||
$insert['migration_depends_on'] = serialize($state['migration_depends_on']);
|
||||
$sql = 'UPDATE ' . $this->migrations_table . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $insert) . "
|
||||
WHERE migration_name = '" . $this->db->sql_escape($name) . "'";
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$this->migration_state[$name] = $state;
|
||||
$this->insert_migration($name, $state);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -434,20 +426,13 @@ class phpbb_db_migrator
|
|||
}
|
||||
else
|
||||
{
|
||||
$result = $this->process_data_step($migration->revert_data(), $state['migration_data_state'], false);
|
||||
$result = $this->process_data_step($migration->revert_data(), '', false);
|
||||
|
||||
$state['migration_data_state'] = ($result === true) ? '' : $result;
|
||||
$state['migration_data_done'] = ($result === true) ? false : true;
|
||||
}
|
||||
|
||||
$insert = $state;
|
||||
$insert['migration_depends_on'] = serialize($state['migration_depends_on']);
|
||||
$sql = 'UPDATE ' . $this->migrations_table . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $insert) . "
|
||||
WHERE migration_name = '" . $this->db->sql_escape($name) . "'";
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$this->migration_state[$name] = $state;
|
||||
$this->insert_migration($name, $state);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -660,7 +645,7 @@ class phpbb_db_migrator
|
|||
}
|
||||
|
||||
/**
|
||||
* Insert migration row into the database
|
||||
* Insert/Update migration row into the database
|
||||
*
|
||||
* @param string $name Name of the migration
|
||||
* @param array $state
|
||||
|
@ -669,12 +654,22 @@ class phpbb_db_migrator
|
|||
protected function insert_migration($name, $state)
|
||||
{
|
||||
$migration_row = $state;
|
||||
$migration_row['migration_name'] = $name;
|
||||
$migration_row['migration_depends_on'] = serialize($state['migration_depends_on']);
|
||||
|
||||
$sql = 'INSERT INTO ' . $this->migrations_table . '
|
||||
' . $this->db->sql_build_array('INSERT', $migration_row);
|
||||
$this->db->sql_query($sql);
|
||||
if (isset($this->migration_state[$name]))
|
||||
{
|
||||
$sql = 'UPDATE ' . $this->migrations_table . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $migration_row) . "
|
||||
WHERE migration_name = '" . $this->db->sql_escape($name) . "'";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$migration_row['migration_name'] = $name;
|
||||
$sql = 'INSERT INTO ' . $this->migrations_table . '
|
||||
' . $this->db->sql_build_array('INSERT', $migration_row);
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
|
||||
$this->migration_state[$name] = $state;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue