Skip to content
Snippets Groups Projects
Commit c5c34d56 authored by Adam G-H's avatar Adam G-H Committed by Adam G-H
Browse files

Issue #3323446 by phenaproxima, bschwetzel: Change update 9001 so that it...

Issue #3323446 by phenaproxima, bschwetzel: Change update 9001 so that it downloads tar files instead
parent 0309c92c
Branches
Tags
No related merge requests found
Showing
with 22 additions and 20 deletions
......@@ -5,7 +5,7 @@
* Contains installation and update functions for Lightning Media Bulk Upload.
*/
use Drupal\Core\Archiver\Zip;
use Drupal\Core\Archiver\Tar;
use GuzzleHttp\RequestOptions;
/**
......@@ -27,7 +27,7 @@ function lightning_media_bulk_upload_update_9001(array &$sandbox) {
}
// Allow the destination directory to be overridden in tests.
$destination = $sandbox[__FUNCTION__] ?? Drupal::root() . '/libraries/dropzone';
$destination = $sandbox[__FUNCTION__] ?? Drupal::root() . '/libraries';
// Ensure the destination exists and is writable, or abort the update.
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
......@@ -45,14 +45,16 @@ function lightning_media_bulk_upload_update_9001(array &$sandbox) {
}
Drupal::httpClient()
->request('GET', 'https://github.com/dropzone/dropzone/releases/download/v5.9.3/dist.zip', [
->request('GET', 'https://github.com/dropzone/dropzone-packagist/archive/refs/tags/v5.7.3.tar.gz', [
RequestOptions::SINK => $file,
]);
$archiver = new Zip($file);
$archiver = new Tar($file);
$archiver->extract($destination);
rename("$destination/dropzone-packagist-5.7.3", "$destination/dropzone");
$file_system->delete($file);
$destination .= '/dropzone';
return t('The Dropzone JavaScript library was installed in %destination. Remember to add it to your version control system.', [
'%destination' => $destination,
]);
......
File added
File deleted
......@@ -38,11 +38,11 @@ class Update9001Test extends KernelTestBase {
// Mock the HTTP client so it returns our fake zip file when downloading
// Dropzone.
$zip = fopen(__DIR__ . '/../../fixtures/dropzone.zip', 'rb');
$this->assertIsResource($zip);
$tar = fopen(__DIR__ . '/../../fixtures/dropzone.tar.gz', 'rb');
$this->assertIsResource($tar);
$handler = new MockHandler([
new Response(200, ['Content-Type' => 'application/zip'], $zip),
new Response(200, ['Content-Type' => 'application/tar+gzip'], $tar),
]);
$client = new Client([
'handler' => HandlerStack::create($handler),
......@@ -50,7 +50,7 @@ class Update9001Test extends KernelTestBase {
$this->container->set('http_client', $client);
$sandbox = [
'lightning_media_bulk_upload_update_9001' => 'public://libraries/dropzone',
'lightning_media_bulk_upload_update_9001' => 'public://libraries',
];
$this->container->get('module_handler')
->loadInclude('lightning_media_bulk_upload', 'install');
......
......@@ -5,7 +5,7 @@
* Contains install and update functions for Lightning Media Image.
*/
use Drupal\Core\Archiver\Zip;
use Drupal\Core\Archiver\Tar;
use GuzzleHttp\RequestOptions;
/**
......@@ -102,11 +102,11 @@ function lightning_media_image_update_9001(array &$sandbox) {
}
Drupal::httpClient()
->request('GET', 'https://github.com/fengyuanchen/cropper/archive/refs/tags/v2.3.4.zip', [
->request('GET', 'https://github.com/fengyuanchen/cropper/archive/refs/tags/v2.3.4.tar.gz', [
RequestOptions::SINK => $file,
]);
$archiver = new Zip($file);
$archiver = new Tar($file);
$archiver->extract($destination);
rename("$destination/cropper-2.3.4", "$destination/cropper");
$file_system->delete($file);
......
File added
File deleted
......@@ -38,11 +38,11 @@ class Update9001Test extends KernelTestBase {
// Mock the HTTP client so it returns our fake zip file when downloading
// Dropzone.
$zip = fopen(__DIR__ . '/../../fixtures/cropper.zip', 'rb');
$this->assertIsResource($zip);
$tar = fopen(__DIR__ . '/../../fixtures/cropper.tar.gz', 'rb');
$this->assertIsResource($tar);
$handler = new MockHandler([
new Response(200, ['Content-Type' => 'application/zip'], $zip),
new Response(200, ['Content-Type' => 'application/tar+gzip'], $tar),
]);
$client = new Client([
'handler' => HandlerStack::create($handler),
......
<?php
use Drupal\Core\Archiver\Zip;
use Drupal\Core\Archiver\Tar;
use GuzzleHttp\RequestOptions;
/**
......@@ -32,11 +32,11 @@ function lightning_media_slideshow_update_9001(array &$sandbox) {
}
Drupal::httpClient()
->request('GET', 'https://github.com/kenwheeler/slick/archive/refs/tags/1.8.0.zip', [
->request('GET', 'https://github.com/kenwheeler/slick/archive/refs/tags/1.8.0.tar.gz', [
RequestOptions::SINK => $file,
]);
$archiver = new Zip($file);
$archiver = new Tar($file);
$archiver->extract($destination);
rename("$destination/slick-1.8.0", "$destination/slick-carousel");
$file_system->delete($file);
......
File added
File deleted
......@@ -43,11 +43,11 @@ class Update9001Test extends KernelTestBase {
// Mock the HTTP client so it returns our fake zip file when downloading
// Dropzone.
$zip = fopen(__DIR__ . '/../../fixtures/slick.zip', 'rb');
$this->assertIsResource($zip);
$tar = fopen(__DIR__ . '/../../fixtures/slick.tar.gz', 'rb');
$this->assertIsResource($tar);
$handler = new MockHandler([
new Response(200, ['Content-Type' => 'application/zip'], $zip),
new Response(200, ['Content-Type' => 'application/tar+gzip'], $tar),
]);
$client = new Client([
'handler' => HandlerStack::create($handler),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment