OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

4 years ago
  1. <?php
  2. namespace App\Commands;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use LaravelZero\Framework\Commands\Command;
  5. use Illuminate\Support\Facades\File;
  6. use App\Facades\Install;
  7. use Log;
  8. class InstallMariadbCommand extends Command
  9. {
  10. /**
  11. * The signature of the command.
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'install:nginx';
  16. /**
  17. * The description of the command.
  18. *
  19. * @var string
  20. */
  21. protected $description = 'Install mariadb and set configuration';
  22. /**
  23. * Execute the console command.
  24. *
  25. * @return mixed
  26. */
  27. public function handle()
  28. {
  29. $this->info('Mariadb install...');
  30. exec('apt update 2>&1');
  31. exec('apt install -y mariadb-server mariadb-client 2>&1');
  32. $link = mysqli_connect('127.0.0.1', 'root', $password);
  33. //exec('UPDATE mysql.user SET Password=PASSWORD('${install_mysql_password}') WHERE User='root';');
  34. //mysql_query("UPDATE mysql.user SET Password=PASSWORD('$password') WHERE User='root';");
  35. //
  36. mysqli_close($link);
  37. if (Install::isReady('mariadb-server mariadb-client')) {
  38. // get status of nginx
  39. exec('nginx -v 2>&1', $output);
  40. $status = "$output[0] installed";
  41. $this->info($status);
  42. Log::info($status);
  43. }
  44. }
  45. }