Skip to content

Commit 5ea8e42

Browse files
committed
v 0.120.0
Diagnostic : - Check chmod of some files
1 parent 6a3bd4a commit 5ea8e42

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

tools/diagnostic/inc/10-files.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,27 @@ function glob_recursive($pattern, $flags = 0) {
136136
}
137137
$wputools_errors[] = sprintf('The file %s should not be present in the uploads directory !', $file);
138138
}
139+
140+
/* ----------------------------------------------------------
141+
Check chmod of some files
142+
---------------------------------------------------------- */
143+
144+
$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'
151+
);
152+
153+
foreach ($chmod_items as $item => $mode) {
154+
if (!is_dir($item) && !is_file($item)) {
155+
continue;
156+
}
157+
$file_type = is_dir($item) ? 'folder' : 'file';
158+
$current_mode = substr(sprintf('%o', fileperms($item)), -4);
159+
if ($current_mode != $mode) {
160+
$wputools_errors[] = sprintf('The %s %s should have the %s mode !', $file_type, $item, $mode);
161+
}
162+
}

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