Skip to content

Commit 262cde0

Browse files
committed
v 0.144.0
Help : do not load extensions title if empty. Multisite command : use blog_id arg if available.
1 parent 98ee12e commit 262cde0

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

bin/help.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ wputools wpuwoo; # Execute a WPU Woo Import Export Task.
4343
EOF
4444

4545

46-
if [ -d "${_SOURCEDIR}extensions" ] && [ "$(ls -A "${_SOURCEDIR}extensions")" ]; then
46+
if [ -d "${_SOURCEDIR}extensions" ] && [ "$(ls -A "${_SOURCEDIR}extensions")" ] && [ -n "$(find "${_SOURCEDIR}extensions" -mindepth 1 -type d -print -quit)" ] ; then
4747
echo "# Extensions"
4848
for dir in "${_SOURCEDIR}extensions"/*/; do
4949
if [[ -d "$dir" ]]; then

inc/functions.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,9 @@ function wputools_select_multisite(){
366366
local _wputools_sites=($(wputools_get_multisite_urls));
367367
local _tmp_home_url="";
368368

369-
# If an argument named url exists, use it
370369
for arg in "$@"; do
370+
371+
# If an argument named url exists, use it
371372
if [[ "$arg" == *-url=* ]]; then
372373

373374
# Clean argument
@@ -382,6 +383,19 @@ function wputools_select_multisite(){
382383
fi
383384
done
384385
fi
386+
387+
# If an argument named blog_id exists, use it
388+
if [[ "$arg" == *-blog_id=* ]]; then
389+
local _tmp_blog_id="${arg#*-blog_id=}";
390+
if wputools_is_website_id_valid "$_tmp_blog_id"; then
391+
_HOME_URL=$(_WPCLICOMMAND site list --fields=blog_id,url --format=csv | awk -F',' -v id="$_tmp_blog_id" '$1==id {print $2}');
392+
echo "Site URL set to ${_HOME_URL} from argument.";
393+
return;
394+
else
395+
echo "The blog_id '$_tmp_blog_id' is not valid.";
396+
fi
397+
fi
398+
385399
done
386400

387401

wputools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
WPUTools(){
44

5-
local _WPUTOOLS_VERSION='0.143.0';
5+
local _WPUTOOLS_VERSION='0.144.0';
66
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)
77
local _PHP_VERSIONS_OBSOLETES=(7.0 7.1 7.2 7.3 7.4 8.0)
88
local _PHP_VERSIONS_ADVANCED=(8.3 8.4 8.5 9.0)

0 commit comments

Comments
 (0)