1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace ICanBoogie\Modules\Thumbnailer;
13
14 use ICanBoogie\Errors;
15
16 17 18
19 class Module extends \ICanBoogie\Module
20 {
21 22 23
24 protected function get_repository()
25 {
26 return \ICanBoogie\REPOSITORY . 'thumbnailer' . DIRECTORY_SEPARATOR;
27 }
28
29 30 31
32 public function install(Errors $errors)
33 {
34 $path = \ICanBoogie\REPOSITORY . 'thumbnailer' . DIRECTORY_SEPARATOR;
35
36 if (!file_exists($path))
37 {
38 $parent = dirname($path);
39
40 if (is_writable($parent))
41 {
42 mkdir($path, 0705, true);
43 }
44 else
45 {
46 $errors[$this->id] = $errors->format('Unable to create %directory directory, its parent is not writable', array('%directory' => \ICanBoogie\strip_root($path)));
47 }
48 }
49
50 return !count($errors);
51 }
52
53 54 55
56 public function is_installed(Errors $errors)
57 {
58 $path = \ICanBoogie\REPOSITORY . 'thumbnailer';
59
60 if (!file_exists($path))
61 {
62 $errors[$this->id] = $errors->format('The %directory directory is missing.', array('%directory' => \ICanBoogie\strip_root($path)));
63 }
64
65 return !count($errors);
66 }
67 }