diff --git a/ext.php b/ext.php index 68cebdc..d3cbc4a 100644 --- a/ext.php +++ b/ext.php @@ -20,55 +20,56 @@ class ext extends base protected $max_version = '4.0.0@dev'; /** @var min phpBB version */ - protected $min_version = '3.3.0'; + protected $min_version = '3.3.19'; /** @var PHP version */ - protected $php_version = '7.4.0'; + protected $php_version = '8.3.36'; /** @var phpBB check version */ protected $phpbb_version = '3.3.0'; /** - * Enable extension if requirements are met - * - * @return bool True if can be enabled, False if not, or an error message in phpBB 3.3. - * @access public - */ + * 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|array + * @access public + */ public function is_enableable() { - // Check for PHP version - if (phpbb_version_compare(PHP_VERSION, $this->php_version, '<')) + $enableable = $this->check_phpbb_version() && $this->check_php_version(); + + if (!$enableable) { - if (phpbb_version_compare(PHPBB_VERSION, $this->phpbb_version, '>=')) - { - $language = $this->container->get('language'); - $language->add_lang('ext_enable_error', 'david63/'. $this->ext_name); + $language = $this->container->get('language'); + $language->add_lang('bulkuseradd_install', 'david63/bulkuseradd'); - return $language->lang('EXT_PHP_ERROR', $this->php_version, PHP_VERSION); - } - else - { - return false; - } + return $language->lang('BULKUSERADD_NOT_ENABLEABLE'); } - // Check for phpBB version - if (!(phpbb_version_compare(PHPBB_VERSION, $this->min_version, '>=') && phpbb_version_compare(PHPBB_VERSION, $this->max_version, '<'))) - { - if (phpbb_version_compare(PHPBB_VERSION, $this->phpbb_version, '>=')) - { - $config = $this->container->get('config'); - $language = $this->container->get('language'); - $language->add_lang('ext_enable_error', 'david63/'. $this->ext_name); + return $enableable; + } - return $language->lang('EXT_ENABLE_ERROR', $this->min_version, $this->max_version, $config['version']); - } - else - { - return false; - } - } + /** + * Require phpBB 3.3.19 due to several security fixes in the phpBB software. + * Retain the existing upper limit excluding phpBB 4.0. + * + * @return bool + */ + protected function check_phpbb_version() + { + return phpbb_version_compare(PHPBB_VERSION, '3.3.19', '>=') + && phpbb_version_compare(PHPBB_VERSION, '4.0.0-dev', '<'); + } - return true; + /** + * 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/bulkuseradd_install.php b/language/en/bulkuseradd_install.php new file mode 100644 index 0000000..af1e2b2 --- /dev/null +++ b/language/en/bulkuseradd_install.php @@ -0,0 +1,20 @@ + '[d63] Bulk User Add could not be enabled. It requires phpBB 3.3.19 or a later 3.3 release, and PHP 8.3.36 or later.', +));