1 | <?php |
||
23 | class GenerateCommand extends MviCommand |
||
24 | { |
||
25 | const DIR_RELEASE = 'release'; |
||
26 | |||
27 | /** |
||
28 | * Folders that have files whos has is of use |
||
29 | * |
||
30 | * @var string[] |
||
31 | */ |
||
32 | protected $hashFolders = [ |
||
33 | 'js', |
||
34 | 'media', |
||
35 | 'pub/static', |
||
36 | 'skin', |
||
37 | 'static' |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * Patterns of file that are of no use here |
||
42 | * |
||
43 | * @var string[] |
||
44 | */ |
||
45 | protected $fileIgnorePatterns = [ |
||
46 | "/\.(htaccess|php)$/", |
||
47 | ]; |
||
48 | |||
49 | /** |
||
50 | * Configure generate command |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | protected function configure() |
||
60 | |||
61 | /** |
||
62 | * Run generate command |
||
63 | * |
||
64 | * @param InputInterface $input |
||
65 | * @param OutputInterface $output |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | protected function execute(InputInterface $input, OutputInterface $output) |
||
93 | |||
94 | /** |
||
95 | * Get list of release folders |
||
96 | * |
||
97 | * @return string[] |
||
98 | */ |
||
99 | protected function getReleases() |
||
108 | |||
109 | /** |
||
110 | * Generate the the list of hashes for this release |
||
111 | * |
||
112 | * @param string $release |
||
113 | * |
||
114 | * @return integer|boolean |
||
115 | */ |
||
116 | protected function generate($release) |
||
135 | |||
136 | /** |
||
137 | * Gets all files in a specified folder of a release |
||
138 | * |
||
139 | * @param string $release |
||
140 | * @param string $folder |
||
141 | * |
||
142 | * @return string[] |
||
143 | */ |
||
144 | protected function getFiles($release, $folder) |
||
160 | |||
161 | /** |
||
162 | * Gets the md5 has of a file in the release |
||
163 | * |
||
164 | * @param string $release |
||
165 | * @param string $file |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | protected function getHash($release, $file) |
||
174 | } |
||
175 |