storage url o'zgartirildi
This commit is contained in:
@@ -8,7 +8,9 @@ use Throwable;
|
|||||||
|
|
||||||
class StorageHealthCheck extends Command
|
class StorageHealthCheck extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'storage:health-check {disk? : Disk name, defaults to filesystems.default}';
|
protected $signature = 'storage:health-check
|
||||||
|
{disk? : Disk name, defaults to filesystems.default}
|
||||||
|
{--keep : Keep the test file so the public URL can be checked in a browser}';
|
||||||
|
|
||||||
protected $description = 'Check current storage disk, write/read/delete a test file, and print its public URL.';
|
protected $description = 'Check current storage disk, write/read/delete a test file, and print its public URL.';
|
||||||
|
|
||||||
@@ -37,8 +39,13 @@ class StorageHealthCheck extends Command
|
|||||||
$this->line('exists=' . ($exists ? 'yes' : 'no'));
|
$this->line('exists=' . ($exists ? 'yes' : 'no'));
|
||||||
$this->line('public_url=' . Storage::disk($disk)->url($path));
|
$this->line('public_url=' . Storage::disk($disk)->url($path));
|
||||||
|
|
||||||
Storage::disk($disk)->delete($path);
|
if ($this->option('keep')) {
|
||||||
$this->line('delete=ok');
|
$this->warn('delete=skipped');
|
||||||
|
$this->warn('Open public_url in browser or curl it from outside the container.');
|
||||||
|
} else {
|
||||||
|
Storage::disk($disk)->delete($path);
|
||||||
|
$this->line('delete=ok');
|
||||||
|
}
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$this->error(get_class($e) . ': ' . $e->getMessage());
|
$this->error(get_class($e) . ': ' . $e->getMessage());
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
|
|||||||
Reference in New Issue
Block a user