芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/portpulselogistics.com/app/Http/Controllers/InstallController.php
function_exists('curl_version'), 'routes_file_write_perm' => is_writable( base_path('app/Providers/RouteServiceProvider.php') ), 'db_file_write_perm' => is_writable( base_path('.env') ), ]; $values = [ 'app_url' => get_base_url(), 'db_host' => '127.0.0.1', 'db_name' => 'cargo', 'db_user' => 'root', ]; return view('installation.step3', compact('error', 'permission', 'values')); } public function step4() { return view('installation.step4'); } public function step5() { return view('installation.step5'); } public function step6() { update_env_value('INSTALLATION', 'true'); update_env_value('APP_ENV', 'production'); return view('installation.step6'); } public function purchase_code(Request $request) { return view('installation.step3'); } public function database_installation(Request $request) { if(self::check_database_connection($request->DB_HOST, $request->DB_DATABASE, $request->DB_USERNAME, $request->DB_PASSWORD)) { $path = base_path('.env'); if (file_exists($path)) { foreach ($request->types as $type) { update_env_value($type, $request[$type]); } return redirect()->route('installation.step4'); }else { return redirect()->route('installation.step3'); } }else { return redirect()->route('installation.step3', "database_error"); } } public function import_sql() { set_time_limit(0); ini_set('memory_limit', '-1'); define('STDIN', fopen("php://stdin", "r")); update_env_value('APP_ENV', 'local'); update_env_value('INSTALLATION', 'false'); Artisan::call('app:install'); return redirect()->route('installation.step6'); } public function check_database_connection($db_host = "", $db_name = "", $db_user = "", $db_pass = "") { $connected = false; try { $connected = (bool) @mysqli_connect($db_host, $db_user, $db_pass, $db_name); } catch(\Exception $e) {} return $connected; } }