From 48e71338253c5965eb5f2cb9e7ccea5c5fc315d4 Mon Sep 17 00:00:00 2001 From: cytopia Date: Sun, 18 Dec 2022 14:38:19 +0100 Subject: [PATCH] Intranet: Improved installed tools overview --- .devilbox/www/htdocs/_ajax_callback.php | 100 +++++++--- .devilbox/www/htdocs/index.php | 207 ++++++++++++-------- .devilbox/www/include/lib/container/Php.php | 107 ++++++++-- 3 files changed, 288 insertions(+), 126 deletions(-) diff --git a/.devilbox/www/htdocs/_ajax_callback.php b/.devilbox/www/htdocs/_ajax_callback.php index d6ae14d0..c7f9ef3b 100644 --- a/.devilbox/www/htdocs/_ajax_callback.php +++ b/.devilbox/www/htdocs/_ajax_callback.php @@ -36,31 +36,32 @@ if (loadClass('Helper')->isLoggedIn()) { // else if (isset($_GET['software'])) { $no = 'not installed'; + $no_mod = 'PHP module not loaded'; $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')); } diff --git a/.devilbox/www/htdocs/index.php b/.devilbox/www/htdocs/index.php index 6c185489..ff0f30c1 100644 --- a/.devilbox/www/htdocs/index.php +++ b/.devilbox/www/htdocs/index.php @@ -334,10 +334,117 @@ $HEALTH_PERCENT = 100 - ceil(100 * $HEALTH_FAILS / $HEALTH_TOTAL);
-
PHP Container Setup
+
Available CLI Tools
+

You can also enter the php container via ./shell.sh and use the following cli tools:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tools
Angular Cli
AsgardCMS Installer
Codeception
Composer
Deployer
Git
Grunt Cli
Gulp
Laravel Installer
Laravel Lumen
Mupdf Tools
mysqldump-secure
Node
Npm
Phalcon Devtools
Phpunit
Stylelint
Symfony Cli
Vue Cli
Webpack Cli
Wordpress Cli
Yarn
+ +
+
+
+ +
+
+
PHP Container Status
+
+

You have made the following base configuration to the Devilbox:

-

You can also enter the php container and work from inside. The following is available inside the container:

@@ -374,78 +481,7 @@ $HEALTH_PERCENT = 100 - ceil(100 * $HEALTH_FAILS / $HEALTH_TOTAL);
Settings
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tools
composer
drupal-console
drush7
drush8
drush9
git
Laravel installer
mysqldump-secure
node
npm
Phalcon devtools
Symfony installer
Wordpress cli
- -
-
-
- -
-
-
PHP Container Status
-
-

The PHP Docker can connect to the following services via the specified hostnames and IP addresses.

+

The PHP container can connect to the following services via the specified hostnames and IP addresses.

@@ -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'); })(); diff --git a/.devilbox/www/include/lib/container/Php.php b/.devilbox/www/include/lib/container/Php.php index 44d357d5..ce78160c 100644 --- a/.devilbox/www/include/lib/container/Php.php +++ b/.devilbox/www/include/lib/container/Php.php @@ -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); + //}