1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-14 04:42:04 +02:00

[ticket/16510] Make sure config entry exists before updating it

PHPBB3-16510
This commit is contained in:
kasimi 2020-06-03 12:44:28 +02:00
parent 65d825b62c
commit 0ac066aac7
No known key found for this signature in database
GPG Key ID: 3163AB573241193A
2 changed files with 45 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class font_awesome_update_cdn extends \phpbb\db\migration\migration
static public function depends_on()
{
return [
'\phpbb\db\migration\data\v32x\v329',
'\phpbb\db\migration\data\v32x\add_missing_config',
];
}

View File

@ -0,0 +1,44 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\migration\data\v32x;
class font_awesome_update_cdn_fix_depends_on extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return [
'\phpbb\db\migration\data\v32x\font_awesome_update_cdn',
'\phpbb\db\migration\data\v32x\add_missing_config',
];
}
public function update_data()
{
return [
['custom', [[$this, 'fix_depends_on']]],
];
}
public function fix_depends_on()
{
$migration_class = '\phpbb\db\migration\data\v32x\font_awesome_update_cdn';
$migration_depends_on = $migration_class::depends_on();
$sql = 'UPDATE ' . $this->table_prefix . "migrations
SET migration_depends_on = '" . $this->db->sql_escape(serialize($migration_depends_on)) . "'
WHERE migration_name = ' . $migration_class . '";
$this->db->sql_query($sql);
}
}