Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table prefixes not being added to indexes #597

Merged
merged 5 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/Contracts/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ final public function getValue()
final public static function label($value)
{
if (isset(static::$labels[$value])) {
return trans(static::$labels[$value]);
$val = static::$labels[$value];
if (strpos($val, '.') !== false) {
return trans($val);
}

return $val;
}
}

Expand Down
42 changes: 23 additions & 19 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
//'unix_socket' => env('DB_SOCKET', ''),
'prefix' => env('DB_PREFIX', ''),
'timezone' => '+00:00',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'strict' => false,
'engine' => null,
'options' => [
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'timezone' => '+00:00',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'strict' => false,
'engine' => null,
'options' => [
PDO::ATTR_EMULATE_PREPARES => env('DB_EMULATE_PREPARES', false),
//PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
],
Expand All @@ -27,22 +28,25 @@
],
],
'sqlite' => [
'driver' => 'sqlite',
'database' => storage_path('db.sqlite'),
'timezone' => '+00:00',
'prefix' => '',
'driver' => 'sqlite',
'database' => storage_path('db.sqlite'),
'timezone' => '+00:00',
'prefix' => '',
'prefix_indexes' => true,
],
'testing' => [
'driver' => 'sqlite',
'database' => storage_path('testing.sqlite'),
'timezone' => '+00:00',
'prefix' => '',
'driver' => 'sqlite',
'database' => storage_path('testing.sqlite'),
'timezone' => '+00:00',
'prefix' => '',
'prefix_indexes' => true,
],
'memory' => [
'driver' => 'sqlite',
'database' => ':memory:',
'timezone' => '+00:00',
'prefix' => '',
'driver' => 'sqlite',
'database' => ':memory:',
'timezone' => '+00:00',
'prefix' => '',
'prefix_indexes' => true,
],
],

Expand Down
23 changes: 15 additions & 8 deletions modules/Importer/Http/Controllers/ImporterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ public function index(Request $request)
return view('importer::step1-configure');
}

protected function testDb(Request $request)
{
$this->dbSvc->checkDbConnection(
$request->post('db_conn'),
$request->post('db_host'),
$request->post('db_port'),
$request->post('db_name'),
$request->post('db_user'),
$request->post('db_pass')
);
}

