Site Health: Check if the directories are allowed when testing for a VCS checkout.
As part of determining whether to perform automatic updates, WordPress checks if it is running within a version-controlled environment, recursively looking up the filesystem to the top of the drive, looking for a Subversion, Git, Mercurial, or Bazaar directory, erring on the side of detecting a VCS checkout somewhere. This commit reuses `WP_Automatic_Updater::is_allowed_dir()` in the Site Health test to avoid a PHP warning if the `open_basedir` directive is in use and any of the directories checked in the process are not allowed: {{{ is_dir(): open_basedir restriction in effect. File(/.git) is not within the allowed path(s) }}} Follow-up to [44986], [55425]. Props Keffr3n, narenin. Fixes #61834. Built from https://develop.svn.wordpress.org/trunk@58921 git-svn-id: http://core.svn.wordpress.org/trunk@58317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
337bee97b7
commit
cddaa30f95
|
@ -224,12 +224,18 @@ class WP_Site_Health_Auto_Updates {
|
|||
}
|
||||
|
||||
$check_dirs = array_unique( $check_dirs );
|
||||
$updater = new WP_Automatic_Updater();
|
||||
$checkout = false;
|
||||
|
||||
// Search all directories we've found for evidence of version control.
|
||||
foreach ( $vcs_dirs as $vcs_dir ) {
|
||||
foreach ( $check_dirs as $check_dir ) {
|
||||
// phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition,Squiz.PHP.DisallowMultipleAssignments
|
||||
if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) {
|
||||
if ( ! $updater->is_allowed_dir( $check_dir ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$checkout = is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" );
|
||||
if ( $checkout ) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-alpha-58920';
|
||||
$wp_version = '6.7-alpha-58921';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue