This commit is contained in:
rahul shukla 2019-03-29 11:59:29 +05:30
parent 12a8a91476
commit 047ae3934e
4 changed files with 42 additions and 23 deletions

View File

@ -116,6 +116,30 @@ class Requirement {
];
}
/**
* Check composer installation.
*
* @return array
*/
public function composerInstall()
{
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$autoLoadFile = $desiredLocation . '/' . 'vendor' . '/' . 'autoload.php';
if (file_exists($autoLoadFile)) {
$data['composer_install'] = 0;
} else {
$data['composer_install'] = 1;
$data['composer'] = 'Composer dependencies is not Installed.Go to root of project, run "composer install" command to install composer dependencies & refresh page again.';
}
return $data;
}
/**
* Render view for class.
*
@ -126,6 +150,8 @@ class Requirement {
$phpVersion = $this->checkPHPversion();
$composerInstall = $this->composerInstall();
ob_start();
include __DIR__ . '/../Views/requirements.blade.php';

View File

@ -1,25 +1,7 @@
<?php
// array to pass back data
$data = array();
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$autoLoadFile = $desiredLocation . '/' . 'vendor' . '/' . 'autoload.php';
if (file_exists($autoLoadFile)) {
$data['install'] = 0;
} else {
$data['install'] = 1;
$data['composer'] = 'Composer dependencies is not Installed.Go to root of project, run "composer install" command to install composer dependencies & refresh page again.';
}
// return a response
//return all our data to an AJAX call
$data['install'] = 0;
echo json_encode($data);

View File

@ -75,9 +75,6 @@
<div style="text-align: center;">
<span> Click the below button to run following : </span>
</div>
<div class="message" style="margin-top: 20px">
<span> Check Composer dependency </span>
</div>
<div class="message">
<span>Database Migartion </span>
</div>

View File

@ -39,9 +39,23 @@
<?php endforeach; ?>
<?php endforeach; ?>
<php class="check" style="margin-left: 25%">
<?php if(($composerInstall['composer_install'] == 0) ? $src = $greenCheck : $src = $redCheck ): ?>
<img src="<?php echo $src ?>">
<span style="margin-left: 10px"><b>Composer</b></span>
<?php endif; ?>
</php>
<div style="margin-left: 30%;">
<?php if(!($composerInstall['composer_install'] == 0)): ?>
<span style="margin-left: 10px; color: red;"><?php echo $composerInstall['composer'] ?></span>
<?php endif; ?>
</div>
</div>
<?php if(!isset($requirements['errors']) && $phpVersion['supported']): ?>
<?php if(!isset($requirements['errors']) && ($phpVersion['supported'] && $composerInstall['composer_install'] == 0)): ?>
<div>
<button type="button" class="prepare-btn" id="requirement-check">Continue</button>
</div>