Completed
Push — develop ( f50c5d...aff9e4 )
by Matt
03:57
created

ext.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 *
4
 * Advanced BBCode Box
5
 *
6
 * @copyright (c) 2015 Matt Friedman
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace vse\abbc3;
12
13
class ext extends \phpbb\extension\base
14
{
15
	const MOVE_UP = 'move_up';
16
	const MOVE_DOWN = 'move_down';
17
	const MOVE_DRAG = 'move_drag';
18
	const PHPBB_MIN_VERSION = '3.2.2'; // Require 3.2.2 due to TextFormatter and BBCode changes
19
20
	/**
21
	 * {@inheritdoc}
22
	 */
23
	public function is_enableable()
24
	{
25
		$config = $this->container->get('config');
26
27
		return phpbb_version_compare($config['version'], self::PHPBB_MIN_VERSION, '>=') &&
28
			phpbb_version_compare(PHPBB_VERSION, self::PHPBB_MIN_VERSION, '>=');
29
	}
30
31
	/**
32
	 * {@inheritdoc}
33
	 */
34
	public function enable_step($old_state)
35
	{
36
		if ($old_state === false)
37
		{
38
			$filesystem = $this->container->get('filesystem');
39
			$root_path = $this->container->getParameter('core.root_path');
40
41
			try // Make an ABBC3 icon dir in phpBB's images dir
42
			{
43
				if (!$filesystem->exists($root_path . 'images/abbc3/icons'))
44
				{
45
					$filesystem->mkdir($root_path . 'images/abbc3/icons');
46
				}
47
			}
48
			catch (\phpbb\filesystem\exception\filesystem_exception $e)
1 ignored issue
show
The class phpbb\filesystem\exception\filesystem_exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
49
			{
50
				$this->container->get('log')->add('critical', '', '', 'LOG_ABBC3_ENABLE_FAIL', false, [$e->get_filename()]);
51
			}
52
53
			return 'abbc3-step';
54
		}
55
56
		return parent::enable_step($old_state);
57
	}
58
}
59