Skip to content

Commit

Permalink
v 0.99.2
Browse files Browse the repository at this point in the history
Diagnostic :
- Better diagnostic when calling web version from cli.
- More call options.
  • Loading branch information
Darklg committed Aug 4, 2024
1 parent 01c8d6a commit 057ee8f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
14 changes: 9 additions & 5 deletions bin/diagnostic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ chmod 0644 "${_WPUDIAG_PATH}";
###################################

# Direct launch
if [[ "${1}" == 'now' ]];then
if [[ "${1}" == 'now' || "${1}" == 'cli' || "${1}" == 'web' ]];then
echo "";
echo "### Diagnostic CLI";
$_PHP_COMMAND "${_WPUDIAG_FILE}";
echo "### Diagnostic WEB";
wputools_call_url "${_HOME_URL}/${_WPUDIAG_FILE}?from_cli=1";
if [[ "${1}" == 'cli' || "${1}" == 'now' ]];then
echo "### Diagnostic CLI";
$_PHP_COMMAND "${_WPUDIAG_FILE}";
fi;
if [[ "${1}" == 'web' || "${1}" == 'now' ]];then
echo "### Diagnostic WEB";
wputools_call_url "${_HOME_URL}/${_WPUDIAG_FILE}";
fi;
echo "### END";
rm "${_WPUDIAG_FILE}";
else
Expand Down
2 changes: 1 addition & 1 deletion inc/autocomplete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ _wputools_complete() {
COMPREPLY=( $(compgen -W "all opcache wprocket w3tc transient fvm object url purge-cli" -- $cur) )
;;
"diagnostic")
COMPREPLY=( $(compgen -W "code-profiler now view" -- $cur) )
COMPREPLY=( $(compgen -W "code-profiler cli now view web" -- $cur) )
;;
"go")
COMPREPLY=( $(compgen -W "current_theme mu-plugins plugins themes uploads" -- $cur) )
Expand Down
3 changes: 2 additions & 1 deletion tools/diagnostic/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
Vars
---------------------------------------------------------- */

$wputools_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$wputools_is_cli = php_sapi_name() == 'cli';
$wputools_is_public = $wputools_is_cli || isset($_GET['from_cli']);
$wputools_is_public = $wputools_is_cli || isset($_GET['from_cli']) || (strpos($wputools_user_agent, 'curl') !== false);
$wputools_errors = array();

/* ----------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion wputools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

WPUTools(){

local _WPUTOOLS_VERSION='0.99.1';
local _WPUTOOLS_VERSION='0.99.2';
local _PHP_VERSIONS=(7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5 9.0)
local _PHP_VERSIONS_OBSOLETES=(7.0 7.1 7.2 7.3 7.4 8.0)
local _PHP_VERSIONS_ADVANCED=(8.2 8.3 8.4 8.5 9.0)
Expand Down

0 comments on commit 057ee8f

Please sign in to comment.