Intranet: Improved installed tools overview

This commit is contained in:
cytopia 2022-12-18 14:38:19 +01:00
parent 2e33d991b7
commit 48e7133825
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
3 changed files with 288 additions and 126 deletions

View File

@ -36,31 +36,32 @@ if (loadClass('Helper')->isLoggedIn()) {
//
else if (isset($_GET['software'])) {
$no = '<span class="text-danger">not installed</span>';
$no_mod = '<span class="text-warning">PHP module not loaded</span>';
$software = array();
if ($_GET['software'] == 'composer') {
if ($_GET['software'] == 'angular_cli') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getAngularCliVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'asgardcms_installer') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getAsgardCmsInstallerVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'codeception') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getCodeceptionVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'composer') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getComposerVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'drupalc') {
else if ($_GET['software'] == 'deployer') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getDrupalConsoleVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'drush7') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getDrushVersion(7)) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'drush8') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getDrushVersion(8)) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'drush9') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getDrushVersion(9)) !== false) ? $version : $no
$_GET['software'] => (($version = loadClass('Php')->getDeployerVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'git') {
@ -68,9 +69,24 @@ if (loadClass('Helper')->isLoggedIn()) {
$_GET['software'] => (($version = loadClass('Php')->getGitVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'laravel') {
else if ($_GET['software'] == 'grunt_cli') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getLaravelVersion()) !== false) ? $version : $no
$_GET['software'] => (($version = loadClass('Php')->getGruntCliVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'gulp') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getGulpVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'laravel_installer') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getLaravelInstallerVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'laravel_lumen') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getLaravelLumenVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'mds') {
@ -78,6 +94,11 @@ if (loadClass('Helper')->isLoggedIn()) {
$_GET['software'] => (($version = loadClass('Php')->getMdsVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'mupdf_tools') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getMupdfToolsVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'node') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getNodeVersion()) !== false) ? $version : $no
@ -88,20 +109,51 @@ if (loadClass('Helper')->isLoggedIn()) {
$_GET['software'] => (($version = loadClass('Php')->getNpmVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'phalcon') {
else if ($_GET['software'] == 'phalcon_devtools') {
if (!extension_loaded('phalcon')) {
echo json_encode(array(
$_GET['software'] => $no_mod
));
} else {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getPhalconDevtoolsVersion()) !== false) ? $version : $no
));
}
}
else if ($_GET['software'] == 'phpunit') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getPhalconVersion()) !== false) ? $version : $no
$_GET['software'] => (($version = loadClass('Php')->getPhpunitVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'symfony') {
else if ($_GET['software'] == 'stylelint') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getSymfonyVersion()) !== false) ? $version : $no
$_GET['software'] => (($version = loadClass('Php')->getStylelintVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'symfony_cli') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getSymfonyCliVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'vue_cli') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getVueCliVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'webpack_cli') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getWebpackCliVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'wpcli') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getWpcliVersion()) !== false) ? $version : $no
));
}
else if ($_GET['software'] == 'yarn') {
echo json_encode(array(
$_GET['software'] => (($version = loadClass('Php')->getYarnVersion()) !== false) ? $version : $no
));
} else {
echo json_encode(array($_GET['software'] => 'unknown software'));
}

View File

@ -334,10 +334,117 @@ $HEALTH_PERCENT = 100 - ceil(100 * $HEALTH_FAILS / $HEALTH_TOTAL);
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 col-margin">
<div class="dash-box">
<div class="dash-box-head"><i class="fa fa-info-circle" aria-hidden="true"></i> PHP Container Setup</div>
<div class="dash-box-head"><i class="fa fa-info-circle" aria-hidden="true"></i> Available CLI Tools</div>
<div class="dash-box-body">
<p><small>You can also enter the php container via <code style="background-color:#3d3d3d;">./shell.sh</code> and use the following cli tools:</small></p>
<table class="table table-striped table-hover table-bordered table-sm font-small">
<thead class="thead-inverse">
<tr>
<th colspan="2">Tools</th>
</tr>
</thead>
<tbody>
<tr>
<th>Angular Cli</th>
<td id="app_angular_cli"></td>
</tr>
<tr>
<th>AsgardCMS Installer</th>
<td id="app_asgardcms_installer"></td>
</tr>
<tr>
<th>Codeception</th>
<td id="app_codeception"></td>
</tr>
<tr>
<th>Composer</th>
<td id="app_composer"></td>
</tr>
<tr>
<th>Deployer</th>
<td id="app_deployer"></td>
</tr>
<tr>
<th>Git</th>
<td id="app_git"></td>
</tr>
<tr>
<th>Grunt Cli</th>
<td id="app_grunt_cli"></td>
</tr>
<tr>
<th>Gulp</th>
<td id="app_gulp"></td>
</tr>
<tr>
<th>Laravel Installer</th>
<td id="app_laravel_installer"></td>
</tr>
<tr>
<th>Laravel Lumen</th>
<td id="app_laravel_lumen"></td>
</tr>
<tr>
<th>Mupdf Tools</th>
<td id="app_mupdf_tools"></td>
</tr>
<tr>
<th>mysqldump-secure</th>
<td id="app_mds"></td>
</tr>
<tr>
<th>Node</th>
<td id="app_node"></td>
</tr>
<tr>
<th>Npm</th>
<td id="app_npm"></td>
</tr>
<tr>
<th>Phalcon Devtools</th>
<td id="app_phalcon_devtools"></td>
</tr>
<tr>
<th>Phpunit</th>
<td id="app_phpunit"></td>
</tr>
<tr>
<th>Stylelint</th>
<td id="app_stylelint"></td>
</tr>
<tr>
<th>Symfony Cli</th>
<td id="app_symfony_cli"></td>
</tr>
<tr>
<th>Vue Cli</th>
<td id="app_vue_cli"></td>
</tr>
<tr>
<th>Webpack Cli</th>
<td id="app_webpack_cli"></td>
</tr>
<tr>
<th>Wordpress Cli</th>
<td id="app_wpcli"></td>
</tr>
<tr>
<th>Yarn</th>
<td id="app_yarn"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 offset-lg-4 offset-md-0 offset-sm-0 col-margin">
<div class="dash-box">
<div class="dash-box-head"><i class="fa fa-info-circle" aria-hidden="true"></i> PHP Container Status</div>
<div class="dash-box-body">
<p><small>You have made the following base configuration to the Devilbox:</small></p>
<table class="table table-striped table-hover table-bordered table-sm font-small">
<p><small>You can also enter the php container and work from inside. The following is available inside the container:</small></p>
<thead class="thead-inverse">
<tr>
<th colspan="2">Settings</th>
@ -374,78 +481,7 @@ $HEALTH_PERCENT = 100 - ceil(100 * $HEALTH_FAILS / $HEALTH_TOTAL);
</tr>
</tbody>
</table>
<table class="table table-striped table-hover table-bordered table-sm font-small">
<thead class="thead-inverse">
<tr>
<th colspan="2">Tools</th>
</tr>
</thead>
<tbody>
<tr>
<th>composer</th>
<td id="app_composer"></td>
</tr>
<tr>
<th>drupal-console</th>
<td id="app_drupalc"></td>
</tr>
<tr>
<th>drush7</th>
<td id="app_drush7"></td>
</tr>
<tr>
<th>drush8</th>
<td id="app_drush8"></td>
</tr>
<tr>
<th>drush9</th>
<td id="app_drush9"></td>
</tr>
<tr>
<th>git</th>
<td id="app_git"></td>
</tr>
<tr>
<th>Laravel installer</th>
<td id="app_laravel"></td>
</tr>
<tr>
<th>mysqldump-secure</th>
<td id="app_mds"></td>
</tr>
<tr>
<th>node</th>
<td id="app_node"></td>
</tr>
<tr>
<th>npm</th>
<td id="app_npm"></td>
</tr>
<tr>
<th>Phalcon devtools</th>
<td id="app_phalcon"></td>
</tr>
<tr>
<th>Symfony installer</th>
<td id="app_symfony"></td>
</tr>
<tr>
<th>Wordpress cli</th>
<td id="app_wpcli"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 offset-lg-4 offset-md-0 offset-sm-0 col-margin">
<div class="dash-box">
<div class="dash-box-head"><i class="fa fa-info-circle" aria-hidden="true"></i> PHP Container Status</div>
<div class="dash-box-body">
<p><small>The PHP Docker can connect to the following services via the specified hostnames and IP addresses.</small></p>
<p><small>The PHP container can connect to the following services via the specified hostnames and IP addresses.</small></p>
<table class="table table-striped table-hover table-bordered table-sm font-small">
<thead class="thead-inverse">
<tr>
@ -913,19 +949,28 @@ $HEALTH_PERCENT = 100 - ceil(100 * $HEALTH_FAILS / $HEALTH_TOTAL);
xhttp.open('GET', '_ajax_callback.php?software='+app, true);
xhttp.send();
}
updateVersions('angular_cli');
updateVersions('asgardcms_installer');
updateVersions('codeception');
updateVersions('composer');
updateVersions('drupalc');
updateVersions('drush7');
updateVersions('drush8');
updateVersions('drush9');
updateVersions('deployer');
updateVersions('git');
updateVersions('laravel');
updateVersions('grunt_cli');
updateVersions('gulp');
updateVersions('laravel_installer');
updateVersions('laravel_lumen');
updateVersions('mds');
updateVersions('mupdf_tools');
updateVersions('node');
updateVersions('npm');
updateVersions('phalcon');
updateVersions('symfony');
updateVersions('phalcon_devtools');
updateVersions('phpunit');
updateVersions('stylelint');
updateVersions('symfony_cli');
updateVersions('vue_cli');
updateVersions('webpack_cli');
updateVersions('wpcli');
updateVersions('yarn');
})();
</script>
</body>

