Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions src/Console/FetchDataFromOzu.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class FetchDataFromOzu extends Command
{
protected $signature = 'ozu:fetch-ozu-data';
protected $signature = 'ozu:fetch-ozu-data {--force : Do not ask for confirmation} {--withoutAssets : Do not download assets}';
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option name withoutAssets should use kebab-case following Laravel conventions. It should be --without-assets instead of --withoutAssets. This improves consistency with standard Laravel command options.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new command options --force and --withoutAssets lack test coverage. Consider adding tests to verify:

  1. The --force option bypasses the confirmation prompt
  2. The --withoutAssets option skips asset download and extraction
  3. Both options work correctly together

Similar commands in this project have comprehensive test coverage (e.g., FetchSettingsFromOzu).

Copilot uses AI. Check for mistakes.

protected $aliases = ['ozu:fetch-data', 'ozu:pull'];

Expand All @@ -26,14 +26,16 @@ class FetchDataFromOzu extends Command

public function handle(Client $ozuClient): int
{

$this->warn('⚠️ This action will erase your local database and assets.');

if (!confirm(
'Are you sure you want to continue? This cannot be undone.',
default: false,
)) {
return self::SUCCESS;
$this->newLine(2);
$this->warn('⚠️ This action will erase your local database and assets.');
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space in the warning emoji. Should be ⚠️ instead of ⚠️ (there are two spaces after the emoji).

Suggested change
$this->warn('⚠️ This action will erase your local database and assets.');
$this->warn('⚠️ This action will erase your local database and assets.');

Copilot uses AI. Check for mistakes.

if (!$this->option('force')) {
if (!confirm(
'Are you sure you want to continue? This cannot be undone.',
default: false,
)) {
return self::SUCCESS;
}
}

$this->initializePaths($ozuClient);
Expand All @@ -46,12 +48,14 @@ public function handle(Client $ozuClient): int
return self::FAILURE;
}

if (!$this->downloadAssets($ozuClient)) {
return self::FAILURE;
}
if (!$this->option('withoutAssets')) {
if (!$this->downloadAssets($ozuClient)) {
return self::FAILURE;
}

if (!$this->extractAssets()) {
return self::FAILURE;
if (!$this->extractAssets()) {
return self::FAILURE;
}
}

$this->cleanTemporaryFiles();
Expand Down
6 changes: 3 additions & 3 deletions src/OzuServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ public function register()
$this->app->bind(Paginator::class, StaticPaginator::class);
$this->app->bind(LengthAwarePaginator::class, StaticLengthAwarePaginator::class);
$this->app->bind(Thumbnail::class, function ($app) {
if (!$app->environment('production') || !config('ozu-client.cdn_url')) {
if (!config('ozu-client.cdn_url')) {
// if no CDN URL is set, use the local storage
return $app->make(LocalThumbnail::class);
}

// Have to rely on the URL to determine the CDN provider for now,
// because we are limited to 10 params for the deployment script :/
if (str(config('ozu-client.cdn_url'))->contains('kxcdn.com')) {
return $app->make(KeyCdnThumbnail::class);
}

// ImageKit CDN also serves as a fallback
return $app->make(ImageKitThumbnail::class);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Thumbnails/LocalThumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Filesystem\FilesystemManager;
use Illuminate\Support\Str;
use Intervention\Image\Drivers\Imagick\Driver;
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\ImageManager;

Expand Down