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 Illuminate\Http\Request;
|
||||||
use App\Services\PluginManager;
|
use App\Services\PluginManager;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
|
||||||
class AdminController extends Controller
|
class AdminController extends Controller
|
||||||
|
|
@ -380,20 +381,35 @@ class AdminController extends Controller
|
||||||
->with('forms', compact('resources', 'redis', 'cache'));
|
->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();
|
$db = get_db_config();
|
||||||
$enabledPlugins = $plugins->getEnabledPlugins()->map(function ($plugin) {
|
$enabledPlugins = $plugins->getEnabledPlugins()->map(function ($plugin) {
|
||||||
return ['title' => trans($plugin->title), 'version' => $plugin->version];
|
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')
|
return view('admin.status')
|
||||||
->with('detail', [
|
->with('detail', [
|
||||||
'bs' => [
|
'bs' => [
|
||||||
'version' => config('app.version'),
|
'version' => config('app.version'),
|
||||||
'env' => config('app.env'),
|
'env' => config('app.env'),
|
||||||
'debug' => config('app.debug') ? trans('general.yes') : trans('general.no'),
|
'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(),
|
'laravel' => app()->version(),
|
||||||
],
|
],
|
||||||
'server' => [
|
'server' => [
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
"composer/ca-bundle": "^1.2",
|
"composer/ca-bundle": "^1.2",
|
||||||
"facade/ignition": "^1.4",
|
"facade/ignition": "^1.4",
|
||||||
"spatie/laravel-translation-loader": "^2.4",
|
"spatie/laravel-translation-loader": "^2.4",
|
||||||
|
"symfony/process": "^4.4",
|
||||||
"symfony/yaml": "^4.3",
|
"symfony/yaml": "^4.3",
|
||||||
"twig/twig": "^2.11",
|
"twig/twig": "^2.11",
|
||||||
"rcrowe/twigbridge": "^0.11.1"
|
"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