/**
* Check the database connection
*
Expand All @@ -49,14 +61,7 @@ public function dbtest(Request $request)
$message = 'Database connection looks good!';

try {
$this->dbSvc->checkDbConnection(
$request->post('db_conn'),
$request->post('db_host'),
$request->post('db_port'),
$request->post('db_name'),
$request->post('db_user'),
$request->post('db_pass')
);
$this->testDb($request);
} catch (\Exception $e) {
$status = 'danger';
$message = 'Failed! '.$e->getMessage();
Expand All @@ -78,6 +83,8 @@ public function dbtest(Request $request)
public function config(Request $request)
{
try {
$this->testDb($request);

// Save the credentials to use later
$this->importerSvc->saveCredentialsFromRequest($request);

Expand Down
48 changes: 21 additions & 27 deletions modules/Importer/Resources/views/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>@yield('title') - importer</title>
<title>@yield('title') - installer</title>

<link rel="shortcut icon" type="image/png" href="{{ public_asset('/assets/img/favicon.png') }}"/>

Expand Down Expand Up @@ -35,35 +35,29 @@
</style>
</head>

<body>
<!-- Navbar -->
<nav class="navbar navbar-toggleable-md" style="background: #067ec1;">
<div class="container" style="width: 85%!important;">
<div class="navbar-translate">
<p class="navbar-brand text-white" data-placement="bottom" target="_blank">
<a href="{{ url('/') }}">
<img src="{{ public_asset('/assets/img/logo_blue_bg.svg') }}" width="135px" style=""/>
</a>
</p>
</div>
<div class="justify-content-center" id="navigation" style="margin-left: 50px; color: white; font-size: 20px;">
@yield('title')
</div>
</div>
</nav>
<!-- End Navbar -->
{{--<div class="clearfix" style="height: 25px;"></div>--}}
<div class="wrapper">
<div class="clear"></div>
<div class="container" style="width: 50%">
<div class="row">
<div class="col-12">
@include('importer::flash.message')
@yield('content')
<body class="login-page" style="background: #067ec1;">
<div class="page-header clear-filter">
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-8 ml-auto mr-auto content-center">
<div class="p-10" style="padding: 10px 0;">
<img src="{{ public_asset('/assets/img/logo_blue_bg.svg') }}" width="135px" style="" alt=""/>
</div>
<div class="card card-login card-plain" style="background: #FFF">
<div class="card-header text-center">
<h3 class="card-title title">@yield('title')</h3>
</div>
<div class="card-body">
<hr />
@include('importer::flash.message')
@yield('content')
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix" style="height: 200px;"></div>
</div>

{{--<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>--}}
Expand Down
22 changes: 4 additions & 18 deletions modules/Importer/Resources/views/step1-configure.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'importer.config', 'method' => 'POST']) }}
<table class="table" width="25%">

<table class="table">
<tr>
<td colspan="2">
<h4>IMPORTANT NOTES</h4>
Expand All @@ -24,25 +23,12 @@
</tr>

<tr>
<td colspan="2"><h4>Site Config</h4>
<p>Enter the database information for your legacy (v2 or v5) database</p>
</td>
</tr>

<tr>
<td>Admin Email</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'email', '', ['class' => 'form-control']) }}
<p>The admin's email address, the password for this will be reset</p>
</div>
<td colspan="2">
<h4>Database Config</h4>
<p>Enter the database information for your legacy phpVMS installation</p>
</td>
</tr>

<tr>
<td colspan="2"><h4>Database Config</h4></td>
</tr>

<tbody id="mysql_settings">
<tr>
<td>Database Host</td>
Expand Down
1 change: 0 additions & 1 deletion modules/Importer/Services/ImporterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function __construct()
public function saveCredentialsFromRequest(Request $request)
{
$creds = [
'admin_email' => $request->post('email'),
'host' => $request->post('db_host'),
'port' => $request->post('db_port'),
'name' => $request->post('db_name'),
Expand Down
12 changes: 0 additions & 12 deletions modules/Installer/Resources/views/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,6 @@
<div class="card card-login card-plain" style="background: #FFF">
<div class="card-header text-center">
<h3 class="card-title title">@yield('title')</h3>

{{--<div class="text-large">
<a href="#" onclick="return false;" class="btn btn-neutral btn-facebook btn-icon btn-round">
<i class="now-ui-icons design_bullet-list-02"></i>
</a>
<a href="#" onclick="return false;" class="btn btn-neutral btn-twitter btn-icon btn-lg btn-round">
<i class="now-ui-icons users_single-02"></i>
</a>
<a href="#" onclick="return false;" class="btn btn-neutral btn-google btn-icon btn-round">
<i class="now-ui-icons users_single-02"></i>
</a>
</div>--}}
</div>
<div class="card-body">
<hr />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</tr>

<tr>
<td colspan="2"><h4>php extensions</h4></td>
<td colspan="2"><h4>PHP Extensions</h4></td>
</tr>
@foreach($extensions as $ext)
<tr>
Expand All @@ -37,7 +37,7 @@

<tr>
<td colspan="2">
<h4>directory permissions</h4>
<h4>Directory Permissions</h4>
<p>Make sure these directories have read and write permissions</p>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
</tr>

<tr>
<td colspan="2"><h4>Database Config</h4></td>
<td colspan="2">
<h4>Database Config</h4>
<p>Enter the target database information</p>
</td>
</tr>

<tr>
Expand Down
48 changes: 21 additions & 27 deletions modules/Updater/Resources/views/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>@yield('title') - updater</title>
<title>@yield('title') - installer</title>

<link rel="shortcut icon" type="image/png" href="{{ public_asset('/assets/img/favicon.png') }}"/>

Expand Down Expand Up @@ -35,35 +35,29 @@
</style>
</head>

<body>
<!-- Navbar -->
<nav class="navbar navbar-toggleable-md" style="background: #067ec1;">
<div class="container" style="width: 85%!important;">
<div class="navbar-translate">
<p class="navbar-brand text-white" data-placement="bottom" target="_blank">
<a href="{{ url('/') }}">
<img src="{{ public_asset('/assets/img/logo_blue_bg.svg') }}" width="135px" style=""/>
</a>
</p>
</div>
<div class="justify-content-center" id="navigation" style="margin-left: 50px; color: white; font-size: 20px;">
@yield('title')
</div>
</div>
</nav>
<!-- End Navbar -->
{{--<div class="clearfix" style="height: 25px;"></div>--}}
<div class="wrapper">
<div class="clear"></div>
<div class="container" style="width: 50%">
<div class="row">
<div class="col-12">
@include('installer::flash.message')
@yield('content')
<body class="login-page" style="background: #067ec1;">
<div class="page-header clear-filter">
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-8 ml-auto mr-auto content-center">
<div class="p-10" style="padding: 10px 0;">
<img src="{{ public_asset('/assets/img/logo_blue_bg.svg') }}" width="135px" style="" alt=""/>
</div>
<div class="card card-login card-plain" style="background: #FFF">
<div class="card-header text-center">
<h3 class="card-title title">@yield('title')</h3>
</div>
<div class="card-body">
<hr />
@include('updater::flash.message')
@yield('content')
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix" style="height: 200px;"></div>
</div>

{{--<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>--}}
Expand Down
13 changes: 7 additions & 6 deletions resources/stubs/installer/config.stub
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ return [
'default' => env('DB_CONNECTION', '$DB_CONN$'),
'connections' => [
'mysql' => [
'host' => env('DB_HOST', '$DB_HOST$'),
'port' => $DB_PORT$,
'database' => '$DB_NAME$',
'username' => '$DB_USER$',
'password' => '$DB_PASS$',
'prefix' => '$DB_PREFIX$',
'host' => env('DB_HOST', '$DB_HOST$'),
'port' => $DB_PORT$,
'database' => '$DB_NAME$',
'username' => '$DB_USER$',
'password' => '$DB_PASS$',
'prefix' => '$DB_PREFIX$',
'prefix_indexes' => true,
],
],
],
Expand Down