Completed
Branch release-3.2.0 (10f575)
by Daniel
03:11
created

m310_filemanager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 39
rs 10
wmc 3
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2017 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\sitemaker\migrations\v31x;
11
12
/**
13
 * Initial schema changes needed for Extension installation
14
 */
15
class m310_filemanager extends \phpbb\db\migration\container_aware_migration
16
{
17
	/**
18
	 * @inheritdoc
19
	 */
20
	public static function depends_on()
21
	{
22
		return array(
23
			'\phpbb\db\migration\data\v32x\v321',
24
			'\blitze\sitemaker\migrations\v30x\m17_add_settings_module',
25
		);
26
	}
27
28
	/**
29
	 * @inheritdoc
30
	 */
31
	public function update_data()
32
	{
33
		return array(
34
			array('config.add', array('sm_navbar_menu', 0)),
35
			array('config.add', array('sm_filemanager', false)),
36
37
			array('permission.add', array('u_sm_filemanager', true, 'u_attach')),
38
			array('permission.add', array('a_sm_filemanager', true, 'a_board')),
39
40
			array('custom', array(array($this, 'create_upload_dir'))),
41
		);
42
	}
43
44
	/**
45
	 * @return void
46
	 */
47
	public function create_upload_dir()
48
	{
49
		$fs = $this->container->get('filesystem');
50
51
		// create upload folders if they don't exist
52
		$fs->mkdir($this->phpbb_root_path . 'images/sitemaker_uploads/source', 0755);
53
		$fs->mkdir($this->phpbb_root_path . 'images/sitemaker_uploads/thumbs', 0755);
54
	}
55
}
56