ExportOffline.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. class ExportOffline extends Command
  5. {
  6. /**
  7. * The name and signature of the console command.
  8. *
  9. * @var string
  10. */
  11. protected $signature = 'export:offline';
  12. /**
  13. * The console command description.
  14. *
  15. * @var string
  16. */
  17. protected $description = 'Command description';
  18. /**
  19. * Create a new command instance.
  20. *
  21. * @return void
  22. */
  23. public function __construct()
  24. {
  25. parent::__construct();
  26. }
  27. /**
  28. * Execute the console command.
  29. *
  30. * @return int
  31. */
  32. public function handle()
  33. {
  34. //导出channel
  35. $this->call('export:channel');
  36. //导出channel
  37. $this->call('export:tag');
  38. $this->call('export:tag.map');
  39. $this->call('export:pali.text');
  40. //导出章节索引
  41. $this->call('export:chapter.index');
  42. //导出译文
  43. $this->call('export:sentence');
  44. //导出原文
  45. $this->call('export:sentence',['--type'=>'original']);
  46. shell_exec("XZ_OPT=-9 tar jcvf ".storage_path("app/public/export/offline.tar.xz")." ".storage_path("app/public/export/offline"));
  47. return 0;
  48. }
  49. }