<?php
							 | 
						|
								
							 | 
						|
								namespace App\Commands;
							 | 
						|
								
							 | 
						|
								use Illuminate\Console\Scheduling\Schedule;
							 | 
						|
								use LaravelZero\Framework\Commands\Command;
							 | 
						|
								use Illuminate\Support\Facades\File;
							 | 
						|
								
							 | 
						|
								use App\Facades\Install;
							 | 
						|
								
							 | 
						|
								use Log;
							 | 
						|
								
							 | 
						|
								class MariadbInstallCommand extends Command
							 | 
						|
								{
							 | 
						|
								    /**
							 | 
						|
								     * The signature of the command.
							 | 
						|
								     *
							 | 
						|
								     * @var string
							 | 
						|
								     */
							 | 
						|
								    protected $signature = 'mariadb:install';
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * The description of the command.
							 | 
						|
								     *
							 | 
						|
								     * @var string
							 | 
						|
								     */
							 | 
						|
								    protected $description = 'Install mariadb and set configuration';
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * Execute the console command.
							 | 
						|
								     *
							 | 
						|
								     * @return mixed
							 | 
						|
								     */
							 | 
						|
								    public function handle()
							 | 
						|
								    {
							 | 
						|
								        $this->info('Mariadb install...');
							 | 
						|
								
							 | 
						|
								        exec('apt update 2>&1');
							 | 
						|
								        exec('apt install -y mariadb-server mariadb-client 2>&1');
							 | 
						|
								
							 | 
						|
								        $link = mysqli_connect('127.0.0.1', 'root', $password);
							 | 
						|
								
							 | 
						|
								        //exec('UPDATE mysql.user SET Password=PASSWORD('${install_mysql_password}') WHERE User='root';');
							 | 
						|
								        //mysql_query("UPDATE mysql.user SET Password=PASSWORD('$password') WHERE User='root';");
							 | 
						|
								        //
							 | 
						|
								
							 | 
						|
								        //mysqli_close($link);
							 | 
						|
								
							 | 
						|
								        if (Install::isReady('mariadb-server mariadb-client')) {
							 | 
						|
								
							 | 
						|
								            // get status of nginx
							 | 
						|
								            exec('nginx -v 2>&1', $output);
							 | 
						|
								            $status = "$output[0] installed";
							 | 
						|
								
							 | 
						|
								            $this->info($status);
							 | 
						|
								            Log::info($status);
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |