mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-11-27 05:39:55 +08:00
Read commit ID by executing Git at status page
This commit is contained in:
parent
c665adf1c8
commit
ff6277a0ca
@ -17,6 +17,7 @@ use App\Services\OptionForm;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\PluginManager;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
|
||||
class AdminController extends Controller
|
||||
@ -380,20 +381,35 @@ class AdminController extends Controller
|
||||
->with('forms', compact('resources', 'redis', 'cache'));
|
||||
}
|
||||
|
||||
public function status(Request $request, PluginManager $plugins)
|
||||
{
|
||||
public function status(
|
||||
Request $request,
|
||||
PluginManager $plugins,
|
||||
Filesystem $filesystem
|
||||
) {
|
||||
$db = get_db_config();
|
||||
$enabledPlugins = $plugins->getEnabledPlugins()->map(function ($plugin) {
|
||||
return ['title' => trans($plugin->title), 'version' => $plugin->version];
|
||||
});
|
||||
|
||||
if ($filesystem->exists(base_path('.git'))) {
|
||||
$process = new \Symfony\Component\Process\Process(
|
||||
['git', 'log', '--pretty=%H', '-1']
|
||||
);
|
||||
$process->run();
|
||||
$commit = $process->isSuccessful() ? trim($process->getOutput()) : '';
|
||||
}
|
||||
|
||||
return view('admin.status')
|
||||
->with('detail', [
|
||||
'bs' => [
|
||||
'version' => config('app.version'),
|
||||
'env' => config('app.env'),
|
||||
'debug' => config('app.debug') ? trans('general.yes') : trans('general.no'),
|
||||
'commit' => Str::limit(resolve(\App\Services\Webpack::class)->commit, 10, ''),
|
||||
'commit' => Str::limit(
|
||||
$commit ?? resolve(\App\Services\Webpack::class)->commit,
|
||||
16,
|
||||
''
|
||||
),
|
||||
'laravel' => app()->version(),
|
||||
],
|
||||
'server' => [
|
||||
|
@ -26,6 +26,7 @@
|
||||
"composer/ca-bundle": "^1.2",
|
||||
"facade/ignition": "^1.4",
|
||||
"spatie/laravel-translation-loader": "^2.4",
|
||||
"symfony/process": "^4.4",
|
||||
"symfony/yaml": "^4.3",
|
||||
"twig/twig": "^2.11",
|
||||
"rcrowe/twigbridge": "^0.11.1"
|
||||
|
484
composer.lock
generated
484
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user