@@ -104,6 +104,12 @@ private function downloadModules(string $url)
104
104
if (pathinfo ($ this ->modulesLocation , PATHINFO_EXTENSION ) == 'gz ' ) {
105
105
$ modulesFileExtension = 'gz ' ;
106
106
$ modulesFileTargetName = 'modules-temp.yaml.gz ' ;
107
+ } else if (pathinfo ($ this ->modulesLocation , PATHINFO_EXTENSION ) == 'bz2 ' ) {
108
+ $ modulesFileExtension = 'bz2 ' ;
109
+ $ modulesFileTargetName = 'modules-temp.yaml.bz2 ' ;
110
+ } else if (pathinfo ($ this ->modulesLocation , PATHINFO_EXTENSION ) == 'xz ' ) {
111
+ $ modulesFileExtension = 'xz ' ;
112
+ $ modulesFileTargetName = 'modules-temp.yaml.xz ' ;
107
113
} else if (pathinfo ($ this ->modulesLocation , PATHINFO_EXTENSION ) == 'yaml ' ) {
108
114
$ modulesFileExtension = 'yaml ' ;
109
115
$ modulesFileTargetName = 'modules-temp.yaml ' ;
@@ -148,6 +154,36 @@ private function downloadModules(string $url)
148
154
}
149
155
}
150
156
157
+ if ($ modulesFileExtension == 'bz2 ' ) {
158
+ try {
159
+ \Controllers \Common::bunzip2 ($ this ->workingDir . '/ ' . $ modulesFileTargetName , $ this ->workingDir . '/modules.yaml ' );
160
+ } catch (Exception $ e ) {
161
+ throw new Exception ('Could not uncompress <code> ' . $ modulesFileTargetName . '</code>: ' . $ e ->getMessage ());
162
+ }
163
+
164
+ /**
165
+ * Delete original .bz2 file
166
+ */
167
+ if (!unlink ($ this ->workingDir . '/ ' . $ modulesFileTargetName )) {
168
+ throw new Exception ('Could not delete <code> ' . $ modulesFileTargetName . '</code> file ' );
169
+ }
170
+ }
171
+
172
+ if ($ modulesFileExtension == 'xz ' ) {
173
+ try {
174
+ \Controllers \Common::xzUncompress ($ this ->workingDir . '/ ' . $ modulesFileTargetName , $ this ->workingDir . '/modules.yaml ' );
175
+ } catch (Exception $ e ) {
176
+ throw new Exception ('Could not uncompress <code> ' . $ modulesFileTargetName . '</code>: ' . $ e ->getMessage ());
177
+ }
178
+
179
+ /**
180
+ * Delete original .xz file
181
+ */
182
+ if (!unlink ($ this ->workingDir . '/ ' . $ modulesFileTargetName )) {
183
+ throw new Exception ('Could not delete <code> ' . $ modulesFileTargetName . '</code> file ' );
184
+ }
185
+ }
186
+
151
187
$ this ->logOK ();
152
188
}
153
189
@@ -168,6 +204,12 @@ private function downloadUpdateInfo(string $url)
168
204
if (pathinfo ($ this ->updateInfoLocation , PATHINFO_EXTENSION ) == 'gz ' ) {
169
205
$ updateInfoFileExtension = 'gz ' ;
170
206
$ updateInfoFileTargetName = 'updateinfo.xml.gz ' ;
207
+ } else if (pathinfo ($ this ->updateInfoLocation , PATHINFO_EXTENSION ) == 'bz2 ' ) {
208
+ $ updateInfoFileExtension = 'bz2 ' ;
209
+ $ updateInfoFileTargetName = 'updateinfo.xml.bz2 ' ;
210
+ } else if (pathinfo ($ this ->updateInfoLocation , PATHINFO_EXTENSION ) == 'xz ' ) {
211
+ $ updateInfoFileExtension = 'xz ' ;
212
+ $ updateInfoFileTargetName = 'updateinfo.xml.xz ' ;
171
213
} else if (pathinfo ($ this ->updateInfoLocation , PATHINFO_EXTENSION ) == 'xml ' ) {
172
214
$ updateInfoFileExtension = 'xml ' ;
173
215
$ updateInfoFileTargetName = 'updateinfo.xml ' ;
@@ -209,6 +251,36 @@ private function downloadUpdateInfo(string $url)
209
251
}
210
252
}
211
253
254
+ if ($ updateInfoFileExtension == 'bz2 ' ) {
255
+ try {
256
+ \Controllers \Common::bunzip2 ($ this ->workingDir . '/ ' . $ updateInfoFileTargetName , $ this ->workingDir . '/updateinfo.xml ' );
257
+ } catch (Exception $ e ) {
258
+ throw new Exception ('Could not uncompress <code> ' . $ updateInfoFileTargetName . '</code>: ' . $ e ->getMessage ());
259
+ }
260
+
261
+ /**
262
+ * Delete original .bz2 file
263
+ */
264
+ if (!unlink ($ this ->workingDir . '/ ' . $ updateInfoFileTargetName )) {
265
+ throw new Exception ('Could not delete <code> ' . $ updateInfoFileTargetName . '</code> file ' );
266
+ }
267
+ }
268
+
269
+ if ($ updateInfoFileExtension == 'xz ' ) {
270
+ try {
271
+ \Controllers \Common::xzUncompress ($ this ->workingDir . '/ ' . $ updateInfoFileTargetName , $ this ->workingDir . '/updateinfo.xml ' );
272
+ } catch (Exception $ e ) {
273
+ throw new Exception ('Could not uncompress <code> ' . $ updateInfoFileTargetName . '</code>: ' . $ e ->getMessage ());
274
+ }
275
+
276
+ /**
277
+ * Delete original .xz file
278
+ */
279
+ if (!unlink ($ this ->workingDir . '/ ' . $ updateInfoFileTargetName )) {
280
+ throw new Exception ('Could not delete <code> ' . $ updateInfoFileTargetName . '</code> file ' );
281
+ }
282
+ }
283
+
212
284
$ this ->logOK ();
213
285
}
214
286
0 commit comments