diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index ff9f515d32..69e13463ab 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -128,11 +128,9 @@ class acp_captcha if (isset($captchas['available'][$selected])) { $old_captcha = $factory->get_instance($config['captcha_plugin']); - $old_captcha->uninstall(); + $old_captcha->garbage_collect(); $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'); } diff --git a/phpBB/phpbb/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php index 012e28c987..fb8ccc5a70 100644 --- a/phpBB/phpbb/captcha/plugins/captcha_abstract.php +++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php @@ -184,11 +184,6 @@ abstract class captcha_abstract $this->garbage_collect(0); } - function install() - { - return; - } - function validate() { global $user; diff --git a/phpBB/phpbb/captcha/plugins/legacy_wrapper.php b/phpBB/phpbb/captcha/plugins/legacy_wrapper.php index bceb771800..e57abbb967 100644 --- a/phpBB/phpbb/captcha/plugins/legacy_wrapper.php +++ b/phpBB/phpbb/captcha/plugins/legacy_wrapper.php @@ -25,8 +25,7 @@ class legacy_wrapper implements plugin_interface } /** - * Check if the plugin is available - * @return bool True if the plugin is available, false if not + * {@inheritDoc} */ public function is_available(): bool { @@ -39,9 +38,7 @@ class legacy_wrapper implements plugin_interface } /** - * Check if the plugin has a configuration - * - * @return bool True if the plugin has a configuration, false if not + * {@inheritDoc} */ 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 - * - * @return string + * {@inheritDoc} */ public function get_name(): string { @@ -69,10 +64,7 @@ class legacy_wrapper implements plugin_interface } /** - * Display the captcha for the specified type - * - * @param int $type Type of captcha, should be one of the CONFIRMATION_* constants - * @return void + * {@inheritDoc} */ public function init(int $type): void { @@ -139,4 +131,36 @@ class legacy_wrapper implements plugin_interface // Ensure this is deemed as too many attempts 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); + } + } } diff --git a/phpBB/phpbb/captcha/plugins/plugin_interface.php b/phpBB/phpbb/captcha/plugins/plugin_interface.php index 9d0b0cb4de..41e825fad3 100644 --- a/phpBB/phpbb/captcha/plugins/plugin_interface.php +++ b/phpBB/phpbb/captcha/plugins/plugin_interface.php @@ -80,4 +80,21 @@ interface plugin_interface * @return int Number of attempts */ 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; } diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 106cedb7c2..ffc67a7706 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -331,13 +331,6 @@ class qa $this->garbage_collect(0); } - /** - * API function - set up shop - */ - function install() - { - } - /** * API function - see what has to be done to validate */ @@ -597,11 +590,6 @@ class qa $user->add_lang('acp/board'); $user->add_lang('captcha_qa'); - if (!self::is_installed()) - { - $this->install(); - } - $module->tpl_name = 'captcha_qa_acp'; $module->page_title = 'ACP_VC_SETTINGS'; $form_key = 'acp_captcha'; diff --git a/phpBB/phpbb/captcha/plugins/recaptcha.php b/phpBB/phpbb/captcha/plugins/recaptcha.php index ef30baaa9b..a5dcf4efc6 100644 --- a/phpBB/phpbb/captcha/plugins/recaptcha.php +++ b/phpBB/phpbb/captcha/plugins/recaptcha.php @@ -184,11 +184,6 @@ class recaptcha extends captcha_abstract $this->garbage_collect(0); } - function install() - { - return; - } - function validate() { if (!parent::validate())