Skip to content

Commit 719e408

Browse files
authored
Handle new report boolean in filesystems config (#122)
* Migrate with new `’report’ => false` default. * Update assertion strings. * Update normalization methods. * Up ‘until’. * Fix whitespace.
1 parent 0854880 commit 719e408

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

src/AssetContainerMigrator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ protected function localDiskConfig()
326326
'url' => "/{$path}",
327327
'visibility' => 'public',
328328
'throw' => false,
329+
'report' => false,
329330
];
330331
}
331332

@@ -348,6 +349,7 @@ protected function s3DiskConfig()
348349
'endpoint' => "env('{$envPrefix}_AWS_ENDPOINT')",
349350
'use_path_style_endpoint' => "env('{$envPrefix}_AWS_USE_PATH_STYLE_ENDPOINT', false)",
350351
'throw' => false,
352+
'report' => false,
351353
];
352354
}
353355

tests/MigrateAssetContainerTest.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ public function it_migrates_disk_with_local_driver()
301301
'driver' => 'local',
302302
'root' => storage_path('app'),
303303
'throw' => false,
304+
'report' => false,
304305
],
305306
306307
'public' => [
@@ -309,6 +310,7 @@ public function it_migrates_disk_with_local_driver()
309310
'url' => env('APP_URL').'/storage',
310311
'visibility' => 'public',
311312
'throw' => false,
313+
'report' => false,
312314
],
313315
314316
's3' => [
@@ -321,6 +323,7 @@ public function it_migrates_disk_with_local_driver()
321323
'endpoint' => env('AWS_ENDPOINT'),
322324
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
323325
'throw' => false,
326+
'report' => false,
324327
],
325328
326329
'assets' => [
@@ -329,6 +332,7 @@ public function it_migrates_disk_with_local_driver()
329332
'url' => '/assets',
330333
'visibility' => 'public',
331334
'throw' => false,
335+
'report' => false,
332336
],
333337
334338
],
@@ -367,6 +371,7 @@ public function it_migrates_disk_with_s3_driver()
367371
'driver' => 'local',
368372
'root' => storage_path('app'),
369373
'throw' => false,
374+
'report' => false,
370375
],
371376
372377
'public' => [
@@ -375,6 +380,7 @@ public function it_migrates_disk_with_s3_driver()
375380
'url' => env('APP_URL').'/storage',
376381
'visibility' => 'public',
377382
'throw' => false,
383+
'report' => false,
378384
],
379385
380386
's3' => [
@@ -387,6 +393,7 @@ public function it_migrates_disk_with_s3_driver()
387393
'endpoint' => env('AWS_ENDPOINT'),
388394
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
389395
'throw' => false,
396+
'report' => false,
390397
],
391398
392399
'assets' => [
@@ -399,6 +406,7 @@ public function it_migrates_disk_with_s3_driver()
399406
'endpoint' => env('ASSETS_AWS_ENDPOINT'),
400407
'use_path_style_endpoint' => env('ASSETS_AWS_USE_PATH_STYLE_ENDPOINT', false),
401408
'throw' => false,
409+
'report' => false,
402410
],
403411
404412
],
@@ -419,6 +427,7 @@ public function it_migrates_disk_with_terser_key_when_assets_already_exists()
419427
'driver' => 'local',
420428
'root' => "storage_path('app/some-other-user-assets-unrelated-to-statamic')",
421429
'throw' => false,
430+
'report' => false,
422431
],
423432
]);
424433

