Skip to content

Commit

Permalink
UHF-10737: Fix command if azure_fs is not configured
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky committed Dec 19, 2024
1 parent 06490db commit 5b637fa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Drush/Commands/FileCleanerCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\File\Exception\InvalidStreamWrapperException;
use Drupal\file\FileInterface;
use Drush\Attributes\Command;
use Drush\Commands\AutowireTrait;
Expand Down Expand Up @@ -60,7 +61,15 @@ public function clean(array $options = ['no-dry-run' => FALSE]): int {
->getStorage('file')
->load($result->fid);

$url = $file->createFileUrl(FALSE);
try {
$url = $file->createFileUrl(FALSE);
}
// URL generation fails if azure fs is not configured.
// This should only happen on local environment.
catch (InvalidStreamWrapperException $e) {
$url = $file->getFileUri();
}

$this->io()->writeln("Marking {$url} for deletion");

// Temporary files are eventually cleaned by hook_cron.
Expand Down

0 comments on commit 5b637fa

Please sign in to comment.