File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 "php" : " >=5.6" ,
77 "justinrainbow/json-schema" : " ^5.2" ,
88 "frictionlessdata/tableschema" : " ^0.1.9" ,
9- "alchemy/zippy " : " =0.3.5 "
9+ "chumper/zipper " : " 1.0.x "
1010 },
1111 "require-dev" : {
1212 "phpunit/phpunit" : " ^4.8.35" ,
Original file line number Diff line number Diff line change 77use frictionlessdata \datapackage \Utils ;
88use frictionlessdata \datapackage \Validators \DatapackageValidator ;
99use frictionlessdata \datapackage \Exceptions \DatapackageValidationFailedException ;
10- use Alchemy \ Zippy \ Zippy ;
10+ use Chumper \ Zipper \ Zipper ;
1111
1212abstract class BaseDatapackage implements \Iterator
1313{
@@ -170,7 +170,7 @@ public function valid()
170170
171171 public function save ($ zip_filename )
172172 {
173- $ zippy = Zippy:: load ();
173+ $ zipper = new Zipper ();
174174 $ base = tempnam (sys_get_temp_dir (), 'datapackage-zip- ' );
175175 $ files = [
176176 'datapackage.json ' => $ base .'datapackage.json ' ,
@@ -185,7 +185,8 @@ public function save($zip_filename)
185185 ++$ ri ;
186186 }
187187 $ this ->saveDescriptor ($ files ['datapackage.json ' ]);
188- $ zippy ->create ($ zip_filename , $ files );
188+ /* @noinspection PhpUnhandledExceptionInspection Never occurs with our args */
189+ $ zipper ->make ($ zip_filename )->add ($ files )->close ();
189190 foreach (array_values ($ files ) as $ file ) {
190191 unlink ($ file );
191192 }
Original file line number Diff line number Diff line change 44
55use frictionlessdata \datapackage \Datapackages \BaseDatapackage ;
66use frictionlessdata \datapackage \Resources \BaseResource ;
7- use Alchemy \ Zippy \ Zippy ;
7+ use Chumper \ Zipper \ Zipper ;
88
99/**
1010 * datapackage and resource have different classes depending on the corresponding profile
@@ -349,14 +349,16 @@ protected static function loadHttpZipSource($source)
349349
350350 protected static function loadFileZipSource ($ source )
351351 {
352- $ zippy = Zippy:: load ();
352+ $ zipper = new Zipper ();
353353 $ tempdir = tempnam (sys_get_temp_dir (), 'datapackage-php ' );
354354 unlink ($ tempdir );
355355 mkdir ($ tempdir );
356356 register_shutdown_function (function () use ($ tempdir ) {Utils::removeDir ($ tempdir ); });
357- $ zippy ->open ($ source )->extract ($ tempdir );
357+ /* @noinspection PhpUnhandledExceptionInspection File existence is checked afterwards anyway */
358+ $ zipper ->make ($ source )->extractTo ($ tempdir );
359+ $ zipper ->close ();
358360 if (!file_exists ($ tempdir .'/datapackage.json ' )) {
359- throw new Exceptions \DatapackageInvalidSourceException ('zip file must contain a datappackage .json file ' );
361+ throw new Exceptions \DatapackageInvalidSourceException ('zip file must contain a datapackage .json file ' );
360362 }
361363
362364 return static ::loadSource ($ tempdir .'/datapackage.json ' , $ tempdir );
Original file line number Diff line number Diff line change 22
33namespace frictionlessdata \datapackage \tests ;
44
5- use Alchemy \ Zippy \ Zippy ;
5+ use Chumper \ Zipper \ Zipper ;
66use frictionlessdata \datapackage \Utils ;
77use frictionlessdata \datapackage \Validators \DatapackageValidationError ;
88use PHPUnit \Framework \TestCase ;
@@ -465,14 +465,14 @@ public function testCreateEditDatapackageDescriptor()
465465
466466 $ filename = tempnam (sys_get_temp_dir (), 'datapackage-php-tests- ' ).'.zip ' ;
467467 $ package ->save ($ filename );
468- $ zippy = Zippy:: load ();
468+ $ zipper = new Zipper ();
469469 $ tempdir = sys_get_temp_dir ().DIRECTORY_SEPARATOR .'datapackage-php-tests-zipdir ' ;
470470 if (file_exists ($ tempdir )) {
471471 Utils::removeDir ($ tempdir );
472472 }
473473 mkdir ($ tempdir );
474- $ archive = $ zippy -> open ($ filename );
475- $ archive -> extract ( $ tempdir );
474+ $ zipper -> make ($ filename)-> extractTo ( $ tempdir );
475+ $ zipper -> close ( );
476476 unlink ($ filename );
477477 $ tempdir = $ tempdir .DIRECTORY_SEPARATOR ;
478478 $ this ->assertEquals ($ expectedDatapackageDescriptor , json_decode (file_get_contents ($ tempdir .'datapackage.json ' )));
You can’t perform that action at this time.
0 commit comments