Installer updates
Added probe.php Added new installer views and controllers Updated AuthController Updated Middlewares Updated Commands for installation process
This commit is contained in:
@@ -14,8 +14,8 @@ active
|
||||
|
||||
@section('content')
|
||||
|
||||
<h1 style="text-align: center;">Database Setup</h1>
|
||||
This test will check prerequisites required to install Faveo<br/>
|
||||
<h1 style="text-align: center;">Database Setup</h1>
|
||||
This test will check prerequisites required to install Faveo<br/>
|
||||
<?php
|
||||
/**
|
||||
* Faveo HELPDESK Probe
|
||||
@@ -29,6 +29,7 @@ $host = Session::get('host');
|
||||
$username = Session::get('username');
|
||||
$password = Session::get('password');
|
||||
$databasename = Session::get('databasename');
|
||||
$dummy_install = Session::get('dummy_data_installation');
|
||||
$port = Session::get('port');
|
||||
define('DB_HOST', $host); // Address of your MySQL server (usually localhost)
|
||||
define('DB_USER', $username); // Username that is used to connect to the server
|
||||
@@ -40,23 +41,34 @@ define('PROBE_FOR', '<b>Faveo</b> HELPDESK 1.0 and Newer');
|
||||
define('STATUS_OK', 'Ok');
|
||||
define('STATUS_WARNING', 'Warning');
|
||||
define('STATUS_ERROR', 'Error');
|
||||
|
||||
class TestResult {
|
||||
|
||||
var $message;
|
||||
var $status;
|
||||
|
||||
function __construct($message, $status = STATUS_OK) {
|
||||
$this->message = $message;
|
||||
$this->status = $status;
|
||||
}
|
||||
} // TestResult
|
||||
|
||||
}
|
||||
|
||||
// TestResult
|
||||
if (DB_HOST && DB_USER && DB_NAME) {
|
||||
?>
|
||||
<?php
|
||||
<?php
|
||||
$mysqli_ok = true;
|
||||
$results = array();
|
||||
// error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
|
||||
error_reporting(0);
|
||||
if($default == 'mysql') {
|
||||
if ($connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME)) {
|
||||
if ($default == 'mysql') {
|
||||
if(DB_PORT != '' && is_numeric(DB_PORT)) {
|
||||
$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT);
|
||||
} else {
|
||||
$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
}
|
||||
if ($connection) {
|
||||
$results[] = new TestResult('Connected to database as ' . DB_USER . '@' . DB_HOST . DB_PORT, STATUS_OK);
|
||||
if (mysqli_select_db($connection, DB_NAME)) {
|
||||
$results[] = new TestResult('Database "' . DB_NAME . '" selected', STATUS_OK);
|
||||
@@ -64,7 +76,7 @@ if (DB_HOST && DB_USER && DB_NAME) {
|
||||
if (version_compare($mysqli_version, '5') >= 0) {
|
||||
$results[] = new TestResult('MySQL version is ' . $mysqli_version, STATUS_OK);
|
||||
// $have_inno = check_have_inno($connection);
|
||||
$sql = "SHOW TABLES FROM ".DB_NAME;
|
||||
$sql = "SHOW TABLES FROM " . DB_NAME;
|
||||
$res = mysqli_query($connection, $sql);
|
||||
if (mysqli_fetch_array($res) === null) {
|
||||
$results[] = new TestResult('Database is empty');
|
||||
@@ -78,14 +90,14 @@ if (DB_HOST && DB_USER && DB_NAME) {
|
||||
$mysqli_ok = false;
|
||||
} // if
|
||||
} else {
|
||||
$results[] = new TestResult('Failed to select database. ' . mysqli_error(), STATUS_ERROR);
|
||||
$results[] = new TestResult('Failed to select database. ' . mysqli_connect_error(), STATUS_ERROR);
|
||||
$mysqli_ok = false;
|
||||
} // if
|
||||
} else {
|
||||
$results[] = new TestResult('Failed to connect to database. ' . mysqli_error(), STATUS_ERROR);
|
||||
$results[] = new TestResult('Failed to connect to database. ' . mysqli_connect_error(), STATUS_ERROR);
|
||||
$mysqli_ok = false;
|
||||
} // if
|
||||
}
|
||||
}
|
||||
// elseif($default == 'pgsql') {
|
||||
// if ($connection2 = pg_connect("'host='.DB_HOST.' port='.DB_PORT.' dbname='.DB_NAME.' user='.DB_USER.' password='.DB_PASS.")) {
|
||||
// $results[] = new TestResult('Connected to database as ' . DB_USER . '@' . DB_HOST, STATUS_OK);
|
||||
@@ -94,7 +106,6 @@ if (DB_HOST && DB_USER && DB_NAME) {
|
||||
// $mysqli_ok = false;
|
||||
// }
|
||||
// } elseif($default == 'sqlsrv') {
|
||||
|
||||
// }
|
||||
// ---------------------------------------------------
|
||||
// Validators
|
||||
@@ -105,105 +116,180 @@ if (DB_HOST && DB_USER && DB_NAME) {
|
||||
print '<br><span class="' . strtolower($result->status) . '">' . $result->status . '</span> — ' . $result->message . '';
|
||||
} // foreach
|
||||
?> </p>
|
||||
<!-- </ul> -->
|
||||
<!-- </ul> -->
|
||||
<?php } else { ?>
|
||||
<p>Database test is <strong>turned off</strong>. To turn it On, please open probe.php in your favorite text editor and set DB_XXXX connection parameters in database section at the beginning of the file:</p>
|
||||
<ul>
|
||||
<li>DB_HOST — Address of your MySQL server (usually localhost)</li>
|
||||
<li>DB_USER — Username that is used to connect to the server</li>
|
||||
<li>DB_PASS — User's password</li>
|
||||
<li>DB_NAME — Name of the database you are connecting to</li>
|
||||
</ul>
|
||||
<p>Once these settings are set, probe.php will check if your database meets the system requirements.</p>
|
||||
<?php $mysqli_ok = null;?>
|
||||
<?php } ?>
|
||||
<br/>
|
||||
<ul>
|
||||
<li><p>Unable to test database connection. Please make sure your database server is up and running and PHP is working with session.</p></li>
|
||||
</ul>
|
||||
<p>If you have fixed all the errors. <a href="{{ URL::route('configuration') }}">Click here</a> to continue the installation process.</p>
|
||||
<?php $mysqli_ok = null; ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($mysqli_ok !== null) {?>
|
||||
<?php if ($mysqli_ok) {?>
|
||||
<?php if ($mysqli_ok !== null) { ?>
|
||||
<?php if ($mysqli_ok) { ?>
|
||||
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
<p id="pass">Database connection successful. This system can run Faveo</p>
|
||||
</div>
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
<p id="pass">Database connection successful. This system can run Faveo</p>
|
||||
</div>
|
||||
|
||||
<script src="{{asset("lb-faveo/js/ajax-jquery.min.js")}}"></script>
|
||||
<script src="{{asset("lb-faveo/js/ajax-jquery.min.js")}}"></script>
|
||||
|
||||
<span id="wait">Please wait this may take a while......</span>
|
||||
<span id="wait"></span>
|
||||
|
||||
{!! Form::open( ['id'=>'form','method' => 'POST'] )!!}
|
||||
{{-- <input type="hidden" name="_token" value="{{ csrf_token() }}"> --}}
|
||||
<!-- <b>default</b><br> -->
|
||||
<input type="hidden" name="default" value="{!! $default !!}"/>
|
||||
<!-- <b>Host</b><br> -->
|
||||
<input type="hidden" name="host" value="{!! $host !!}"/>
|
||||
<!-- <b>Database Name</b><br> -->
|
||||
<input type="hidden" name="databasename" value="{!! $databasename !!}"/>
|
||||
<!-- <b>User Name</b><br> -->
|
||||
<input type="hidden" name="username" value="{!! $username !!}"/>
|
||||
<!-- <b>User Password</b><br> -->
|
||||
<input type="hidden" name="password" value="{!! $password !!}"/>
|
||||
<!-- <b>Port</b><br> -->
|
||||
<input type="hidden" name="port" value="{!! $port !!}"/>
|
||||
{!! Form::open( ['id'=>'form','method' => 'POST'] )!!}
|
||||
{{-- <input type="hidden" name="_token" value="{{ csrf_token() }}"> --}}
|
||||
<!-- <b>default</b><br> -->
|
||||
<input type="hidden" name="default" value="{!! $default !!}"/>
|
||||
<!-- <b>Host</b><br> -->
|
||||
<input type="hidden" name="host" value="{!! $host !!}"/>
|
||||
<!-- <b>Database Name</b><br> -->
|
||||
<input type="hidden" name="databasename" value="{!! $databasename !!}"/>
|
||||
<!-- <b>User Name</b><br> -->
|
||||
<input type="hidden" name="username" value="{!! $username !!}"/>
|
||||
<!-- <b>User Password</b><br> -->
|
||||
<input type="hidden" name="password" value="{!! $password !!}"/>
|
||||
<!-- <b>Port</b><br> -->
|
||||
<input type="hidden" name="port" value="{!! $port !!}"/>
|
||||
<!-- Dummy data installation -->
|
||||
<input type="hidden" name="dummy_install" value="{!! $dummy_install !!}"/>
|
||||
|
||||
<input type="submit" style="display:none;">
|
||||
<input type="submit" style="display:none;">
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<div id="show" style="display:none;">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
|
||||
<div id="show" style="display:none;">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-9" style="text-align: center"id='loader' >
|
||||
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="border-bottom: 1px solid #eee;">
|
||||
<p class="setup-actions step">
|
||||
<a href="{{ URL::route('account') }}" class="pull-right" id="next" style="text-color:black"><input type="submit" id="submitme" class="button-primary button button-large button-next" value="Continue"> </a>
|
||||
<a href="{{ URL::route('configuration') }}" class="button button-large button-next" style="float: left">Previous</a>
|
||||
</p>
|
||||
</div>
|
||||
<div style="border-bottom: 1px solid #eee;">
|
||||
<p class="setup-actions step" id="retry">
|
||||
<a href="{{ URL::route('account') }}" class="pull-right" id="next" style="text-color:black"><input type="submit" id="submitme" class="button-primary button button-large button-next" value="Continue"> </a>
|
||||
<a href="{{ URL::route('configuration') }}" class="button button-large button-next" style="float: left">Previous</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<script type="text/javascript">
|
||||
// submit a ticket
|
||||
$(document).ready(function () {
|
||||
$("#form").submit();
|
||||
});
|
||||
// Edit a ticket
|
||||
$('#form').on('submit', function() {
|
||||
<script type="text/javascript">
|
||||
// submit a ticket
|
||||
$(document).ready(function () {
|
||||
$("#form").submit();
|
||||
});
|
||||
// Edit a ticket
|
||||
$('#form').on('submit', function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{!! route('postconnection') !!}",
|
||||
dataType: "html",
|
||||
type: "GET",
|
||||
url: "{!! url('create/env') !!}",
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
beforeSend: function() {
|
||||
beforeSend: function () {
|
||||
$("#conn").hide();
|
||||
$("#show").show();
|
||||
$("#wait").show();
|
||||
},
|
||||
success: function(response) {
|
||||
// $("#dismis").trigger("click");
|
||||
if (response == 1) {
|
||||
$("#show").hide();
|
||||
$("#wait").hide();
|
||||
$("#conn").show();
|
||||
// $("#next1").trigger("click");
|
||||
} else if (response == 0) {
|
||||
alert('Please check all your fields');
|
||||
}
|
||||
success: function (response) {
|
||||
var data=response.result;
|
||||
console.log(data);
|
||||
var message = data.success;
|
||||
var next = data.next;
|
||||
var api = data.api;
|
||||
$('#submitme').attr('disabled','disabled');
|
||||
$('#wait').append('<ul><li>'+message+'</li><li class="seco">'+next+'...</li></ul>');
|
||||
callApi(api);
|
||||
},
|
||||
error: function(response){
|
||||
var data=response.responseJSON.result;
|
||||
$('#wait').append('<ul><li style="color:red">'+data.error+'</li></ul>');
|
||||
$('#loader').hide();
|
||||
$('#next').find('#submitme').hide();
|
||||
$('#retry').append('<input type="button" id="submitm" class="button-primary button button-large button-next" value="Retry" onclick="reload()">');
|
||||
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php } else {?>
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
function callApi(api) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: api,
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
success: function (response) {
|
||||
var data=response.result;
|
||||
console.log(data);
|
||||
var message = data.success;
|
||||
var next = data.next;
|
||||
var api = data.api;
|
||||
$("#wait").find('.seco').remove();
|
||||
$('#wait ul').append('<li>'+message+'</li><li class="seco">'+next+'...</li>');
|
||||
if (message == 'Database has been setup successfully.') {
|
||||
$('#loader').hide();
|
||||
$('#next').find('#submitme').show();
|
||||
$('#submitme').removeAttr('disabled');
|
||||
$('.seco').hide();
|
||||
} else {
|
||||
callApi(api);
|
||||
}
|
||||
},
|
||||
error: function(response){
|
||||
console.log(response);
|
||||
var data=response.responseJSON.result;
|
||||
$('#seco').append('<p style="color:red">'+data.error+'</p>');
|
||||
$('#loader').hide();
|
||||
$('#next').find('#submitme').hide();
|
||||
$('#retry').append('<input type="button" id="submitm" class="button-primary button button-large button-next" value="Retry" onclick="reload()">');
|
||||
}
|
||||
});
|
||||
}
|
||||
function reload(){
|
||||
$('#retry').find('#submitm').remove();
|
||||
$('#loader').show();
|
||||
$('#wait').find('ol').remove();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "{!! url('create/env') !!}",
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
beforeSend: function () {
|
||||
$("#conn").hide();
|
||||
$("#show").show();
|
||||
$("#wait").show();
|
||||
},
|
||||
success: function (response) {
|
||||
var data=response.result;
|
||||
console.log(data);
|
||||
var message = data.success;
|
||||
var next = data.next;
|
||||
var api = data.api;
|
||||
$('#submitme').attr('disabled','disabled');
|
||||
$('#wait').append('<ul><li>'+message+'</li><li class="seco">'+next+'...</li></ul>');
|
||||
callApi(api);
|
||||
},
|
||||
error: function(response){
|
||||
var data=response.responseJSON.result;
|
||||
$('#wait').append('<ul><li style="color:red">'+data.error+'</li></ul>');
|
||||
$('#loader').hide();
|
||||
$('#next').find('#submitme').hide();
|
||||
$('#retry').append('<input type="button" id="submitm" class="button-primary button button-large button-next" value="Retry" onclick="reload()">');
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php } else { ?>
|
||||
<div class="woocommerce-message woocommerce-tracker" >
|
||||
<p id="fail">Database connection unsuccessful. This system does not meet Faveo system requirements</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>This either means that the username and password information is incorrect or we can’t contact the database server. This could mean your host’s database server is down.</p>
|
||||
<ul>
|
||||
<li>Are you sure you have the correct username and password?</li>
|
||||
@@ -213,15 +299,15 @@ $(document).ready(function () {
|
||||
<p>If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="http://www.ladybirdweb.com/support">Faveo Support </a>.</p>
|
||||
|
||||
|
||||
<div style="border-bottom: 1px solid #eee;">
|
||||
@if(Cache::has('step4')) <?php Cache::forget('step4')?> @endif
|
||||
<p class="setup-actions step">
|
||||
<input type="submit" id="submitme" class="button-danger button button-large button-next" style="background-color: #d43f3a;color:#fff;" value="continue" disabled>
|
||||
<a href="{{URL::route('configuration')}}" class="button button-large button-next" style="float: left;">Previous</a>
|
||||
</p>
|
||||
</div>
|
||||
<br/><br/>
|
||||
<?php } // if ?>
|
||||
<div style="border-bottom: 1px solid #eee;">
|
||||
@if(Cache::has('step4')) <?php Cache::forget('step4') ?> @endif
|
||||
<p class="setup-actions step">
|
||||
<input type="button" id="submitme" class="button-danger button button-large button-next" style="background-color: #d43f3a;color:#fff;" value="continue" disabled>
|
||||
<a href="{{URL::route('configuration')}}" class="button button-large button-next" style="float: left;">Previous</a>
|
||||
</p>
|
||||
</div>
|
||||
<br/><br/>
|
||||
<?php } // if ?>
|
||||
<div id="legend">
|
||||
{{-- <ul> --}}
|
||||
<p class="setup-actions step">
|
||||
@@ -231,6 +317,6 @@ $(document).ready(function () {
|
||||
</p>
|
||||
{{-- </ul> --}}
|
||||
</div>
|
||||
<?php } // if ?>
|
||||
<?php } // if ?>
|
||||
|
||||
@stop
|
||||
Reference in New Issue
Block a user