Skip to content

Commit d7e1c6e

Browse files
committed
v 0.121.0
Updated PHP version check to require at least 8.0 Diagnostic : - better detect file permission modes. - Help on some commands - stop if WordPress is not correctly loaded.
1 parent f174c75 commit d7e1c6e

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

tools/diagnostic/inc/0-env.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
-------------------------- */
2828

2929
$phpversion = phpversion();
30-
if (version_compare($phpversion, '7.4.33', '<')) {
30+
if (version_compare($phpversion, '8.0', '<')) {
3131
$wputools_errors[] = sprintf('PHP version %s is too old !', $phpversion);
3232
}
33-
else if (version_compare($phpversion, '8.0', '<')) {
33+
else if (version_compare($phpversion, '8.2', '<')) {
3434
$wputools_notices[] = sprintf('PHP version %s is getting old.', $phpversion);
3535
}

tools/diagnostic/inc/10-files.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,20 @@ function glob_recursive($pattern, $flags = 0) {
142142
---------------------------------------------------------- */
143143

144144
$chmod_items = array(
145-
'../wp-config.php' => '0644',
146-
'.htaccess' => '0644',
147-
'wp-config.php' => '0644',
148-
'wp-content' => '0755',
149-
'wp-content/uploads' => '0755',
150-
'wp-content/uploads/' . date('Y') => '0755'
145+
'../wp-config.php' => '644',
146+
'.htaccess' => '644',
147+
'wp-config.php' => '644',
148+
'wp-content' => '755',
149+
'wp-content/uploads' => '755',
150+
'wp-content/uploads/' . date('Y') => '755'
151151
);
152152

153153
foreach ($chmod_items as $item => $mode) {
154154
if (!is_dir($item) && !is_file($item)) {
155155
continue;
156156
}
157157
$file_type = is_dir($item) ? 'folder' : 'file';
158-
$current_mode = substr(sprintf('%o', fileperms($item)), -4);
158+
$current_mode = substr(sprintf('%o', fileperms($item)), -3);
159159
if ($current_mode != $mode) {
160160
$wputools_errors[] = sprintf('The %s %s should have the %s mode !', $file_type, $item, $mode);
161161
}

tools/diagnostic/inc/40-wordpress.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
-------------------------- */
3434

3535
if (!function_exists('get_option')) {
36-
$wputools_errors[] = 'WordPress is not correctly loaded.';
36+
$wputools_errors[] = 'WordPress is not correctly loaded';
37+
return;
3738
}
3839

3940
/* Database
@@ -42,6 +43,7 @@
4243
global $wpdb;
4344
if (!is_object($wpdb) || !$wpdb->check_connection()) {
4445
$wputools_errors[] = 'WordPress : The database is not available.';
46+
return;
4547
}
4648

4749
/* Debug
@@ -330,7 +332,7 @@ function wputools_diagnostic_check_domain_is_preproduction($domainName) {
330332
$php_constants = array('WP_CACHE_KEY_SALT');
331333
foreach ($php_constants as $constant) {
332334
if (!defined($constant)) {
333-
$wputools_errors[] = sprintf('WordPress : the constant %s should be defined.', $constant);
335+
$wputools_errors[] = sprintf('WordPress : the constant %s should be defined : wputools wp config shuffle-salts WP_CACHE_KEY_SALT --force', $constant);
334336
}
335337
}
336338

wputools.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
WPUTools(){
44

5-
local _WPUTOOLS_VERSION='0.120.1';
5+
local _WPUTOOLS_VERSION='0.121.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)
@@ -57,7 +57,7 @@ fi;
5757
###################################
5858

5959
# Load default PHP command
60-
local _PHP_POSSIBLE_COMMANDS=("/usr/local/php8.0/bin/php" "/usr/local/php8.1/bin/php" "/usr/local/php8.2/bin/php" "/opt/php/bin/php");
60+
local _PHP_POSSIBLE_COMMANDS=("/usr/local/php8.0/bin/php" "/usr/local/php8.1/bin/php" "/usr/local/php8.2/bin/php" "/usr/local/php8.3/bin/php" "/opt/php/bin/php");
6161
if ! command -v $_PHP_COMMAND &> /dev/null; then
6262
for _PHP_POSSIBLE_COMMAND in "${_PHP_POSSIBLE_COMMANDS[@]}"; do
6363
if [[ -f "${_PHP_POSSIBLE_COMMAND}" ]]; then

0 commit comments

Comments
 (0)