schneespur/app/Services/Installer/StorageConfigurator.php
Michael 2c63440ed8 Revert: move code back to project root from schneespur/ subdirectory
- Reverts the schneespur/ subdirectory restructure (b8e426b)
- Restores package.json and vite.config.js (needed for npm build, were
  removed in an earlier cleanup before the restructure)
- Updates public/build/ assets with current Vite output (new content hashes)
2026-05-17 18:24:26 +00:00

60 lines
1.7 KiB
PHP

<?php
namespace App\Services\Installer;
use Illuminate\Support\Facades\Artisan;
class StorageConfigurator
{
private const SUCCESS_MESSAGES = [
'storage:link' => 'install.storage_link_success',
'config:cache' => 'install.storage_config_cache_success',
'view:cache' => 'install.storage_view_cache_success',
];
public function runAll(): array
{
$results = [];
try {
$exitCode = Artisan::call('storage:link');
$results[] = [
'command' => 'storage:link',
'success' => $exitCode === 0,
'output' => $exitCode === 0
? __('install.storage_link_success')
: trim(Artisan::output()),
];
} catch (\Exception $e) {
$results[] = [
'command' => 'storage:link',
'success' => false,
'output' => $e->getMessage(),
'fallback' => true,
];
}
$commands = ['config:cache', 'view:cache'];
foreach ($commands as $command) {
try {
$exitCode = Artisan::call($command);
$results[] = [
'command' => $command,
'success' => $exitCode === 0,
'output' => $exitCode === 0
? __(self::SUCCESS_MESSAGES[$command])
: trim(Artisan::output()),
];
} catch (\Exception $e) {
$results[] = [
'command' => $command,
'success' => false,
'output' => $e->getMessage(),
];
}
}
return $results;
}
}