View File

@ -35,9 +35,19 @@ class Php extends BaseClass implements BaseInterface
$uid = loadClass('Helper')->egrep('/[0-9]+/', $uid);
return $uid;
}
public function getGitVersion()
public function getAngularCliVersion()
{
$output = loadClass('Helper')->exec('git --version 2>/dev/null', $output);
$output = loadClass('Helper')->exec('ng version 2>/dev/null | grep -i "^Angular CLI" | head -1', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getAsgardCmsInstallerVersion()
{
$output = loadClass('Helper')->exec('asgardcms --version --no-ansi 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getCodeceptionVersion()
{
$output = loadClass('Helper')->exec('codecept --version --no-ansi 2>/dev/null | grep -i ^Codecept', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getComposerVersion()
@ -45,15 +55,45 @@ class Php extends BaseClass implements BaseInterface
$output = loadClass('Helper')->exec('composer --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getDrushVersion($version)
public function getDeployerVersion()
{
$output = loadClass('Helper')->exec('drush'.$version.' --version 2>/dev/null', $output);
$output = loadClass('Helper')->exec('dep --version --no-ansi 2>/dev/null | grep -i ^Deploy', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getDrupalConsoleVersion()
public function getGitVersion()
{
$output = loadClass('Helper')->exec('drupal --version 2>/dev/null | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"', $output);
return loadClass('Helper')->egrep('/[0-9.]+[-rc0-9.]*/', $output);
$output = loadClass('Helper')->exec('git --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getGruntCliVersion()
{
$output = loadClass('Helper')->exec('grunt --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getGulpVersion()
{
$output = loadClass('Helper')->exec('gulp --version --no-color 2>/dev/null | head -1', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getLaravelInstallerVersion()
{
$output = loadClass('Helper')->exec('laravel --version --no-ansi 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getLaravelLumenVersion()
{
$output = loadClass('Helper')->exec('lumen --version --no-ansi 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getMdsVersion()
{
$output = loadClass('Helper')->exec('mysqldump-secure --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getMupdfToolsVersion()
{
$output = loadClass('Helper')->exec('mutool -v 2>&1', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getNodeVersion()
{
@ -65,31 +105,56 @@ class Php extends BaseClass implements BaseInterface
$output = loadClass('Helper')->exec('npm --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getLaravelVersion()
{
$output = loadClass('Helper')->exec('laravel --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getMdsVersion()
{
$output = loadClass('Helper')->exec('mysqldump-secure --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getPhalconVersion()
public function getPhalconDevtoolsVersion()
{
$output = loadClass('Helper')->exec('phalcon --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getSymfonyVersion()
public function getPhpunitVersion()
{
$output = loadClass('Helper')->exec('phpunit --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getStylelintVersion()
{
$output = loadClass('Helper')->exec('stylelint --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getSymfonyCliVersion()
{
$output = loadClass('Helper')->exec('symfony -V 2>/dev/null | tr -d "[:cntrl:]" | sed "s/\[[0-9]*m//g"', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getWpcliVersion()
public function getVueCliVersion()
{
$output = loadClass('Helper')->exec('wp --version 2>/dev/null', $output);
$output = loadClass('Helper')->exec('vue --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getWebpackCliVersion()
{
$output = loadClass('Helper')->exec('webpack-cli --version --no-stats --no-target --no-watch --no-color 2>/dev/null | grep webpack-cli', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getWpcliVersion()
{
$output = loadClass('Helper')->exec('wp --version 2>/dev/null | grep -i ^WP', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
public function getYarnVersion()
{
$output = loadClass('Helper')->exec('yarn --version 2>/dev/null', $output);
return loadClass('Helper')->egrep('/[0-9.]+/', $output);
}
//public function getDrushVersion($version)
//{
// $output = loadClass('Helper')->exec('drush'.$version.' --version 2>/dev/null', $output);
// return loadClass('Helper')->egrep('/[0-9.]+/', $output);
//}
//public function getDrupalConsoleVersion()
//{
// $output = loadClass('Helper')->exec('drupal --version 2>/dev/null | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"', $output);
// return loadClass('Helper')->egrep('/[0-9.]+[-rc0-9.]*/', $output);
//}