mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
[ticket/17414] Remove install steps for captcha plugins
This should be handled by migrations instead. PHPBB-17414
This commit is contained in:
parent
89bb72c277
commit
8429145241
6 changed files with 54 additions and 37 deletions
|
@ -128,11 +128,9 @@ class acp_captcha
|
||||||
if (isset($captchas['available'][$selected]))
|
if (isset($captchas['available'][$selected]))
|
||||||
{
|
{
|
||||||
$old_captcha = $factory->get_instance($config['captcha_plugin']);
|
$old_captcha = $factory->get_instance($config['captcha_plugin']);
|
||||||
$old_captcha->uninstall();
|
$old_captcha->garbage_collect();
|
||||||
|
|
||||||
$config->set('captcha_plugin', $selected);
|
$config->set('captcha_plugin', $selected);
|
||||||
$new_captcha = $factory->get_instance($config['captcha_plugin']);
|
|
||||||
$new_captcha->install();
|
|
||||||
|
|
||||||
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL');
|
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL');
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,11 +184,6 @@ abstract class captcha_abstract
|
||||||
$this->garbage_collect(0);
|
$this->garbage_collect(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function install()
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
function validate()
|
function validate()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
|
@ -25,8 +25,7 @@ class legacy_wrapper implements plugin_interface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the plugin is available
|
* {@inheritDoc}
|
||||||
* @return bool True if the plugin is available, false if not
|
|
||||||
*/
|
*/
|
||||||
public function is_available(): bool
|
public function is_available(): bool
|
||||||
{
|
{
|
||||||
|
@ -39,9 +38,7 @@ class legacy_wrapper implements plugin_interface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the plugin has a configuration
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return bool True if the plugin has a configuration, false if not
|
|
||||||
*/
|
*/
|
||||||
public function has_config(): bool
|
public function has_config(): bool
|
||||||
{
|
{
|
||||||
|
@ -54,9 +51,7 @@ class legacy_wrapper implements plugin_interface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the plugin, should be language variable
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function get_name(): string
|
public function get_name(): string
|
||||||
{
|
{
|
||||||
|
@ -69,10 +64,7 @@ class legacy_wrapper implements plugin_interface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the captcha for the specified type
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param int $type Type of captcha, should be one of the CONFIRMATION_* constants
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function init(int $type): void
|
public function init(int $type): void
|
||||||
{
|
{
|
||||||
|
@ -139,4 +131,36 @@ class legacy_wrapper implements plugin_interface
|
||||||
// Ensure this is deemed as too many attempts
|
// Ensure this is deemed as too many attempts
|
||||||
return PHP_INT_MAX;
|
return PHP_INT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function get_demo_template(): string
|
||||||
|
{
|
||||||
|
if (method_exists($this->legacy_captcha, 'get_demo_template'))
|
||||||
|
{
|
||||||
|
return $this->legacy_captcha->get_demo_template(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function garbage_collect(int $confirm_type = 0): void
|
||||||
|
{
|
||||||
|
if (method_exists($this->legacy_captcha, 'garbage_collect'))
|
||||||
|
{
|
||||||
|
$this->legacy_captcha->garbage_collect($confirm_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function acp_page($id, $module): void
|
||||||
|
{
|
||||||
|
if (method_exists($this->legacy_captcha, 'acp_page'))
|
||||||
|
{
|
||||||
|
$this->legacy_captcha->acp_page($id, $module);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,4 +80,21 @@ interface plugin_interface
|
||||||
* @return int Number of attempts
|
* @return int Number of attempts
|
||||||
*/
|
*/
|
||||||
public function get_attempt_count(): int;
|
public function get_attempt_count(): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get template data for demo
|
||||||
|
*
|
||||||
|
* @return string Demo template file name
|
||||||
|
*/
|
||||||
|
public function get_demo_template(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Garbage collect captcha plugin
|
||||||
|
*
|
||||||
|
* @param int $confirm_type Confirm type to garbage collect, defaults to all (0)
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function garbage_collect(int $confirm_type = 0): void;
|
||||||
|
|
||||||
|
public function acp_page($id, $module): void;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,13 +331,6 @@ class qa
|
||||||
$this->garbage_collect(0);
|
$this->garbage_collect(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* API function - set up shop
|
|
||||||
*/
|
|
||||||
function install()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API function - see what has to be done to validate
|
* API function - see what has to be done to validate
|
||||||
*/
|
*/
|
||||||
|
@ -597,11 +590,6 @@ class qa
|
||||||
$user->add_lang('acp/board');
|
$user->add_lang('acp/board');
|
||||||
$user->add_lang('captcha_qa');
|
$user->add_lang('captcha_qa');
|
||||||
|
|
||||||
if (!self::is_installed())
|
|
||||||
{
|
|
||||||
$this->install();
|
|
||||||
}
|
|
||||||
|
|
||||||
$module->tpl_name = 'captcha_qa_acp';
|
$module->tpl_name = 'captcha_qa_acp';
|
||||||
$module->page_title = 'ACP_VC_SETTINGS';
|
$module->page_title = 'ACP_VC_SETTINGS';
|
||||||
$form_key = 'acp_captcha';
|
$form_key = 'acp_captcha';
|
||||||
|
|
|
@ -184,11 +184,6 @@ class recaptcha extends captcha_abstract
|
||||||
$this->garbage_collect(0);
|
$this->garbage_collect(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function install()
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
function validate()
|
function validate()
|
||||||
{
|
{
|
||||||
if (!parent::validate())
|
if (!parent::validate())
|
||||||
|
|
Loading…
Add table
Reference in a new issue