BuildInfo.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace UCore\Commands;
  3. use App\Models\Bt;
  4. use Illuminate\Console\Command;
  5. /**
  6. * 生成打包信息
  7. *
  8. * php artisan docker:buildinfo
  9. */
  10. class BuildInfo extends Command
  11. {
  12. /**
  13. * The name and signature of the console command.
  14. *
  15. * @var string
  16. */
  17. protected $signature = 'docker:buildinfo';
  18. /**
  19. * The console command description.
  20. *
  21. * @var string
  22. */
  23. protected $description = '生成打包信息';
  24. /**
  25. * Execute the console command.
  26. *
  27. * @return int
  28. */
  29. public function handle()
  30. {
  31. $config_build = base_path('config/build.php');
  32. $systemInfo = php_uname();
  33. $SERVER_SOFTWARE = $_SERVER['SERVER_SOFTWARE']??'';
  34. $envos = getenv('OS');
  35. $unamea = exec('uname -a');
  36. $build = [
  37. 'time' => time(),
  38. 'systemInfo' => $systemInfo,
  39. 'SERVER_SOFTWARE' => $SERVER_SOFTWARE,
  40. 'envos' => $envos,
  41. 'unamea' => $unamea,
  42. ];
  43. $string = var_export($build, true);
  44. file_put_contents($config_build, "<?php \r\n return $string ;");
  45. return Command::SUCCESS;
  46. }
  47. }