Code Duplication    Length = 15-15 lines in 3 locations

lib/Module.php 3 locations

@@ 39-53 (lines=15) @@
36
37
		$path = $repository . 'tmp';
38
39
		if (!file_exists($path))
40
		{
41
			$parent = dirname($path);
42
43
			if (is_writable($parent))
44
			{
45
				mkdir($path);
46
47
				file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Deny from all');
48
			}
49
			else
50
			{
51
				$errors->add($this->id, "Unable to create %directory directory, its parent is not writable.", [ '%directory' => $path ]);
52
			}
53
		}
54
55
		#
56
		# $repository/files
@@ 61-75 (lines=15) @@
58
59
		$path = $repository . 'files';
60
61
		if (!file_exists($path))
62
		{
63
			$parent = dirname($path);
64
65
			if (is_writable($parent))
66
			{
67
				mkdir($path);
68
69
				file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Allow from all');
70
			}
71
			else
72
			{
73
				$errors->add($this->id, "Unable to create %directory directory, its parent is not writable", [ '%directory' => $path ]);
74
			}
75
		}
76
77
		#
78
		# $repository/files-index
@@ 83-97 (lines=15) @@
80
81
		$path = $repository . 'files-index';
82
83
		if (!file_exists($path))
84
		{
85
			$parent = dirname($path);
86
87
			if (is_writable($parent))
88
			{
89
				mkdir($path);
90
91
				file_put_contents($path . DIRECTORY_SEPARATOR . '.htaccess', 'Deny from all');
92
			}
93
			else
94
			{
95
				$errors->add($this->id, 'Unable to create %directory directory, its parent is not writable', [ '%directory' => $path ]);
96
			}
97
		}
98
99
		#
100
		# config: max_file_size