Skip to content

Commit 6a3bd4a

Browse files
committed
v 0.119.2
- Common : Harden multisite detection. - Sample : Fix min number of samples.
1 parent f1e20fd commit 6a3bd4a

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

inc/functions.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,12 @@ function wputools_is_wp_installed(){
329329
###################################
330330

331331
function wputools_select_multisite(){
332-
local _WPUTOOLS_MULTISITE=$(_WPCLICOMMAND config get SITE_ID_CURRENT_SITE);
333-
if [[ "${_WPUTOOLS_MULTISITE}" == "" ]];then
334-
return;
332+
local wputools_wp_config_path=$(wputools__get_wp_config_path);
333+
if ! grep -q "SITE_ID_CURRENT_SITE" "${wputools_wp_config_path}"; then
334+
return;
335+
fi;
336+
if [[ $(_WPCLICOMMAND config get SITE_ID_CURRENT_SITE) == "" ]];then
337+
return;
335338
fi;
336339
# List all sites home URLs
337340
echo "Multiple sites detected. Please choose one site to continue:"

tools/sample.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
$_posttype = esc_html($_GET['sample_posttype']);
3535
}
3636
}
37+
$_samples_nb_min = max(1, $_samples_nb);
3738

3839
switch ($_posttype) {
3940
case 'comments':
@@ -206,7 +207,7 @@
206207
if (in_array($tax_name, array('post_format', 'post_translations', 'language'))) {
207208
continue;
208209
}
209-
$nb_tax = mt_rand(2, min($_samples_nb, 10));
210+
$nb_tax = mt_rand($_samples_nb_min, min($_samples_nb, 10));
210211
$nb_start = mt_rand(1, $nb_tax);
211212
for ($y = $nb_start; $y <= $nb_tax; $y++) {
212213
wp_set_object_terms($post_id, $tax_name . ' ' . $y, $tax_name, true);

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.119.1';
5+
local _WPUTOOLS_VERSION='0.119.2';
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)