mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-23 10:28:55 +00:00
[ticket/12960] Add migration for removing broken captcha
PHPBB3-12960
This commit is contained in:
parent
5d11098753
commit
9d51ca3eb7
1 changed files with 67 additions and 0 deletions
67
phpBB/phpbb/db/migration/data/v400/remove_broken_captcha.php
Normal file
67
phpBB/phpbb/db/migration/data/v400/remove_broken_captcha.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?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\v400;
|
||||
|
||||
use phpbb\db\migration\migration;
|
||||
|
||||
class remove_broken_captcha extends migration
|
||||
{
|
||||
private $removed_captchas = [
|
||||
'core.captcha.plugins.gd',
|
||||
'core.captcha.plugins.gd_wave',
|
||||
'core.captcha.plugins.nogd'
|
||||
];
|
||||
|
||||
public static function depends_on(): array
|
||||
{
|
||||
return [
|
||||
'\phpbb\db\migration\data\v400\dev',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_data(): array
|
||||
{
|
||||
return [
|
||||
['config.remove', ['captcha_gd']],
|
||||
['config.remove', ['captcha_gd_3d_noise']],
|
||||
['config.remove', ['captcha_gd_fonts']],
|
||||
['config.remove', ['captcha_gd_foreground_noise']],
|
||||
['config.remove', ['captcha_gd_wave']],
|
||||
['config.remove', ['captcha_gd_x_grid']],
|
||||
['config.remove', ['captcha_gd_y_grid']],
|
||||
['custom', [[$this, 'replace_broken_captcha']]],
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_data(): array
|
||||
{
|
||||
return [
|
||||
['config.add', ['captcha_gd', 0]],
|
||||
['config.add', ['captcha_gd_3d_noise', 1]],
|
||||
['config.add', ['captcha_gd_fonts', 1]],
|
||||
['config.add', ['captcha_gd_foreground_noise', 1]],
|
||||
['config.add', ['captcha_gd_wave', 0]],
|
||||
['config.add', ['captcha_gd_x_grid', 25]],
|
||||
['config.add', ['captcha_gd_y_grid', 25]],
|
||||
];
|
||||
}
|
||||
|
||||
public function replace_broken_captcha(): void
|
||||
{
|
||||
if (in_array($this->config['captcha_plugin'], $this->removed_captchas))
|
||||
{
|
||||
$this->config->set('captcha_plugin', 'core.captcha.plugins.incomplete');
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue