Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back rollback PRs #2225

Closed
wants to merge 153 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
adf8355
Add back rollback PRs
afragen Jan 25, 2022
b486803
tab and spaces
afragen Jan 25, 2022
b360741
copy/paste tabs/spaces
afragen Jan 25, 2022
07313a0
hopefully fixed tab/spaces issue
afragen Jan 25, 2022
fee5de9
tried running through phpcbf
afragen Jan 25, 2022
262f659
Simplify the free disk space check
SergeyBiryukov Feb 15, 2022
493a99a
Correct the logic in move_dir()
SergeyBiryukov Feb 15, 2022
d19c3fd
Don't pass an extra argument to move_dir()
SergeyBiryukov Feb 15, 2022
ba94fac
Simplify the 'clear_working' logic
SergeyBiryukov Feb 15, 2022
482886a
Always return a WP_Error on failure in move_dir()
SergeyBiryukov Feb 15, 2022
83c0233
Revert the early return; fall back to copy_dir()
SergeyBiryukov Feb 15, 2022
67ab8f0
Use $wp_filesystem->move() in move_dir()
SergeyBiryukov Feb 16, 2022
ab68649
Remove $wp_filesystem->is_virtual_box() for now
SergeyBiryukov Feb 16, 2022
e05a9a7
Fix WPCS issue
SergeyBiryukov Feb 16, 2022
2b48ff3
Restore rename(); move() fallback is non-recursive
SergeyBiryukov Feb 17, 2022
028c2e4
add `wp_get_runtime_environment()`
afragen Feb 27, 2022
93ac595
oops, copy/paste too much
afragen Feb 27, 2022
c057a94
Adjust some docs
SergeyBiryukov Mar 1, 2022
3139a30
add additional runtime environments
afragen Mar 1, 2022
e991386
update docblock
afragen Mar 1, 2022
770fb1e
only allow 'virtualbox' as value at this time, default ''
afragen Mar 2, 2022
05a4dcc
Adjust some docs
SergeyBiryukov Mar 3, 2022
fb70bb9
Fix HTML errors in the get_test_available_updates_disk_space() and ge…
pbiron Mar 6, 2022
2c4e720
Add `WP_RUNTIME_ENVIRONMENT` to the `WordPress Contents` section of t…
pbiron Mar 6, 2022
2beaa8e
include @pbiron's updates
afragen Mar 6, 2022
65b39c7
Merge remote-tracking branch 'upstream/trunk' into rollback
SergeyBiryukov Mar 6, 2022
c1bf50d
Ensure the temp-backup and restore works when WP_Filesystem::$method …
pbiron Mar 8, 2022
94960af
Merge branch 'rollback' of https://github.com/afragen/wordpress-devel…
pbiron Mar 8, 2022
79c1cfd
Update src/wp-admin/includes/class-wp-upgrader.php
afragen Mar 9, 2022
cea0087
Update src/wp-admin/includes/class-wp-upgrader.php
afragen Mar 9, 2022
05c7983
update docblock for $args array
afragen Mar 9, 2022
0b76554
add remove_action example to comment
afragen Mar 9, 2022
91266d7
5 space indent
afragen Mar 9, 2022
b2bb225
missed one
afragen Mar 9, 2022
26dc49e
make variable for 2 identical calls, cast as array
afragen Mar 12, 2022
6c0d28d
exclude key from empty array
afragen Mar 12, 2022
a310b42
make static
afragen Mar 12, 2022
b13a263
consistency
afragen Mar 13, 2022
b6b9d77
remove cast, add guard, remove check inside foreach
afragen Mar 13, 2022
8cf1717
use $wp_filesystem->move() for non-direct filesystems
afragen Mar 15, 2022
6b75ff9
Revert "use $wp_filesystem->move() for non-direct filesystems"
afragen Mar 15, 2022
7551c6b
Update src/wp-admin/includes/class-wp-site-health.php
afragen Mar 16, 2022
2546076
Update src/wp-includes/update.php
afragen Mar 16, 2022
91e4538
wrap in code tag
afragen Mar 17, 2022
546be25
store $options as private variable
afragen Mar 17, 2022
8471773
make private functions instead of anonymous functions as callback
afragen Mar 17, 2022
d5b77b3
Merge remote-tracking branch 'afragen/rollback' into rollback
afragen Mar 17, 2022
74383db
wrap remaining instances of 'temp-backup' in code tags
afragen Mar 17, 2022
21ce71b
Update src/wp-includes/load.php
afragen Mar 17, 2022
36fdb0b
improve comment language
afragen Mar 17, 2022
0af20ed
Merge remote-tracking branch 'afragen/rollback' into rollback
afragen Mar 17, 2022
acb3af0
check for $wp_filesystem->wp_content_dir()
afragen Mar 17, 2022
5bc5f03
Callbacks must be in public scope
afragen Mar 17, 2022
3c6f187
don't use <code> tag in label, it doesn't convert
afragen Mar 17, 2022
68d99b6
update comments
afragen Mar 17, 2022
4da955d
simply to just require_once
afragen Mar 17, 2022
c8d011f
no need for extra callback function
afragen Mar 20, 2022
07a6b62
eliminate contractions
afragen Mar 22, 2022
4f67620
add runtime environment to Site Health WordPress data
afragen Mar 27, 2022
f78068a
fallback if WP_RUNTIME_ENVIRONMENT constant and env variable are set
afragen Mar 27, 2022
ad94ef2
exit earlier if mismatch
afragen Mar 27, 2022
23a3f6a
unnecessary assignments
afragen Mar 27, 2022
fcc11de
update comments.
afragen Mar 27, 2022
13a7373
simplify variable declaration
afragen Mar 28, 2022
03f6055
update comment
afragen Mar 28, 2022
5218153
move to wp-server info
afragen Mar 28, 2022
9f4df74
also put in wp-core
afragen Mar 28, 2022
a8985a7
Update src/wp-includes/load.php
afragen Mar 28, 2022
999ef39
update docblock
afragen Mar 28, 2022
eb91389
more opinionated, default to environment variable if present
afragen Mar 29, 2022
88b7dd0
put in_array check in conditional
afragen Mar 29, 2022
9ed6f4c
follow pattern in core to check for false
afragen Mar 29, 2022
fa487ef
don't need extra check as it's done already
afragen Mar 29, 2022
e64a906
remove WP_RUNTIME_ENVIRONMENT
afragen Mar 31, 2022
4159d5e
add is_virtualbox() with code check and filter
afragen Mar 31, 2022
31bbd88
Merge branch 'trunk' into rollback
afragen Mar 31, 2022
55458f4
use static variable for performance
afragen Mar 31, 2022
ca59139
oops
afragen Mar 31, 2022
47933c8
don't clear working directory inside of move_dir()
afragen Apr 5, 2022
442c2d3
Merge branch 'trunk' into rollback
afragen Apr 5, 2022
7eb1ab4
add back clearing of $working_dir
afragen Apr 9, 2022
58a7e1d
Deleting inside of move_dir() is problematic for rollback
afragen Apr 9, 2022
c1405d8
add $skip_list item to copy_dir()
afragen Apr 14, 2022
0b892c2
Merge branch 'trunk' into rollback
afragen Apr 14, 2022
cbbc839
update @since
afragen Apr 23, 2022
f121f17
use filesystem rename for non-direct filesystems
afragen May 4, 2022
a0630a2
Merge branch 'WordPress:trunk' into non-direct-rollback
afragen May 4, 2022
fe5d532
Merge branch 'WordPress:trunk' into rollback
afragen May 4, 2022
2d85876
use filesystem rename for non-direct filesystems
afragen May 4, 2022
6232186
Merge remote-tracking branch 'afragen/non-direct-rollback' into non-d…
afragen May 4, 2022
4057a3b
add proper docblock to filter
afragen May 14, 2022
3d97715
Update src/wp-includes/functions.php
afragen May 15, 2022
b29bc00
Merge branch 'trunk' into rollback
afragen Jun 7, 2022
016918c
Move VirtualBox info after server info
SergeyBiryukov Jun 7, 2022
8e514cf
Adjust documentation for is_virtualbox()
SergeyBiryukov Jun 7, 2022
3378400
add back delete to move_dir()
afragen Jun 11, 2022
bafdfd9
remove is_virtualbox and add pre_move_dir and post_move_dir hooks
afragen Jun 11, 2022
9e73175
fix issue with bulk plugin updates not removing plugins from temp-backup
afragen Jun 11, 2022
b175165
Merge branch 'WordPress:trunk' into rollback-watcher
afragen Jun 11, 2022
a90057a
don't return
afragen Jun 11, 2022
af36bef
revert
afragen Jun 11, 2022
cc9fdd0
keep for now
afragen Jun 11, 2022
91c1d77
add to $temp_backups if not WP_Error
afragen Jun 11, 2022
3d07f9f
update error messaging in delete_temp_backups
afragen Jun 11, 2022
df05c1f
remove comment
afragen Jun 11, 2022
fc21819
return WP_Error
afragen Jun 11, 2022
7ebf1a2
update error messaging
afragen Jun 11, 2022
897d058
oops
afragen Jun 11, 2022
d5e6b19
Merge branch 'rollback-watcher' into rollback
afragen Jun 14, 2022
d2c6fca
wpcs
afragen Jun 14, 2022
14189cc
Merge branch 'non-direct-rollback' into rollback
afragen Jun 21, 2022
cb15cbd
oops
afragen Jun 21, 2022
9654f47
Merge branch 'trunk' into rollback
afragen Jun 26, 2022
1003200
fix for restore during bulk update
afragen Jun 28, 2022
62b6ce1
$options not a class variable here
afragen Jun 28, 2022
8d5c88c
fix spacing
afragen Jun 28, 2022
04cbe46
change location of backup creation after `upgrader_source_selection`
afragen Sep 20, 2022
7386bc9
update @since
afragen Oct 12, 2022
71e42ba
Merge branch 'trunk' into rollback
afragen Oct 12, 2022
56118e6
switch from wp-content/upgrade/temp-backup to wp-content/temp-backup
afragen Oct 15, 2022
2cab593
not necessary as temp-backup now in wp-content
afragen Oct 15, 2022
8c1b405
Merge branch 'trunk' into rollback
afragen Jan 27, 2023
c008aed
update rollback assuming move_dir committed
afragen Jan 27, 2023
bf2202b
add auto update rollback
afragen Jan 27, 2023
8fe3e31
don't need in core
afragen Jan 28, 2023
3864a2d
switch to non-static start, keep around for cleanup later
afragen Jan 28, 2023
5f7b01e
Revert "switch to non-static start, keep around for cleanup later"
afragen Jan 28, 2023
673971f
load in class-wp-upgrader.php
afragen Jan 28, 2023
1d9f06a
move hook
afragen Jan 28, 2023
130d462
cleanup
afragen Jan 28, 2023
3cf5a61
update docblock
afragen Jan 28, 2023
015aa86
Remove rollback-auto-update
afragen Jan 31, 2023
692d10d
Merge branch 'trunk' into rollback
afragen Jan 31, 2023
327314c
Merge branch 'trunk' into rollback
afragen Feb 8, 2023
5854d50
update since
afragen Feb 8, 2023
d504977
Auto stash before merge of "rollback" and "trunk"
afragen Feb 8, 2023
3ad0a9f
Merge branch 'trunk' into rollback
afragen Mar 1, 2023
9d314bd
Merge branch 'trunk' into rollback
afragen Apr 25, 2023
302b608
simplify logic for creating temp-backup
afragen Apr 25, 2023
34efea4
update for proper move_dir() return
afragen Apr 26, 2023
0834769
update @param
afragen Apr 26, 2023
9c3cc6f
update @return
afragen Apr 26, 2023
d362861
update return from Site Health
afragen May 3, 2023
c1dd694
Minor documentation updates
SergeyBiryukov May 3, 2023
327c9e5
Fix alignment warnings from WPCS
SergeyBiryukov May 3, 2023
eebf7c6
change temp-backup to upgrade-temp-backup
afragen May 3, 2023
4697d23
grammar fixes
afragen May 4, 2023
928121c
fix description
afragen May 4, 2023
837320e
oops
afragen May 4, 2023
95efbbf
maybe the last
afragen May 4, 2023
32f262e
one more I think
afragen May 4, 2023
e517fb8
better words
afragen May 4, 2023
f69ca91
Another pass at simplifying some strings
SergeyBiryukov May 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/wp-admin/includes/class-plugin-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,14 @@ public function upgrade( $plugin, $args = array() ) {
'clear_destination' => true,
'clear_working' => true,
'hook_extra' => array(
'plugin' => $plugin,
'type' => 'plugin',
'action' => 'update',
'plugin' => $plugin,
'type' => 'plugin',
'action' => 'update',
'temp_backup' => array(
'slug' => dirname( $plugin ),
'src' => WP_PLUGIN_DIR,
'dir' => 'plugins',
),
),
)
);
Expand Down Expand Up @@ -342,7 +347,12 @@ public function bulk_upgrade( $plugins, $args = array() ) {
'clear_working' => true,
'is_multi' => true,
'hook_extra' => array(
'plugin' => $plugin,
'plugin' => $plugin,
'temp_backup' => array(
'slug' => dirname( $plugin ),
'src' => WP_PLUGIN_DIR,
'dir' => 'plugins',
),
),
)
);
Expand Down
18 changes: 14 additions & 4 deletions src/wp-admin/includes/class-theme-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,14 @@ public function upgrade( $theme, $args = array() ) {
'clear_destination' => true,
'clear_working' => true,
'hook_extra' => array(
'theme' => $theme,
'type' => 'theme',
'action' => 'update',
'theme' => $theme,
'type' => 'theme',
'action' => 'update',
'temp_backup' => array(
'slug' => $theme,
'src' => get_theme_root( $theme ),
'dir' => 'themes',
),
),
)
);
Expand Down Expand Up @@ -443,7 +448,12 @@ public function bulk_upgrade( $themes, $args = array() ) {
'clear_working' => true,
'is_multi' => true,
'hook_extra' => array(
'theme' => $theme,
'theme' => $theme,
'temp_backup' => array(
'slug' => $theme,
'src' => get_theme_root( $theme ),
'dir' => 'themes',
),
),
)
);
Expand Down
20 changes: 20 additions & 0 deletions src/wp-admin/includes/class-wp-filesystem-direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,26 @@ public function is_writable( $file ) {
return @is_writable( $file );
}

/**
* Return whether constant or environmental variable indicates using VirtualBox.
*
* @since 6.0.0
*
* @return bool
*/
public function is_virtual_box() {
if ( defined( 'ENV_VB' ) && ENV_VB && 'false' !== ENV_VB ) {
return true;
}

$WP_ENV_VB = getenv( 'WP_ENV_VB' );
if ( $WP_ENV_VB && 'false' !== $WP_ENV_VB ) {
return true;
}

return false;
}

afragen marked this conversation as resolved.
Show resolved Hide resolved
/**
* Gets the file's last access time.
*
Expand Down
231 changes: 215 additions & 16 deletions src/wp-admin/includes/class-wp-site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,196 @@ public function get_test_plugin_theme_auto_updates() {
return $result;
}

/**
* Test available disk space for updates.
*
* @since 6.0.0
*
* @return array The test results.
*/
public function get_test_available_updates_disk_space() {
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR . '/upgrade/' ) : 0;
$available_space_in_mb = $available_space / MB_IN_BYTES;

$result = array(
'label' => __( 'Disk space available to safely perform updates' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Security' ),
'color' => 'blue',
),
'description' => sprintf(
/* translators: %s: Available disk space in MB or GB. */
'<p>' . __( '%s available disk space was detected, update routines can be performed safely.' ),
size_format( $available_space )
),
'actions' => '',
'test' => 'available_updates_disk_space',
);

if ( $available_space_in_mb < 100 ) {
$result['description'] = __( 'Available disk space is low, less than 100 MB available.' );
$result['status'] = 'recommended';
}

if ( $available_space_in_mb < 20 ) {
$result['description'] = __( 'Available disk space is critically low, less than 20 MB available. Proceed with caution, updates may fail.' );
$result['status'] = 'critical';
}

if ( ! $available_space ) {
$result['description'] = __( 'Could not determine available disk space for updates.' );
$result['status'] = 'recommended';
}

return $result;
}

/**
* Test if plugin and theme updates temp-backup directories are writable or can be created.
*
* @since 6.0.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
*
* @return array The test results.
*/
public function get_test_update_temp_backup_writable() {
global $wp_filesystem;

$result = array(
'label' => sprintf(
/* translators: %s: temp-backup */
__( 'Plugin and theme update %s directory is writable' ),
'temp-backup'
),
'status' => 'good',
'badge' => array(
'label' => __( 'Security' ),
'color' => 'blue',
),
'description' => sprintf(
/* translators: %s: wp-content/upgrade/temp-backup */
'<p>' . __( 'The %s directory used to improve the stability of plugin and theme updates is writable.' ),
'<code>wp-content/upgrade/temp-backup</code>'
),
'actions' => '',
'test' => 'update_temp_backup_writable',
);

if ( ! $wp_filesystem ) {
if ( ! function_exists( 'WP_Filesystem' ) ) {
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
}
afragen marked this conversation as resolved.
Show resolved Hide resolved
WP_Filesystem();
}
$wp_content = $wp_filesystem->wp_content_dir();

$upgrade_dir_exists = $wp_filesystem->is_dir( "$wp_content/upgrade" );
$upgrade_dir_is_writable = $wp_filesystem->is_writable( "$wp_content/upgrade" );
$backup_dir_exists = $wp_filesystem->is_dir( "$wp_content/upgrade/temp-backup" );
$backup_dir_is_writable = $wp_filesystem->is_writable( "$wp_content/upgrade/temp-backup" );

$plugins_dir_exists = $wp_filesystem->is_dir( "$wp_content/upgrade/temp-backup/plugins" );
$plugins_dir_is_writable = $wp_filesystem->is_writable( "$wp_content/upgrade/temp-backup/plugins" );
$themes_dir_exists = $wp_filesystem->is_dir( "$wp_content/upgrade/temp-backup/themes" );
$themes_dir_is_writable = $wp_filesystem->is_writable( "$wp_content/upgrade/temp-backup/themes" );

if ( $plugins_dir_exists && ! $plugins_dir_is_writable && $themes_dir_exists && ! $themes_dir_is_writable ) {
$result['status'] = 'critical';
$result['label'] = sprintf(
/* translators: %s: temp-backup */
__( 'Plugins and themes %s directories exist but are not writable' ),
'temp-backup'
afragen marked this conversation as resolved.
Show resolved Hide resolved
);
$result['description'] = sprintf(
/* translators: 1: wp-content/upgrade/temp-backup/plugins, 2: wp-content/upgrade/temp-backup/themes. */
'<p>' . __( 'The %1$s and %2$s directories exist but are not writable. These directories are used to improve the stability of plugin updates. Please make sure the server has write permissions to these directories.' ) . '</p>',
'<code>wp-content/upgrade/temp-backup/plugins</code>',
'<code>wp-content/upgrade/temp-backup/themes</code>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wp-content portion of these may not be correct on sub-directory installs: eg a bedrock type config.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't bedrock type systems set the WP_CONTENT_DIR which gets picked up in $wp_filesystem->wp_content_dir()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all the tests use $wp_content, which should take into account WP_CONTENT_DIR, should we change all these references to use the variable?

Does it really matter as the path that's listed in the descriptions doesn't take into account anything preceding in the path.
Is wp/wp-content/... substantially different in Site Health to wp-content/...?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is an extreme edge case and it's only in a path that everyone should understand, I say we leave and wait to see if someone complains.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterwilsoncc can you test this? I've never used Bedrock or similar type of installation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this refers to the wp-content directory in general. There are some other similar instances in core:

/* translators: %s: wp-content/uploads */
printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
...
sprintf(
	/* translators: 1: The name of the drop-in. 2: The name of the database engine. */
	__( 'You are using a %1$s drop-in which might mean that a %2$s database is not being used.' ),
	'<code>wp-content/db.php</code>',
	( $this->is_mariadb ? 'MariaDB' : 'MySQL' )
),
...
'wp-content' => array(
	'label' => __( 'The wp-content directory' ),
	'value' => ( $is_writable_wp_content_dir ? __( 'Writable' ) : __( 'Not writable' ) ),
	'debug' => ( $is_writable_wp_content_dir ? 'writable' : 'not writable' ),
),

Looking at Bedrock, it appears to rename the wp-content directory to app. Not sure how to account for that in these messages, but maybe using WP_CONTENT_DIR would help?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly not a blocker.

);
return $result;
}

if ( $plugins_dir_exists && ! $plugins_dir_is_writable ) {
$result['status'] = 'critical';
$result['label'] = sprintf(
/* translators: %s: temp-backup */
__( 'Plugins %s directory exists but is not writable' ),
'temp-backup'
);
$result['description'] = sprintf(
/* translators: %s: wp-content/upgrade/temp-backup/plugins */
'<p>' . __( 'The %s directory exists but is not writable. This directory is used to improve the stability of plugin updates. Please make sure the server has write permissions to this directory.' ) . '</p>',
'<code>wp-content/upgrade/temp-backup/plugins</code>'
);
return $result;
}

if ( $themes_dir_exists && ! $themes_dir_is_writable ) {
$result['status'] = 'critical';
$result['label'] = sprintf(
/* translators: %s: temp-backup */
__( 'Themes %s directory exists but is not writable' ),
'temp-backup'
);
$result['description'] = sprintf(
/* translators: %s: wp-content/upgrade/temp-backup/themes */
'<p>' . __( 'The %s directory exists but is not writable. This directory is used to improve the stability of theme updates. Please make sure the server has write permissions to this directory.' ) . '</p>',
'<code>wp-content/upgrade/temp-backup/themes</code>'
);
return $result;
}

if ( ( ! $plugins_dir_exists || ! $themes_dir_exists ) && $backup_dir_exists && ! $backup_dir_is_writable ) {
$result['status'] = 'critical';
$result['label'] = sprintf(
/* translators: %s: temp-backup */
__( 'The %s directory exists but is not writable' ),
'temp-backup'
);
$result['description'] = sprintf(
/* translators: %s: wp-content/upgrade/temp-backup */
'<p>' . __( 'The %s directory exists but is not writable. This directory is used to improve the stability of plugin and theme updates. Please make sure the server has write permissions to this directory.' ) . '</p>',
'<code>wp-content/upgrade/temp-backup</code>'
);
return $result;
}

if ( ! $backup_dir_exists && $upgrade_dir_exists && ! $upgrade_dir_is_writable ) {
$result['status'] = 'critical';
$result['label'] = sprintf(
/* translators: %s: upgrade */
__( 'The %s directory exists but is not writable' ),
'upgrade'
);
$result['description'] = sprintf(
/* translators: %s: wp-content/upgrade */
'<p>' . __( 'The %s directory exists but is not writable. This directory is used for plugin and theme updates. Please make sure the server has write permissions to this directory.' ) . '</p>',
'<code>wp-content/upgrade</code>'
);
return $result;
}

if ( ! $upgrade_dir_exists && ! $wp_filesystem->is_writable( $wp_content ) ) {
$result['status'] = 'critical';
$result['label'] = sprintf(
/* translators: %s: upgrade */
__( 'The %s directory cannot be created' ),
'upgrade'
);
$result['description'] = sprintf(
/* translators: 1: wp-content/upgrade, 2: wp-content. */
'<p>' . __( 'The %1$s directory does not exist, and the server does not have write permissions in %2$s to create it. This directory is used for plugin and theme updates. Please make sure the server has write permissions in %2$s.' ) . '</p>',
'<code>wp-content/upgrade</code>',
'<code>wp-content</code>'
);
return $result;
}

return $result;
}

/**
* Test if loopbacks work as expected.
*
Expand Down Expand Up @@ -2266,71 +2456,80 @@ public function get_test_authorization_header() {
public static function get_tests() {
$tests = array(
'direct' => array(
'wordpress_version' => array(
'wordpress_version' => array(
'label' => __( 'WordPress Version' ),
'test' => 'wordpress_version',
),
'plugin_version' => array(
'plugin_version' => array(
'label' => __( 'Plugin Versions' ),
'test' => 'plugin_version',
),
'theme_version' => array(
'theme_version' => array(
'label' => __( 'Theme Versions' ),
'test' => 'theme_version',
),
'php_version' => array(
'php_version' => array(
'label' => __( 'PHP Version' ),
'test' => 'php_version',
),
'php_extensions' => array(
'php_extensions' => array(
'label' => __( 'PHP Extensions' ),
'test' => 'php_extensions',
),
'php_default_timezone' => array(
'php_default_timezone' => array(
'label' => __( 'PHP Default Timezone' ),
'test' => 'php_default_timezone',
),
'php_sessions' => array(
'php_sessions' => array(
'label' => __( 'PHP Sessions' ),
'test' => 'php_sessions',
),
'sql_server' => array(
'sql_server' => array(
'label' => __( 'Database Server version' ),
'test' => 'sql_server',
),
'utf8mb4_support' => array(
'utf8mb4_support' => array(
'label' => __( 'MySQL utf8mb4 support' ),
'test' => 'utf8mb4_support',
),
'ssl_support' => array(
'ssl_support' => array(
'label' => __( 'Secure communication' ),
'test' => 'ssl_support',
),
'scheduled_events' => array(
'scheduled_events' => array(
'label' => __( 'Scheduled events' ),
'test' => 'scheduled_events',
),
'http_requests' => array(
'http_requests' => array(
'label' => __( 'HTTP Requests' ),
'test' => 'http_requests',
),
'rest_availability' => array(
'rest_availability' => array(
'label' => __( 'REST API availability' ),
'test' => 'rest_availability',
'skip_cron' => true,
),
'debug_enabled' => array(
'debug_enabled' => array(
'label' => __( 'Debugging enabled' ),
'test' => 'is_in_debug_mode',
),
'file_uploads' => array(
'file_uploads' => array(
'label' => __( 'File uploads' ),
'test' => 'file_uploads',
),
'plugin_theme_auto_updates' => array(
'plugin_theme_auto_updates' => array(
'label' => __( 'Plugin and theme auto-updates' ),
'test' => 'plugin_theme_auto_updates',
),
'update_temp_backup_writable' => array(
/* translators: %s: temp-backup */
'label' => sprintf( __( 'Updates %s directory access' ), 'temp-backup' ),
'test' => 'update_temp_backup_writable',
),
'available_updates_disk_space' => array(
'label' => __( 'Available disk space' ),
'test' => 'available_updates_disk_space',
),
),
'async' => array(
'dotorg_communication' => array(
Expand Down
Loading