Snapshot of main at 9f39a6e1e (2026-11-02)
This commit is contained in:
commit
6ccf1792d7
2580 files changed
+1040202
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Serve the platform folder's public/ at /platform: the link public/platform -> platform_path('public').
|
||||
* Like storage:link. deploy.sh runs it; running it again changes nothing.
|
||||
*/
|
||||
class PlatformLink extends Command
|
||||
{
|
||||
protected $signature = 'platform:link';
|
||||
|
||||
protected $description = 'Link public/platform to the platform folder\'s public/ (favicons, logos)';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$link = public_path('platform');
|
||||
$target = platform_path('public');
|
||||
|
||||
if (!is_dir($target)) {
|
||||
if (is_link($link)) {
|
||||
unlink($link);
|
||||
$this->info("Removed public/platform: {$target} does not exist.");
|
||||
} else {
|
||||
$this->line("No platform public files ({$target}): nothing to link.");
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
if (is_link($link)) {
|
||||
if (readlink($link) === $target) {
|
||||
$this->line("public/platform already links to {$target}.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
unlink($link);
|
||||
} elseif (file_exists($link)) {
|
||||
$this->error('public/platform exists and is not a link: move it away first.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
symlink($target, $link);
|
||||
$this->info("Linked public/platform to {$target}.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user