Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions ext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/**
* Extension enablement requirements.
*
* @license GNU General Public License, version 2 (GPL-2.0)
*/

namespace rmcgirr83\topicdescription;

class ext extends \phpbb\extension\base
{
/**
* 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()
{
$enableable = $this->check_phpbb_version() && $this->check_php_version();

if (!$enableable)
{
$language = $this->container->get('language');
$language->add_lang('topicdescription_install', 'rmcgirr83/topicdescription');

return $language->lang('TOPICDESCRIPTION_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;
}
}
20 changes: 20 additions & 0 deletions language/en/topicdescription_install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Extension enablement requirements [English].
*
* @license GNU General Public License, version 2 (GPL-2.0)
*/

if (!defined('IN_PHPBB'))
{
exit;
}

if (empty($lang) || !is_array($lang))
{
$lang = array();
}

$lang = array_merge($lang, array(
'TOPICDESCRIPTION_NOT_ENABLEABLE' => 'Topic Description could not be enabled. It requires phpBB 3.3.19 or later and PHP 8.3.36 or later.',
));
Loading