From 487c85b8c875d16fd49344e82a80b06842855d00 Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Thu, 22 Oct 2026 11:58:24 -0500 Subject: [PATCH] Require phpBB 3.3.19 and PHP 8.3.36 for extension enablement --- ext.php | 36 +++++++++++++++++++++++----- language/en/autodbbackup_install.php | 20 ++++++++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 language/en/autodbbackup_install.php diff --git a/ext.php b/ext.php index 0b4c572..91f53ef 100644 --- a/ext.php +++ b/ext.php @@ -15,21 +15,45 @@ class ext extends \phpbb\extension\base { /** - * Enable extension if phpBB and PHP version requirement is met + * Check whether the extension can be enabled. + * The current phpBB and PHP version should meet or + * exceed the minimum version required by this extension: * - * @return bool + * @return bool|array * @access public */ public function is_enableable() { - $enableable = (phpbb_version_compare(PHPBB_VERSION, '3.3', '>=') && version_compare(PHP_VERSION, '7.4.*', '>')); + $enableable = $this->check_phpbb_version() && $this->check_php_version(); + if (!$enableable) { - $user = $this->container->get('user'); - $user->add_lang_ext('pico/autodbbackup', 'auto_db_backup_acp'); - trigger_error($user->lang('AUTODBBACKUP_REQUIRE'), E_USER_WARNING); + $language = $this->container->get('language'); + $language->add_lang('autodbbackup_install', 'pico/autodbbackup'); + + return $language->lang('AUTODBBACKUP_NOT_ENABLEABLE'); } return $enableable; } + + /** + * Require phpBB 3.3.19 due to several security fixes in the phpBB software. + * + * @return bool + */ + protected function check_phpbb_version() + { + return phpbb_version_compare(PHPBB_VERSION, '3.3.19', '>='); + } + + /** + * Requires PHP 8.3.36 due to security fixes. + * + * @return bool + */ + protected function check_php_version() + { + return PHP_VERSION_ID >= 80336; + } } diff --git a/language/en/autodbbackup_install.php b/language/en/autodbbackup_install.php new file mode 100644 index 0000000..c3e4ef8 --- /dev/null +++ b/language/en/autodbbackup_install.php @@ -0,0 +1,20 @@ + 'Auto Database Backup could not be enabled. It requires phpBB 3.3.19 or later and PHP 8.3.36 or later.', +));