From 4cc35a28390d201633c4a55a37314b7b64ccd78d Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Mon, 5 Oct 2026 09:20:38 -0500 Subject: [PATCH] Require phpBB 3.3.19 Refuse to enable on phpBB older than 3.3.19 or below the extension's minimum PHP version, showing a clear reason instead of a generic error. phpBB 3.3.17 through 3.3.19 fixed a series of security issues, so older boards should update phpBB first. Co-Authored-By: Claude Opus 5.5 --- ext.php | 32 ++++++++++++++++- language/en/install_editedpostsunread.php | 43 +++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 language/en/install_editedpostsunread.php diff --git a/ext.php b/ext.php index ad68734..d68f1cc 100644 --- a/ext.php +++ b/ext.php @@ -33,13 +33,23 @@ class ext extends \phpbb\extension\base const NEW_NAMESPACE = '\\phpbbmodders\\editedpostsunread\\'; /** + * Refuse to enable below the minimum phpBB and PHP versions. + * * Refuse to enable while the old copy is still enabled; both would run * at once and the old one's data can't be moved while it's in use. * - * @return bool|array True if enableable, otherwise an array of reasons + * @return bool|string|array True if enableable, otherwise a reason string or array of reasons */ public function is_enableable() { + if (!$this->check_phpbb_version() || !$this->check_php_version()) + { + $language = $this->container->get('language'); + $language->add_lang('install_editedpostsunread', 'phpbbmodders/editedpostsunread'); + + return $language->lang('EDITEDPOSTSUNREAD_NOT_ENABLEABLE'); + } + if ($this->container->get('ext.manager')->is_enabled(self::OLD_EXT_NAME)) { return ['Disable the old "' . self::OLD_EXT_NAME . '" extension first (keep its data, do not delete it).']; @@ -48,6 +58,26 @@ public function is_enableable() return true; } + /** + * Require phpBB 3.3.19 + * + * @return bool + */ + public function check_phpbb_version() + { + return phpbb_version_compare(PHPBB_VERSION, '3.3.19', '>='); + } + + /** + * Require PHP 7.4 + * + * @return bool + */ + public function check_php_version() + { + return PHP_VERSION_ID >= 70400; + } + /** * Move an old install's data to the new name, then enable as usual. * diff --git a/language/en/install_editedpostsunread.php b/language/en/install_editedpostsunread.php new file mode 100644 index 0000000..b614da1 --- /dev/null +++ b/language/en/install_editedpostsunread.php @@ -0,0 +1,43 @@ + 'Mark Edited Posts Unread could not be enabled. The minimum requirements of phpBB 3.3.19 and/or PHP 7.4.0 were not satisfied.', +]);