Issues (104)

Labels
Severity
1
<?php
2
/**
3
 *
4
 * Precise Similar Topics
5
 *
6
 * @copyright (c) 2018 Matt Friedman
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace vse\similartopics;
12
13
class ext extends \phpbb\extension\base
0 ignored issues
show
The type phpbb\extension\base was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
{
15
	/**
16
	 * Extension requires Mysql or Postgres DBMS and phpBB 3.2.1 or newer.
17
	 *
18
	 * @return array|bool If phpBB 3.3.x, return message as to why it could not be installed.
19
	 *                    Otherwise, just return boolean true/false.
20
	 */
21
	public function is_enableable()
22
	{
23
		$db = $this->container->get('dbal.conn');
24
		$valid_db = in_array($db->get_sql_layer(), array('mysqli', 'mysql4', 'postgres'));
25
		$valid_phpBB = phpbb_version_compare(PHPBB_VERSION, '3.2.1', '>=') && phpbb_version_compare(PHPBB_VERSION, '4.0.0-dev', '<');
0 ignored issues
show
The constant vse\similartopics\PHPBB_VERSION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The function phpbb_version_compare was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
		$valid_phpBB = /** @scrutinizer ignore-call */ phpbb_version_compare(PHPBB_VERSION, '3.2.1', '>=') && phpbb_version_compare(PHPBB_VERSION, '4.0.0-dev', '<');
Loading history...
26
		$enableable = $valid_db && $valid_phpBB;
27
28
		// Since showing error messages only works for phpBB 3.3.x, the only message worth showing is
29
		// if the DBMS is incompatible. That is, we can't show somebody on phpBB 3.2.x. the message that
30
		// their board is too old, so there's no reason to handle invalid phpBB version messages here.
31
		if (!$enableable && phpbb_version_compare(PHPBB_VERSION, '3.3.0-b1', '>='))
32
		{
33
			$lang = $this->container->get('language');
34
			$lang->add_lang('acp_similar_topics', 'vse/similartopics');
35
			return array($lang->lang('PST_NO_COMPAT'));
36
		}
37
38
		return $enableable;
39
	}
40
}
41