phpBB

Code Changes

File: phpbb/db/migrator.php

  Unmodified   Added   Modified   Removed
Line 198Line 198
		$this->container->get('dispatcher')->disable();
$this->update_do();
$this->container->get('dispatcher')->enable();

		$this->container->get('dispatcher')->disable();
$this->update_do();
$this->container->get('dispatcher')->enable();

 
	}

/**
* 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
*/
protected function get_valid_name($name)
{
// Try falling back to a valid migration name with or without leading backslash
if (!isset($this->migration_state[$name]))
{
$prepended_name = ($name[0] == '\\' ? '' : '\\') . $name;
$prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name;

if (isset($this->migration_state[$prepended_name]))
{
$name = $prepended_name;
}
else if (isset($this->migration_state[$prefixless_name]))
{
$name = $prefixless_name;
}
}

return $name;

	}

/**

	}

/**

Line 209Line 237
	{
foreach ($this->migrations as $name)
{

	{
foreach ($this->migrations as $name)
{

 
			$name = $this->get_valid_name($name);


			if (!isset($this->migration_state[$name]) ||
!$this->migration_state[$name]['migration_schema_done'] ||
!$this->migration_state[$name]['migration_data_done'])

			if (!isset($this->migration_state[$name]) ||
!$this->migration_state[$name]['migration_schema_done'] ||
!$this->migration_state[$name]['migration_data_done'])

Line 264Line 294

foreach ($state['migration_depends_on'] as $depend)
{


foreach ($state['migration_depends_on'] as $depend)
{

 
			$depend = $this->get_valid_name($depend);

// Test all possible namings before throwing exception

			if ($this->unfulfillable($depend) !== false)
{
throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $depend);

			if ($this->unfulfillable($depend) !== false)
{
throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $depend);

Line 742Line 775
	*/
public function unfulfillable($name)
{

	*/
public function unfulfillable($name)
{

 
		$name = $this->get_valid_name($name);


		if (isset($this->migration_state[$name]) || isset($this->fulfillable_migrations[$name]))
{
return false;

		if (isset($this->migration_state[$name]) || isset($this->fulfillable_migrations[$name]))
{
return false;

Line 757Line 792

foreach ($depends as $depend)
{


foreach ($depends as $depend)
{

 
			$depend = $this->get_valid_name($depend);

			$unfulfillable = $this->unfulfillable($depend);
if ($unfulfillable !== false)
{

			$unfulfillable = $this->unfulfillable($depend);
if ($unfulfillable !== false)
{