1 | <?php |
||
22 | class UniqueCommand extends MviCommand |
||
23 | { |
||
24 | const VERSION_DESTINATION = 'version.json'; |
||
25 | |||
26 | const ACCURACY_FACTOR = 500; |
||
27 | |||
28 | const EDITION_SHORT_ENTERPRISE = 'EE'; |
||
29 | const EDITION_SHORT_COMMUNITY = 'CE'; |
||
30 | const EDITION_LONG_ENTERPRISE = 'Enterprise'; |
||
31 | const EDITION_LONG_COMMUNITY = 'Community'; |
||
32 | |||
33 | /** |
||
34 | * Patterns of file that might not be reliable |
||
35 | * |
||
36 | * @var string[] |
||
37 | */ |
||
38 | protected $fileIgnorePatterns = [ |
||
39 | "/\/rwd\//", |
||
40 | "/[^(js|css)]$/", |
||
41 | ]; |
||
42 | |||
43 | /** |
||
44 | * Configure generate command |
||
45 | * |
||
46 | * @return void |
||
47 | */ |
||
48 | protected function configure() |
||
54 | |||
55 | /** |
||
56 | * Run unique command |
||
57 | * |
||
58 | * @param InputInterface $input |
||
59 | * @param OutputInterface $output |
||
60 | * |
||
61 | * @return void |
||
62 | */ |
||
63 | protected function execute(InputInterface $input, OutputInterface $output) |
||
83 | |||
84 | /** |
||
85 | * Collect all the release hash datas |
||
86 | * |
||
87 | * [ |
||
88 | * 'CE-1.0.0' => [ |
||
89 | * 'abc123' => 'foo.js', |
||
90 | * 'edf456' => 'bar.js', |
||
91 | * ], |
||
92 | * 'CE-1.1.0' => [ ... ] |
||
93 | * ] |
||
94 | * |
||
95 | * @return array |
||
96 | */ |
||
97 | protected function collectData() |
||
119 | |||
120 | /** |
||
121 | * Get the most import files determined by how many unique hashes they have |
||
122 | * |
||
123 | * [ |
||
124 | * 'skin/adminhtml/default/default/boxes.css' => [ |
||
125 | * 'abc123' => [ |
||
126 | * 'CE-1.0' |
||
127 | * ], |
||
128 | * 'efg456' => [ |
||
129 | * 'CE-1.1.0', |
||
130 | * 'CE-1.1.1' |
||
131 | * ], |
||
132 | * ... |
||
133 | * ], |
||
134 | * ... |
||
135 | * ] |
||
136 | * |
||
137 | * @param array $data |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | protected function buildFileHashCounts(array $data) |
||
160 | |||
161 | /** |
||
162 | * Take the release short name and expand |
||
163 | * |
||
164 | * @param string $name |
||
165 | * @param array $existing |
||
166 | * |
||
167 | * @return string[] |
||
168 | */ |
||
169 | protected function prepareReleaseName($name, &$existing) |
||
188 | |||
189 | /** |
||
190 | * Add file/hash/release combo to fingerprints if accurate enough |
||
191 | * |
||
192 | * @param array $value |
||
193 | * @param string $file |
||
194 | * @param array $fileHashCounts |
||
195 | * @param string $accuracy |
||
196 | * @param array $fingerprints |
||
197 | * @param string $release |
||
198 | * @param array $data |
||
199 | * @param OutputInterface $output |
||
200 | * |
||
201 | * @return void |
||
202 | */ |
||
203 | protected function identify( |
||
228 | |||
229 | /** |
||
230 | * Save fingerprints to file |
||
231 | * |
||
232 | * @param array $fingerprints |
||
233 | * |
||
234 | * @return integer |
||
235 | */ |
||
236 | protected function saveUniqueVersions($fingerprints) |
||
244 | } |
||
245 |