@@ -431,6 +440,7 @@ public function it_migrates_disk_with_terser_key_when_assets_already_exists()
431440
'driver' => 'local',
432441
'root' => storage_path('app'),
433442
'throw' => false,
443+
'report' => false,
434444
],
435445
436446
'public' => [
@@ -439,6 +449,7 @@ public function it_migrates_disk_with_terser_key_when_assets_already_exists()
439449
'url' => env('APP_URL').'/storage',
440450
'visibility' => 'public',
441451
'throw' => false,
452+
'report' => false,
442453
],
443454
444455
's3' => [
@@ -451,12 +462,14 @@ public function it_migrates_disk_with_terser_key_when_assets_already_exists()
451462
'endpoint' => env('AWS_ENDPOINT'),
452463
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
453464
'throw' => false,
465+
'report' => false,
454466
],
455467
456468
'assets' => [
457469
'driver' => 'local',
458470
'root' => storage_path('app/some-other-user-assets-unrelated-to-statamic'),
459471
'throw' => false,
472+
'report' => false,
460473
],
461474
462475
'assets_main' => [
@@ -465,6 +478,7 @@ public function it_migrates_disk_with_terser_key_when_assets_already_exists()
465478
'url' => '/assets/main',
466479
'visibility' => 'public',
467480
'throw' => false,
481+
'report' => false,
468482
],
469483
470484
],
@@ -501,6 +515,7 @@ public function it_migrates_multiple_disks_with_terser_keys_only()
501515
'driver' => 'local',
502516
'root' => storage_path('app'),
503517
'throw' => false,
518+
'report' => false,
504519
],
505520
506521
'public' => [
@@ -509,6 +524,7 @@ public function it_migrates_multiple_disks_with_terser_keys_only()
509524
'url' => env('APP_URL').'/storage',
510525
'visibility' => 'public',
511526
'throw' => false,
527+
'report' => false,
512528
],
513529
514530
's3' => [
@@ -521,6 +537,7 @@ public function it_migrates_multiple_disks_with_terser_keys_only()
521537
'endpoint' => env('AWS_ENDPOINT'),
522538
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
523539
'throw' => false,
540+
'report' => false,
524541
],
525542
526543
'assets_main' => [
@@ -529,6 +546,7 @@ public function it_migrates_multiple_disks_with_terser_keys_only()
529546
'url' => '/assets/main',
530547
'visibility' => 'public',
531548
'throw' => false,
549+
'report' => false,
532550
],
533551
534552
'assets_cloud' => [
@@ -541,6 +559,7 @@ public function it_migrates_multiple_disks_with_terser_keys_only()
541559
'endpoint' => env('ASSETS_CLOUD_AWS_ENDPOINT'),
542560
'use_path_style_endpoint' => env('ASSETS_CLOUD_AWS_USE_PATH_STYLE_ENDPOINT', false),
543561
'throw' => false,
562+
'report' => false,
544563
],
545564
546565
],
@@ -576,13 +595,15 @@ public function it_overwrites_disks_when_forced()
576595
'url' => '/assets/main/edited-route',
577596
'visibility' => 'public',
578597
'throw' => false,
598+
'report' => false,
579599
],
580600
'assets_cloud' => [
581601
'driver' => 'local',
582602
'root' => public_path('assets/cloud'),
583603
'url' => '/assets/cloud/edited-route',
584604
'visibility' => 'public',
585605
'throw' => false,
606+
'report' => false,
586607
],
587608
])
588609
->refresh();
@@ -600,6 +621,7 @@ public function it_overwrites_disks_when_forced()
600621
'driver' => 'local',
601622
'root' => storage_path('app'),
602623
'throw' => false,
624+
'report' => false,
603625
],
604626
605627
'public' => [
@@ -608,6 +630,7 @@ public function it_overwrites_disks_when_forced()
608630
'url' => env('APP_URL').'/storage',
609631
'visibility' => 'public',
610632
'throw' => false,
633+
'report' => false,
611634
],
612635
613636
's3' => [
@@ -620,6 +643,7 @@ public function it_overwrites_disks_when_forced()
620643
'endpoint' => env('AWS_ENDPOINT'),
621644
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
622645
'throw' => false,
646+
'report' => false,
623647
],
624648
625649
'assets_main' => [
@@ -628,6 +652,7 @@ public function it_overwrites_disks_when_forced()
628652
'url' => '/assets/main',
629653
'visibility' => 'public',
630654
'throw' => false,
655+
'report' => false,
631656
],
632657
633658
'assets_cloud' => [
@@ -640,6 +665,7 @@ public function it_overwrites_disks_when_forced()
640665
'endpoint' => env('ASSETS_CLOUD_AWS_ENDPOINT'),
641666
'use_path_style_endpoint' => env('ASSETS_CLOUD_AWS_USE_PATH_STYLE_ENDPOINT', false),
642667
'throw' => false,
668+
'report' => false,
643669
],
644670
645671
],
@@ -762,12 +788,22 @@ protected function normalizeLocalConfig($config)
762788
],
763789
EOT;
764790

791+
// Up until Laravel 11.39
792+
$variants[] = <<<'EOT'
793+
'local' => [
794+
'driver' => 'local',
795+
'root' => storage_path('app'),
796+
'throw' => false,
797+
],
798+
EOT;
799+
765800
// Current version
766801
$current = <<<'EOT'
767802
'local' => [
768803
'driver' => 'local',
769804
'root' => storage_path('app'),
770805
'throw' => false,
806+
'report' => false,
771807
],
772808
EOT;
773809

@@ -795,6 +831,17 @@ protected function normalizePublicConfig($config)
795831
],
796832
EOT;
797833

834+
// Up until Laravel 11.39
835+
$variants[] = <<<'EOT'
836+
'public' => [
837+
'driver' => 'local',
838+
'root' => storage_path('app/public'),
839+
'url' => env('APP_URL').'/storage',
840+
'visibility' => 'public',
841+
'throw' => false,
842+
],
843+
EOT;
844+
798845
// Current version
799846
$current = <<<'EOT'
800847
'public' => [
@@ -803,6 +850,7 @@ protected function normalizePublicConfig($config)
803850
'url' => env('APP_URL').'/storage',
804851
'visibility' => 'public',
805852
'throw' => false,
853+
'report' => false,
806854
],
807855
EOT;
808856

@@ -847,6 +895,21 @@ protected function normalizeS3Config($config)
847895
],
848896
EOT;
849897

898+
// Up until Laravel 11.39
899+
$variants[] = <<<'EOT'
900+
's3' => [
901+
'driver' => 's3',
902+
'key' => env('AWS_ACCESS_KEY_ID'),
903+
'secret' => env('AWS_SECRET_ACCESS_KEY'),
904+
'region' => env('AWS_DEFAULT_REGION'),
905+
'bucket' => env('AWS_BUCKET'),
906+
'url' => env('AWS_URL'),
907+
'endpoint' => env('AWS_ENDPOINT'),
908+
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
909+
'throw' => false,
910+
],
911+
EOT;
912+
850913
// Current version
851914
$current = <<<'EOT'
852915
's3' => [
@@ -859,6 +922,7 @@ protected function normalizeS3Config($config)
859922
'endpoint' => env('AWS_ENDPOINT'),
860923
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
861924
'throw' => false,
925+
'report' => false,
862926
],
863927
EOT;
864928

0 commit comments

Comments
 (0)