changes & fixes in installer
This commit is contained in:
parent
7a0d470c20
commit
03e18ca398
|
|
@ -1,18 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||
<title>Bagisto Installer</title>
|
||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container admin" id="admin">
|
||||
<div class="initial-display" style="padding-top: 100px;">
|
||||
<img class="logo" src="Images/logo.svg">
|
||||
<div class="initial-display">
|
||||
<p>Admin Details</p>
|
||||
|
||||
<form action="AdminConfig.php" method= "POST" id="admin-form">
|
||||
|
|
@ -49,10 +40,6 @@
|
|||
</form>
|
||||
|
||||
</div>
|
||||
<div class="footer">
|
||||
<img class="left-patern" src="Images/left-side.svg">
|
||||
<img class="right-patern" src="Images/right-side.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
@ -63,7 +50,6 @@
|
|||
$.validate({});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// process the form
|
||||
|
|
@ -77,10 +63,12 @@
|
|||
'admin_password' : $('input[name=admin_password]').val(),
|
||||
'admin_re_password' : $('input[name=admin_re_password]').val(),
|
||||
};
|
||||
|
||||
var adminTarget = window.location.href.concat('/AdminConfig.php');
|
||||
// process the form
|
||||
$.ajax({
|
||||
type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
|
||||
url : 'AdminConfig.php', // the url where we want to POST
|
||||
url : adminTarget, // the url where we want to POST
|
||||
data : formData, // our data object
|
||||
dataType : 'json', // what type of data do we expect back from the server
|
||||
encode : true
|
||||
|
|
|
|||
|
|
@ -1,112 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Permission {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $results = [];
|
||||
|
||||
/**
|
||||
* Set the result array permissions and errors.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->results['permissions'] = [];
|
||||
|
||||
$this->results['errors'] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for the folders permissions.
|
||||
*
|
||||
* @param array $folders
|
||||
* @return array
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$folders = [
|
||||
// 'permissions' => [
|
||||
'storage/framework/' => '775',
|
||||
'storage/logs/' => '775',
|
||||
'bootstrap/cache/' => '775'
|
||||
// ]
|
||||
];
|
||||
|
||||
foreach($folders as $folder => $permission)
|
||||
{
|
||||
if (!($this->getPermission($folder) >= $permission)) {
|
||||
$this->addFileAndSetErrors($folder, $permission, false);
|
||||
} else {
|
||||
$this->addFile($folder, $permission, true);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a folder permission.
|
||||
*
|
||||
* @param $folder
|
||||
* @return string
|
||||
*/
|
||||
private function getPermission($folder)
|
||||
{
|
||||
$location = str_replace('\\', '/', getcwd());
|
||||
$currentLocation = explode("/", $location);
|
||||
array_pop($currentLocation);
|
||||
array_pop($currentLocation);
|
||||
$desiredLocation = implode("/", $currentLocation);
|
||||
$fileLocation = $desiredLocation . '/' .$folder;
|
||||
|
||||
return substr(sprintf('%o', fileperms($fileLocation)), -4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the file to the list of results.
|
||||
*
|
||||
* @param $folder
|
||||
* @param $permission
|
||||
* @param $isSet
|
||||
*/
|
||||
private function addFile($folder, $permission, $isSet)
|
||||
{
|
||||
array_push($this->results['permissions'], [
|
||||
'folder' => $folder,
|
||||
'permission' => $permission,
|
||||
'isSet' => $isSet
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the file and set the errors.
|
||||
*
|
||||
* @param $folder
|
||||
* @param $permission
|
||||
* @param $isSet
|
||||
*/
|
||||
private function addFileAndSetErrors($folder, $permission, $isSet)
|
||||
{
|
||||
$this->addFile($folder, $permission, $isSet);
|
||||
|
||||
$this->results['errors'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render view for class.
|
||||
*
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
ob_start();
|
||||
|
||||
$permissions = $this->check();
|
||||
|
||||
include __DIR__ . '/../Views/permission.blade.php';
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||
<title>Bagisto Installer</title>
|
||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container environment" id="environment">
|
||||
<div class="initial-display" style="padding-top: 100px;">
|
||||
<img class="logo" src="Images/logo.svg">
|
||||
<div class="initial-display">
|
||||
<p>Environment Configuration</p>
|
||||
|
||||
<form action="EnvConfig.php" method="POST" id="environment-form">
|
||||
|
|
@ -92,11 +83,6 @@
|
|||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<img class="left-patern" src="Images/left-side.svg">
|
||||
<img class="right-patern" src="Images/right-side.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
@ -128,10 +114,12 @@
|
|||
|
||||
};
|
||||
|
||||
var target = window.location.href.concat('/EnvConfig.php');
|
||||
|
||||
// process the form
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'EnvConfig.php',
|
||||
url : target,
|
||||
data : formData,
|
||||
dataType : 'json',
|
||||
encode : true
|
||||
|
|
|
|||
|
|
@ -1,16 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||
<title>Bagisto Installer</title>
|
||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container finish" id="finish">
|
||||
<div class="initial-display" style="padding-top: 100px;">
|
||||
<img class="logo" src="Images/logo.svg">
|
||||
<div class="initial-display">
|
||||
<p>Finish Installment</p>
|
||||
<div class="content">
|
||||
<div class="content-container" style="padding: 20px">
|
||||
|
|
@ -23,10 +16,6 @@
|
|||
<button class="prepare-btn" onclick="finish()">Finish</button>
|
||||
|
||||
</div>
|
||||
<div class="footer">
|
||||
<img class="left-patern" src="Images/left-side.svg">
|
||||
<img class="right-patern" src="Images/right-side.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
@ -37,8 +26,8 @@
|
|||
|
||||
function finish() {
|
||||
lastIndex = window.location.href.lastIndexOf("/");
|
||||
secondlast = window.location.href.slice(0,lastIndex).lastIndexOf("/");
|
||||
next = window.location.href.slice(0,secondlast);
|
||||
secondlast = window.location.href.slice(0, lastIndex).lastIndexOf("/");
|
||||
next = window.location.href.slice(0, secondlast);
|
||||
next = next.concat('/admin/login');
|
||||
window.location.href = next;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||
<title>Bagisto Installer</title>
|
||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
||||
</head>
|
||||
|
||||
<style>
|
||||
.window {
|
||||
|
|
@ -59,8 +53,7 @@
|
|||
<body>
|
||||
|
||||
<div class="container migration" id="migration">
|
||||
<div class="initial-display" style="padding-top: 100px;">
|
||||
<img class="logo" src="Images/logo.svg">
|
||||
<div class="initial-display">
|
||||
<p>Migration & Seed</p>
|
||||
|
||||
<div class="cp-spinner cp-round" id="loader">
|
||||
|
|
@ -115,10 +108,6 @@
|
|||
</form>
|
||||
|
||||
</div>
|
||||
<div class="footer">
|
||||
<img class="left-patern" src="Images/left-side.svg">
|
||||
<img class="right-patern" src="Images/right-side.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
@ -144,10 +133,12 @@
|
|||
$('#storage').hide();
|
||||
$('#composer').hide();
|
||||
|
||||
var composerTarget = window.location.href.concat('/Composer.php');
|
||||
|
||||
// process form
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'Composer.php',
|
||||
url : composerTarget,
|
||||
dataType : 'json',
|
||||
encode : true
|
||||
})
|
||||
|
|
@ -163,10 +154,12 @@
|
|||
if (data['install'] == 0) {
|
||||
$('#composer-migrate').show();
|
||||
|
||||
var migrationTarget = window.location.href.concat('/MigrationRun.php');
|
||||
|
||||
// post the request again
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'MigrationRun.php',
|
||||
url : migrationTarget,
|
||||
dataType : 'json',
|
||||
encode : true
|
||||
})
|
||||
|
|
@ -178,9 +171,11 @@
|
|||
if (data['results'] == 0) {
|
||||
$('#composer-seed').show();
|
||||
|
||||
var seederTarget = window.location.href.concat('/Seeder.php');
|
||||
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'Seeder.php',
|
||||
url : seederTarget,
|
||||
dataType : 'json',
|
||||
encode : true
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ $data = array();
|
|||
// run command on terminal
|
||||
$key = 'cd ../.. && php artisan key:generate 2>&1';
|
||||
$seeder = 'cd ../.. && php artisan db:seed 2>&1';
|
||||
$publish = 'cd ../.. && php artisan vendor:publish 2>&1';
|
||||
$publish = 'cd ../.. && php artisan vendor:publish --all --force 2>&1';
|
||||
|
||||
$key_output = exec($key, $data['key'], $data['key_results']);
|
||||
$seeder_output = exec($seeder, $data['seeder'], $data['seeder_results']);
|
||||
|
|
|
|||
|
|
@ -1,61 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||
<title>Bagisto Installer</title>
|
||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container permission" id="permission">
|
||||
<div class="initial-display" style="padding-top: 100px;">
|
||||
<img class="logo" src="Images/logo.svg">
|
||||
<p>Permission</p>
|
||||
|
||||
<div class="content">
|
||||
<div class="title" style="text-align: center; margin-top: 10px">
|
||||
Please wait while we are checking the permissions
|
||||
</div>
|
||||
|
||||
<?php foreach($permissions['permissions'] as $permission): ?>
|
||||
<div class="check" style="margin-left: 20%">
|
||||
<?php if($permission['isSet'] ? $src = 'Images/green-check.svg' : $src = 'Images/red-check.svg' ): ?>
|
||||
<img src="<?php echo $src ?>">
|
||||
<?php endif; ?>
|
||||
<span style="margin-left: 10px"><b><?php echo $permission['folder'] ?></b></span>
|
||||
<span>(<?php echo $permission['permission'] ?> folder permission Required)</span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php if(!isset($permissions['errors'])): ?>
|
||||
<div>
|
||||
<button class="prepare-btn" id="permission-check">Continue</button>
|
||||
</div>
|
||||
<div style="cursor: pointer; margin-top:10px">
|
||||
<span id="permission-back">back</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<img class="left-patern" src="Images/left-side.svg">
|
||||
<img class="right-patern" src="Images/right-side.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||
<title>Bagisto Installer</title>
|
||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
||||
</head>
|
||||
|
||||
<?php
|
||||
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
|
||||
$greenCheck = $actual_link .'/'. 'Images/green-check.svg';
|
||||
$redCheck = $actual_link .'/'. 'Images/red-check.svg';
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container requirement" id="requirement">
|
||||
<div class="initial-display" style="padding-top: 100px;">
|
||||
<img class="logo" src="Images/logo.svg">
|
||||
<div class="initial-display">
|
||||
<p>Requirement</p>
|
||||
|
||||
<div class="content">
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
|
||||
<div class="check" style="margin-left: 25%">
|
||||
<?php if($phpVersion['supported'] ? $src = 'Images/green-check.svg' : $src = 'Images/red-check.svg' ): ?>
|
||||
<?php if($phpVersion['supported'] ? $src = $greenCheck : $src = $redCheck): ?>
|
||||
<img src="<?php echo $src ?>">
|
||||
<?php endif; ?>
|
||||
<span style="margin-left: 10px"><b>PHP</b></span>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
<?php foreach($requirements['requirements'][$type] as $extention => $enabled) : ?>
|
||||
<div class="check" style="margin-left: 25%">
|
||||
<?php if($enabled ? $src = 'Images/green-check.svg' : $src = 'Images/red-check.svg' ): ?>
|
||||
<?php if($enabled ? $src = $greenCheck : $src = $redCheck ): ?>
|
||||
<img src="<?php echo $src ?>">
|
||||
<?php endif; ?>
|
||||
<span style="margin-left: 10px"><b><?php echo $extention ?></b></span>
|
||||
|
|
@ -49,11 +49,6 @@
|
|||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<img class="left-patern" src="Images/left-side.svg">
|
||||
<img class="right-patern" src="Images/right-side.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||
<title>Bagisto Installer</title>
|
||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="CSS/style.css">
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container welcome" id="welcome">
|
||||
<div class="initial-display" style="padding-top: 100px;">
|
||||
<img class="logo" src="Images/logo.svg">
|
||||
<div class="initial-display">
|
||||
<p>Welcome to Bagisto</p>
|
||||
|
||||
<div class="content">
|
||||
|
|
@ -31,11 +26,6 @@
|
|||
<button type="button" class="prepare-btn" id="welcome-check">Accept</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<img class="left-patern" src="Images/left-side.svg">
|
||||
<img class="right-patern" src="Images/right-side.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,37 @@
|
|||
<?php
|
||||
<html>
|
||||
|
||||
<?php
|
||||
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
|
||||
$cssUrl = $actual_link .'/'. 'CSS/style.css';
|
||||
$logo = $actual_link .'/'. 'Images/logo.svg';
|
||||
$leftIcon = $actual_link .'/'. 'Images/left-side.svg';
|
||||
$rightIcon = $actual_link .'/'. 'Images/right-side.svg';
|
||||
?>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,500">
|
||||
<title>Bagisto Installer</title>
|
||||
<link rel="icon" sizes="16x16" href="Images/favicon.ico">
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href= "<?php echo $cssUrl; ?> ">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container requirement">
|
||||
<div class="initial-display" style="padding-top: 100px;">
|
||||
<img class="logo" src= "<?php echo $logo; ?>" >
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<img class="left-patern" src= "<?php echo $leftIcon; ?>" >
|
||||
<img class="right-patern" src= "<?php echo $rightIcon; ?>" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// getting env file
|
||||
$location = str_replace('\\', '/', getcwd());
|
||||
$currentLocation = explode("/", $location);
|
||||
|
|
@ -63,10 +96,9 @@
|
|||
}
|
||||
|
||||
if (!$installed) {
|
||||
|
||||
// including classes
|
||||
include __DIR__ . '/Classes/Permission.php';
|
||||
include __DIR__ . '/Classes/Requirement.php';
|
||||
include __DIR__ . '/Classes/Welcome.php';
|
||||
|
||||
// including php files
|
||||
include __DIR__ . '/Environment.php';
|
||||
|
|
@ -79,13 +111,7 @@
|
|||
|
||||
// object creation
|
||||
$requirement = new Requirement();
|
||||
$permission = new Permission();
|
||||
$welcome = new Welcome();
|
||||
|
||||
// calling render function for template
|
||||
echo $requirement->render();
|
||||
echo $permission->render();
|
||||
echo $welcome->render();
|
||||
|
||||
$storage_output = exec('cd ../.. && php artisan storage:link 2>&1');
|
||||
} else {
|
||||
|
|
@ -101,4 +127,7 @@
|
|||
// redirecting to 404 error page
|
||||
header("Location: $url");
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue