Changes for shared hosting and numerous installer fixes
This commit is contained in:
@@ -5,8 +5,6 @@ return [
|
||||
'version' => '7.0.0'
|
||||
],
|
||||
|
||||
'env_filename' => 'env.php',
|
||||
|
||||
'extensions' => [
|
||||
'openssl',
|
||||
'pdo',
|
||||
|
||||
@@ -12,6 +12,8 @@ use Modules\Installer\Services\DatabaseService;
|
||||
use Modules\Installer\Services\EnvironmentService;
|
||||
use Modules\Installer\Services\RequirementsService;
|
||||
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
||||
|
||||
|
||||
class InstallerController extends AppBaseController
|
||||
{
|
||||
@@ -31,7 +33,7 @@ class InstallerController extends AppBaseController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if(config('app.key') !== 'NOT_INSTALLED') {
|
||||
if(config('app.key') !== 'base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY=') {
|
||||
return view('installer::errors/already-installed');
|
||||
}
|
||||
|
||||
@@ -127,14 +129,19 @@ class InstallerController extends AppBaseController
|
||||
{
|
||||
Log::info('ENV setup', $request->toArray());
|
||||
|
||||
$this->envService->createEnvFile(
|
||||
$request->input('db_conn'),
|
||||
$request->input('db_host'),
|
||||
$request->input('db_port'),
|
||||
$request->input('db_name'),
|
||||
$request->input('db_user'),
|
||||
$request->input('db_pass')
|
||||
);
|
||||
try {
|
||||
$this->envService->createEnvFile(
|
||||
$request->input('db_conn'),
|
||||
$request->input('db_host'),
|
||||
$request->input('db_port'),
|
||||
$request->input('db_name'),
|
||||
$request->input('db_user'),
|
||||
$request->input('db_pass')
|
||||
);
|
||||
} catch(FileException $e) {
|
||||
flash()->error($e->getMessage());
|
||||
return redirect(route('installer.step2'));
|
||||
}
|
||||
|
||||
# Needs to redirect so it can load the new .env
|
||||
Log::info('Redirecting to database setup');
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
<link rel="stylesheet"
|
||||
href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css"/>
|
||||
<!-- CSS Files -->
|
||||
<link href="/assets/frontend/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
<link href="/assets/frontend/css/now-ui-kit.css" rel="stylesheet"/>
|
||||
<link href="/assets/frontend/css/styles.css" rel="stylesheet"/>
|
||||
<link href="{!! public_asset('/assets/frontend/css/bootstrap.min.css') !!}" rel="stylesheet"/>
|
||||
<link href="{!! public_asset('/assets/frontend/css/now-ui-kit.css') !!}" rel="stylesheet"/>
|
||||
<link href="{!! public_asset('/assets/frontend/css/styles.css') !!}" rel="stylesheet"/>
|
||||
{{--<link href="/assets/frontend/css/installer.css" rel="stylesheet"/>--}}
|
||||
|
||||
<link rel="stylesheet"
|
||||
@@ -42,7 +42,7 @@
|
||||
</button>
|
||||
<p class="navbar-brand text-white" data-placement="bottom" target="_blank">
|
||||
<a href="{!! url('/') !!}">
|
||||
<img src="/assets/frontend/img/logo_blue_bg.svg" width="135px" style=""/>
|
||||
<img src="{!! public_asset('/assets/frontend/img/logo_blue_bg.svg') !!}" width="135px" style=""/>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
{{--<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>--}}
|
||||
|
||||
<script src="/assets/frontend/js/core/jquery.3.2.1.min.js" type="text/javascript"></script>
|
||||
<script src="{!! public_asset('/assets/frontend/js/core/jquery.3.2.1.min.js') !!}" type="text/javascript"></script>
|
||||
{{--<script src="/assets/frontend/js/core/bootstrap.min.js" type="text/javascript"></script>--}}
|
||||
{{--<script src="/assets/frontend/js/now-ui-kit.js" type="text/javascript"></script>--}}
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
||||
|
||||
@@ -4,6 +4,10 @@ namespace Modules\Installer\Services;
|
||||
|
||||
use Illuminate\Encryption\Encrypter;
|
||||
use Log;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
||||
|
||||
class EnvironmentService
|
||||
{
|
||||
@@ -51,11 +55,7 @@ class EnvironmentService
|
||||
if(\extension_loaded('apc')) {
|
||||
$opts['CACHE_DRIVER'] = 'apc';
|
||||
} else {
|
||||
if($opts['APP_ENV'] === 'dev') {
|
||||
$opts['CACHE_DRIVER'] = 'array';
|
||||
} else {
|
||||
$opts['CACHE_DRIVER'] = 'file';
|
||||
}
|
||||
$opts['CACHE_DRIVER'] = 'array';
|
||||
}
|
||||
|
||||
return $opts;
|
||||
@@ -83,17 +83,26 @@ class EnvironmentService
|
||||
/**
|
||||
* Get the template file name and write it out
|
||||
* @param $opts
|
||||
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
|
||||
*/
|
||||
protected function writeEnvFile($opts)
|
||||
{
|
||||
$env_file = \App::environmentPath();
|
||||
$env_file .= config('installer.env_filename');
|
||||
$env_file = \App::environmentFilePath();
|
||||
|
||||
if(file_exists($env_file) && !is_writable($env_file)) {
|
||||
Log::error('Permissions on existing env.php is not writable');
|
||||
throw new FileException('Can\'t write to the env.php file! Check the permissions');
|
||||
}
|
||||
|
||||
$fp = fopen($env_file, 'wb');
|
||||
if($fp === false) {
|
||||
throw new FileException('Couldn\'t write the env.php. (' . error_get_last() .')');
|
||||
}
|
||||
|
||||
# render it within Blade and log the contents
|
||||
$env_contents = view('installer::stubs/env', $opts);
|
||||
Log::info($env_contents);
|
||||
|
||||
$fp = fopen($env_file, 'w');
|
||||
fwrite($fp, $env_contents);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@ class RequirementsService {
|
||||
*/
|
||||
public function checkPermissions(): array
|
||||
{
|
||||
clearstatcache();
|
||||
|
||||
$directories = [];
|
||||
foreach (config('installer.permissions') as $dir)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user