summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:51:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:51:18 +0000
commit0e41b5d52fdc6af6442816b5f465c9db9f84e126 (patch)
treee139a90049b158d4eed892d1662ee7f5c358fa31 /wp-admin/includes
parentAdding upstream version 6.5.5+dfsg1. (diff)
downloadwordpress-0e41b5d52fdc6af6442816b5f465c9db9f84e126.tar.xz
wordpress-0e41b5d52fdc6af6442816b5f465c9db9f84e126.zip
Adding upstream version 6.6.1+dfsg1.upstream/6.6.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-admin/includes')
-rw-r--r--wp-admin/includes/ajax-actions.php66
-rw-r--r--wp-admin/includes/class-bulk-plugin-upgrader-skin.php17
-rw-r--r--wp-admin/includes/class-bulk-theme-upgrader-skin.php17
-rw-r--r--wp-admin/includes/class-bulk-upgrader-skin.php52
-rw-r--r--wp-admin/includes/class-core-upgrader.php2
-rw-r--r--wp-admin/includes/class-file-upload-upgrader.php19
-rw-r--r--wp-admin/includes/class-language-pack-upgrader-skin.php18
-rw-r--r--wp-admin/includes/class-language-pack-upgrader.php20
-rw-r--r--wp-admin/includes/class-pclzip.php12
-rw-r--r--wp-admin/includes/class-plugin-installer-skin.php10
-rw-r--r--wp-admin/includes/class-theme-installer-skin.php10
-rw-r--r--wp-admin/includes/class-wp-automatic-updater.php256
-rw-r--r--wp-admin/includes/class-wp-comments-list-table.php6
-rw-r--r--wp-admin/includes/class-wp-debug-data.php17
-rw-r--r--wp-admin/includes/class-wp-links-list-table.php5
-rw-r--r--wp-admin/includes/class-wp-list-table.php22
-rw-r--r--wp-admin/includes/class-wp-ms-themes-list-table.php4
-rw-r--r--wp-admin/includes/class-wp-plugin-install-list-table.php4
-rw-r--r--wp-admin/includes/class-wp-plugins-list-table.php7
-rw-r--r--wp-admin/includes/class-wp-posts-list-table.php2
-rw-r--r--wp-admin/includes/class-wp-screen.php4
-rw-r--r--wp-admin/includes/class-wp-site-health.php257
-rw-r--r--wp-admin/includes/class-wp-terms-list-table.php7
-rw-r--r--wp-admin/includes/class-wp-theme-install-list-table.php3
-rw-r--r--wp-admin/includes/class-wp-upgrader-skin.php23
-rw-r--r--wp-admin/includes/class-wp-upgrader.php71
-rw-r--r--wp-admin/includes/export.php2
-rw-r--r--wp-admin/includes/file.php14
-rw-r--r--wp-admin/includes/image-edit.php4
-rw-r--r--wp-admin/includes/media.php21
-rw-r--r--wp-admin/includes/meta-boxes.php18
-rw-r--r--wp-admin/includes/misc.php21
-rw-r--r--wp-admin/includes/ms.php2
-rw-r--r--wp-admin/includes/nav-menu.php2
-rw-r--r--wp-admin/includes/network.php29
-rw-r--r--wp-admin/includes/plugin-install.php18
-rw-r--r--wp-admin/includes/plugin.php8
-rw-r--r--wp-admin/includes/post.php82
-rw-r--r--wp-admin/includes/schema.php44
-rw-r--r--wp-admin/includes/screen.php2
-rw-r--r--wp-admin/includes/template.php6
-rw-r--r--wp-admin/includes/theme.php3
-rw-r--r--wp-admin/includes/translation-install.php3
-rw-r--r--wp-admin/includes/update-core.php5
-rw-r--r--wp-admin/includes/update.php49
-rw-r--r--wp-admin/includes/upgrade.php17
46 files changed, 861 insertions, 420 deletions
diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
index 30aab70..62feaff 100644
--- a/wp-admin/includes/ajax-actions.php
+++ b/wp-admin/includes/ajax-actions.php
@@ -148,7 +148,7 @@ function wp_ajax_ajax_tag_search() {
* Require $term_search_min_chars chars for matching (default: 2)
* ensure it's a non-negative, non-zero integer.
*/
- if ( ( 0 == $term_search_min_chars ) || ( strlen( $search ) < $term_search_min_chars ) ) {
+ if ( ( 0 === $term_search_min_chars ) || ( strlen( $search ) < $term_search_min_chars ) ) {
wp_die();
}
@@ -192,7 +192,7 @@ function wp_ajax_wp_compression_test() {
if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 0 );
} else {
- update_option( 'can_compress_scripts', 0, 'yes' );
+ update_option( 'can_compress_scripts', 0, true );
}
wp_die( 0 );
}
@@ -205,10 +205,10 @@ function wp_ajax_wp_compression_test() {
$force_gzip = ( defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP );
$test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."';
- if ( 1 == $_GET['test'] ) {
+ if ( '1' === $_GET['test'] ) {
echo $test_str;
wp_die();
- } elseif ( 2 == $_GET['test'] ) {
+ } elseif ( '2' === $_GET['test'] ) {
if ( ! isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
wp_die( -1 );
}
@@ -231,7 +231,7 @@ function wp_ajax_wp_compression_test() {
if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 0 );
} else {
- update_option( 'can_compress_scripts', 0, 'yes' );
+ update_option( 'can_compress_scripts', 0, true );
}
} elseif ( 'yes' === $_GET['test'] ) {
check_ajax_referer( 'update_can_compress_scripts' );
@@ -239,7 +239,7 @@ function wp_ajax_wp_compression_test() {
if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 1 );
} else {
- update_option( 'can_compress_scripts', 1, 'yes' );
+ update_option( 'can_compress_scripts', 1, true );
}
}
}
@@ -274,7 +274,7 @@ function wp_ajax_imgedit_preview() {
*
* @since 3.1.0
*
- * @global WP_Embed $wp_embed
+ * @global WP_Embed $wp_embed WordPress Embed object.
*/
function wp_ajax_oembed_cache() {
$GLOBALS['wp_embed']->cache_oembed( $_GET['post'] );
@@ -513,7 +513,7 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
}
// Only do the expensive stuff on a page-break, and about 1 other time per page.
- if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) {
+ if ( 0 === $total % $per_page || 1 === mt_rand( 1, $per_page ) ) {
$post_id = 0;
// What type of comment count are we looking for?
$status = 'all';
@@ -733,13 +733,13 @@ function wp_ajax_delete_comment() {
$status = wp_get_comment_status( $comment );
$delta = -1;
- if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) {
+ if ( isset( $_POST['trash'] ) && '1' === $_POST['trash'] ) {
if ( 'trash' === $status ) {
wp_die( time() );
}
$r = wp_trash_comment( $comment );
- } elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) {
+ } elseif ( isset( $_POST['untrash'] ) && '1' === $_POST['untrash'] ) {
if ( 'trash' !== $status ) {
wp_die( time() );
}
@@ -750,13 +750,13 @@ function wp_ajax_delete_comment() {
if ( ! isset( $_POST['comment_status'] ) || 'trash' !== $_POST['comment_status'] ) {
$delta = 1;
}
- } elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) {
+ } elseif ( isset( $_POST['spam'] ) && '1' === $_POST['spam'] ) {
if ( 'spam' === $status ) {
wp_die( time() );
}
$r = wp_spam_comment( $comment );
- } elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) {
+ } elseif ( isset( $_POST['unspam'] ) && '1' === $_POST['unspam'] ) {
if ( 'spam' !== $status ) {
wp_die( time() );
}
@@ -767,7 +767,7 @@ function wp_ajax_delete_comment() {
if ( ! isset( $_POST['comment_status'] ) || 'spam' !== $_POST['comment_status'] ) {
$delta = 1;
}
- } elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) {
+ } elseif ( isset( $_POST['delete'] ) && '1' === $_POST['delete'] ) {
$r = wp_delete_comment( $comment );
} else {
wp_die( -1 );
@@ -1000,7 +1000,7 @@ function wp_ajax_dim_comment() {
$current = wp_get_comment_status( $comment );
- if ( isset( $_POST['new'] ) && $_POST['new'] == $current ) {
+ if ( isset( $_POST['new'] ) && $_POST['new'] === $current ) {
wp_die( time() );
}
@@ -1339,7 +1339,7 @@ function wp_ajax_replyto_comment( $action ) {
$_POST['_wp_unfiltered_html_comment'] = '';
}
- if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
+ if ( wp_create_nonce( 'unfiltered-html-comment' ) !== $_POST['_wp_unfiltered_html_comment'] ) {
kses_remove_filters(); // Start with a clean slate.
kses_init_filters(); // Set up the filters.
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
@@ -1384,7 +1384,7 @@ function wp_ajax_replyto_comment( $action ) {
if ( ! empty( $_POST['approve_parent'] ) ) {
$parent = get_comment( $comment_parent );
- if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_id ) {
+ if ( $parent && '0' === $parent->comment_approved && (int) $parent->comment_post_ID === $comment_post_id ) {
if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) {
wp_die( -1 );
}
@@ -1482,8 +1482,12 @@ function wp_ajax_edit_comment() {
wp_die( $updated->get_error_message() );
}
- $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
- $checkbox = ( isset( $_POST['checkbox'] ) && true == $_POST['checkbox'] ) ? 1 : 0;
+ $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
+ /*
+ * Checkbox is used to differentiate between the Edit Comments screen (1)
+ * and the Comments section on the Edit Post screen (0).
+ */
+ $checkbox = ( isset( $_POST['checkbox'] ) && '1' === $_POST['checkbox'] ) ? 1 : 0;
$wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
$comment = get_comment( $comment_id );
@@ -1699,7 +1703,7 @@ function wp_ajax_add_meta() {
wp_die( -1 );
}
- if ( $meta->meta_value != $value || $meta->meta_key != $key ) {
+ if ( $meta->meta_value !== $value || $meta->meta_key !== $key ) {
$u = update_metadata_by_mid( 'post', $mid, $value, $key );
if ( ! $u ) {
wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
@@ -1797,7 +1801,7 @@ function wp_ajax_closed_postboxes() {
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
- if ( sanitize_key( $page ) != $page ) {
+ if ( sanitize_key( $page ) !== $page ) {
wp_die( 0 );
}
@@ -1828,7 +1832,7 @@ function wp_ajax_hidden_columns() {
check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
- if ( sanitize_key( $page ) != $page ) {
+ if ( sanitize_key( $page ) !== $page ) {
wp_die( 0 );
}
@@ -1983,7 +1987,7 @@ function wp_ajax_meta_box_order() {
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
- if ( sanitize_key( $page ) != $page ) {
+ if ( sanitize_key( $page ) !== $page ) {
wp_die( 0 );
}
@@ -2412,7 +2416,7 @@ function wp_ajax_save_widget() {
foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
- if ( $name == $id_base ) {
+ if ( $name === $id_base ) {
if ( ! is_callable( $control['callback'] ) ) {
continue;
}
@@ -2742,7 +2746,7 @@ function wp_ajax_set_post_thumbnail() {
check_ajax_referer( "set_post_thumbnail-$post_id" );
}
- if ( '-1' == $thumbnail_id ) {
+ if ( -1 === $thumbnail_id ) {
if ( delete_post_thumbnail( $post_id ) ) {
$return = _wp_post_thumbnail_html( null, $post_id );
$json ? wp_send_json_success( $return ) : wp_die( $return );
@@ -2926,7 +2930,7 @@ function wp_ajax_wp_remove_post_lock() {
$active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) );
- if ( get_current_user_id() != $active_lock[1] ) {
+ if ( get_current_user_id() !== $active_lock[1] ) {
wp_die( 0 );
}
@@ -2951,7 +2955,7 @@ function wp_ajax_wp_remove_post_lock() {
function wp_ajax_dismiss_wp_pointer() {
$pointer = $_POST['pointer'];
- if ( sanitize_key( $pointer ) != $pointer ) {
+ if ( sanitize_key( $pointer ) !== $pointer ) {
wp_die( 0 );
}
@@ -3323,7 +3327,7 @@ function wp_ajax_send_attachment_to_editor() {
// If this attachment is unattached, attach it. Primarily a back compat thing.
$insert_into_post_id = (int) $_POST['post_id'];
- if ( 0 == $post->post_parent && $insert_into_post_id ) {
+ if ( 0 === $post->post_parent && $insert_into_post_id ) {
wp_update_post(
array(
'ID' => $id,
@@ -3381,7 +3385,7 @@ function wp_ajax_send_attachment_to_editor() {
* @since 3.5.0
*
* @global WP_Post $post Global post object.
- * @global WP_Embed $wp_embed
+ * @global WP_Embed $wp_embed WordPress Embed object.
*/
function wp_ajax_send_link_to_editor() {
global $post, $wp_embed;
@@ -3733,8 +3737,8 @@ function wp_ajax_query_themes() {
*
* @since 4.0.0
*
- * @global WP_Post $post Global post object.
- * @global WP_Embed $wp_embed Embed API instance.
+ * @global WP_Post $post Global post object.
+ * @global WP_Embed $wp_embed WordPress Embed object.
* @global WP_Scripts $wp_scripts
* @global int $content_width
*/
@@ -4024,7 +4028,7 @@ function wp_ajax_crop_image() {
$wp_site_icon = new WP_Site_Icon();
// Skip creating a new attachment if the attachment is a Site Icon.
- if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) {
+ if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) === $context ) {
// Delete the temporary cropped file, we don't need it.
wp_delete_file( $cropped );
diff --git a/wp-admin/includes/class-bulk-plugin-upgrader-skin.php b/wp-admin/includes/class-bulk-plugin-upgrader-skin.php
index 7cbf334..bb62928 100644
--- a/wp-admin/includes/class-bulk-plugin-upgrader-skin.php
+++ b/wp-admin/includes/class-bulk-plugin-upgrader-skin.php
@@ -23,10 +23,16 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
* The Plugin_Upgrader::bulk_upgrade() method will fill this in
* with info retrieved from the get_plugin_data() function.
*
+ * @since 3.0.0
* @var array Plugin data. Values will be empty if not supplied by the plugin.
*/
public $plugin_info = array();
+ /**
+ * Sets up the strings used in the update process.
+ *
+ * @since 3.0.0
+ */
public function add_strings() {
parent::add_strings();
/* translators: 1: Plugin name, 2: Number of the plugin, 3: Total number of plugins being updated. */
@@ -34,6 +40,10 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
}
/**
+ * Performs an action before a bulk plugin update.
+ *
+ * @since 3.0.0
+ *
* @param string $title
*/
public function before( $title = '' ) {
@@ -41,6 +51,10 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
}
/**
+ * Performs an action following a bulk plugin update.
+ *
+ * @since 3.0.0
+ *
* @param string $title
*/
public function after( $title = '' ) {
@@ -49,6 +63,9 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
}
/**
+ * Displays the footer following the bulk update process.
+ *
+ * @since 3.0.0
*/
public function bulk_footer() {
parent::bulk_footer();
diff --git a/wp-admin/includes/class-bulk-theme-upgrader-skin.php b/wp-admin/includes/class-bulk-theme-upgrader-skin.php
index 8ec3bbf..f2b9b95 100644
--- a/wp-admin/includes/class-bulk-theme-upgrader-skin.php
+++ b/wp-admin/includes/class-bulk-theme-upgrader-skin.php
@@ -24,10 +24,16 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
* with info retrieved from the Theme_Upgrader::theme_info() method,
* which in turn calls the wp_get_theme() function.
*
+ * @since 3.0.0
* @var WP_Theme|false The theme's info object, or false.
*/
public $theme_info = false;
+ /**
+ * Sets up the strings used in the update process.
+ *
+ * @since 3.0.0
+ */
public function add_strings() {
parent::add_strings();
/* translators: 1: Theme name, 2: Number of the theme, 3: Total number of themes being updated. */
@@ -35,6 +41,10 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
}
/**
+ * Performs an action before a bulk theme update.
+ *
+ * @since 3.0.0
+ *
* @param string $title
*/
public function before( $title = '' ) {
@@ -42,6 +52,10 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
}
/**
+ * Performs an action following a bulk theme update.
+ *
+ * @since 3.0.0
+ *
* @param string $title
*/
public function after( $title = '' ) {
@@ -50,6 +64,9 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
}
/**
+ * Displays the footer following the bulk update process.
+ *
+ * @since 3.0.0
*/
public function bulk_footer() {
parent::bulk_footer();
diff --git a/wp-admin/includes/class-bulk-upgrader-skin.php b/wp-admin/includes/class-bulk-upgrader-skin.php
index 4613119..5cdd2a5 100644
--- a/wp-admin/includes/class-bulk-upgrader-skin.php
+++ b/wp-admin/includes/class-bulk-upgrader-skin.php
@@ -16,13 +16,30 @@
* @see WP_Upgrader_Skin
*/
class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
+
+ /**
+ * Whether the bulk update process has started.
+ *
+ * @since 3.0.0
+ * @var bool
+ */
public $in_loop = false;
+
/**
+ * Stores an error message about the update.
+ *
+ * @since 3.0.0
* @var string|false
*/
public $error = false;
/**
+ * Constructor.
+ *
+ * Sets up the generic skin for the Bulk Upgrader classes.
+ *
+ * @since 3.0.0
+ *
* @param array $args
*/
public function __construct( $args = array() ) {
@@ -36,6 +53,9 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Sets up the strings used in the update process.
+ *
+ * @since 3.0.0
*/
public function add_strings() {
$this->upgrader->strings['skin_upgrade_start'] = __( 'The update process is starting. This process may take a while on some hosts, so please be patient.' );
@@ -49,6 +69,9 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Displays a message about the update.
+ *
+ * @since 3.0.0
* @since 5.9.0 Renamed `$string` (a PHP reserved keyword) to `$feedback` for PHP 8 named parameter support.
*
* @param string $feedback Message data.
@@ -77,18 +100,27 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Displays the header before the update process.
+ *
+ * @since 3.0.0
*/
public function header() {
// Nothing. This will be displayed within an iframe.
}
/**
+ * Displays the footer following the update process.
+ *
+ * @since 3.0.0
*/
public function footer() {
// Nothing. This will be displayed within an iframe.
}
/**
+ * Displays an error message about the update.
+ *
+ * @since 3.0.0
* @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support.
*
* @param string|WP_Error $errors Errors.
@@ -113,18 +145,28 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Displays the header before the bulk update process.
+ *
+ * @since 3.0.0
*/
public function bulk_header() {
$this->feedback( 'skin_upgrade_start' );
}
/**
+ * Displays the footer following the bulk update process.
+ *
+ * @since 3.0.0
*/
public function bulk_footer() {
$this->feedback( 'skin_upgrade_end' );
}
/**
+ * Performs an action before a bulk update.
+ *
+ * @since 3.0.0
+ *
* @param string $title
*/
public function before( $title = '' ) {
@@ -137,6 +179,10 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Performs an action following a bulk update.
+ *
+ * @since 3.0.0
+ *
* @param string $title
*/
public function after( $title = '' ) {
@@ -172,6 +218,9 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Resets the properties used in the update process.
+ *
+ * @since 3.0.0
*/
public function reset() {
$this->in_loop = false;
@@ -179,6 +228,9 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Flushes all output buffers.
+ *
+ * @since 3.0.0
*/
public function flush_output() {
wp_ob_end_flush_all();
diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php
index 165e1f7..2655c27 100644
--- a/wp-admin/includes/class-core-upgrader.php
+++ b/wp-admin/includes/class-core-upgrader.php
@@ -121,7 +121,7 @@ class Core_Upgrader extends WP_Upgrader {
return new WP_Error( 'locked', $this->strings['locked'] );
}
- $download = $this->download_package( $current->packages->$to_download, true );
+ $download = $this->download_package( $current->packages->$to_download, false );
/*
* Allow for signature soft-fail.
diff --git a/wp-admin/includes/class-file-upload-upgrader.php b/wp-admin/includes/class-file-upload-upgrader.php
index 1201c6d..48e1aac 100644
--- a/wp-admin/includes/class-file-upload-upgrader.php
+++ b/wp-admin/includes/class-file-upload-upgrader.php
@@ -72,7 +72,24 @@ class File_Upload_Upgrader {
if ( 'pluginzip' === $form || 'themezip' === $form ) {
if ( ! wp_zip_file_is_valid( $file['file'] ) ) {
wp_delete_file( $file['file'] );
- wp_die( __( 'Incompatible Archive.' ) );
+
+ if ( 'pluginzip' === $form ) {
+ $plugins_page = sprintf(
+ '<a href="%s">%s</a>',
+ self_admin_url( 'plugin-install.php' ),
+ __( 'Return to the Plugin Installer' )
+ );
+ wp_die( __( 'Incompatible Archive.' ) . '<br />' . $plugins_page );
+ }
+
+ if ( 'themezip' === $form ) {
+ $themes_page = sprintf(
+ '<a href="%s" target="_parent">%s</a>',
+ self_admin_url( 'theme-install.php' ),
+ __( 'Return to the Theme Installer' )
+ );
+ wp_die( __( 'Incompatible Archive.' ) . '<br />' . $themes_page );
+ }
}
}
diff --git a/wp-admin/includes/class-language-pack-upgrader-skin.php b/wp-admin/includes/class-language-pack-upgrader-skin.php
index 57b0a1c..b93ed6c 100644
--- a/wp-admin/includes/class-language-pack-upgrader-skin.php
+++ b/wp-admin/includes/class-language-pack-upgrader-skin.php
@@ -22,6 +22,12 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
public $display_footer_actions = true;
/**
+ * Constructor.
+ *
+ * Sets up the language pack upgrader skin.
+ *
+ * @since 3.7.0
+ *
* @param array $args
*/
public function __construct( $args = array() ) {
@@ -41,6 +47,9 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Performs an action before a language pack update.
+ *
+ * @since 3.7.0
*/
public function before() {
$name = $this->upgrader->get_name_for_update( $this->language_update );
@@ -52,6 +61,9 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Displays an error message about the update.
+ *
+ * @since 3.7.0
* @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support.
*
* @param string|WP_Error $errors Errors.
@@ -63,12 +75,18 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
}
/**
+ * Performs an action following a language pack update.
+ *
+ * @since 3.7.0
*/
public function after() {
echo '</div>';
}
/**
+ * Displays the footer following the bulk update process.
+ *
+ * @since 3.7.0
*/
public function bulk_footer() {
$this->decrement_update_count( 'translation' );
diff --git a/wp-admin/includes/class-language-pack-upgrader.php b/wp-admin/includes/class-language-pack-upgrader.php
index 855dbe6..6f7cf74 100644
--- a/wp-admin/includes/class-language-pack-upgrader.php
+++ b/wp-admin/includes/class-language-pack-upgrader.php
@@ -332,26 +332,34 @@ class Language_Pack_Upgrader extends WP_Upgrader {
// Check that the folder contains a valid language.
$files = $wp_filesystem->dirlist( $remote_source );
- // Check to see if a .po and .mo exist in the folder.
- $po = false;
- $mo = false;
+ // Check to see if the expected files exist in the folder.
+ $po = false;
+ $mo = false;
+ $php = false;
foreach ( (array) $files as $file => $filedata ) {
if ( str_ends_with( $file, '.po' ) ) {
$po = true;
} elseif ( str_ends_with( $file, '.mo' ) ) {
$mo = true;
+ } elseif ( str_ends_with( $file, '.l10n.php' ) ) {
+ $php = true;
}
}
+ if ( $php ) {
+ return $source;
+ }
+
if ( ! $mo || ! $po ) {
return new WP_Error(
'incompatible_archive_pomo',
$this->strings['incompatible_archive'],
sprintf(
- /* translators: 1: .po, 2: .mo */
- __( 'The language pack is missing either the %1$s or %2$s files.' ),
+ /* translators: 1: .po, 2: .mo, 3: .l10n.php */
+ __( 'The language pack is missing either the %1$s, %2$s, or %3$s files.' ),
'<code>.po</code>',
- '<code>.mo</code>'
+ '<code>.mo</code>',
+ '<code>.l10n.php</code>'
)
);
}
diff --git a/wp-admin/includes/class-pclzip.php b/wp-admin/includes/class-pclzip.php
index 963f311..658fda5 100644
--- a/wp-admin/includes/class-pclzip.php
+++ b/wp-admin/includes/class-pclzip.php
@@ -48,7 +48,7 @@
// 0 : PclZip Class integrated error handling
// 1 : PclError external library error handling. By enabling this
// you must ensure that you have included PclError library.
- // [2,...] : reserved for futur use
+ // [2,...] : reserved for future use
if (!defined('PCLZIP_ERROR_EXTERNAL')) {
define( 'PCLZIP_ERROR_EXTERNAL', 0 );
}
@@ -166,7 +166,7 @@
define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
define( 'PCLZIP_CB_PRE_ADD', 78003 );
define( 'PCLZIP_CB_POST_ADD', 78004 );
- /* For futur use
+ /* For future use
define( 'PCLZIP_CB_PRE_LIST', 78005 );
define( 'PCLZIP_CB_POST_LIST', 78006 );
define( 'PCLZIP_CB_PRE_DELETE', 78007 );
@@ -1364,12 +1364,12 @@
// Function : privCheckFormat()
// Description :
// This method check that the archive exists and is a valid zip archive.
- // Several level of check exists. (futur)
+ // Several level of check exists. (future)
// Parameters :
// $p_level : Level of check. Default 0.
// 0 : Check the first bytes (magic codes) (default value))
- // 1 : 0 + Check the central directory (futur)
- // 2 : 1 + Check each file header (futur)
+ // 1 : 0 + Check the central directory (future)
+ // 2 : 1 + Check each file header (future)
// Return Values :
// true on success,
// false on error, the error code is set.
@@ -1748,7 +1748,7 @@
case PCLZIP_CB_POST_EXTRACT :
case PCLZIP_CB_PRE_ADD :
case PCLZIP_CB_POST_ADD :
- /* for futur use
+ /* for future use
case PCLZIP_CB_PRE_DELETE :
case PCLZIP_CB_POST_DELETE :
case PCLZIP_CB_PRE_LIST :
diff --git a/wp-admin/includes/class-plugin-installer-skin.php b/wp-admin/includes/class-plugin-installer-skin.php
index 20cd15f..d8e7e3e 100644
--- a/wp-admin/includes/class-plugin-installer-skin.php
+++ b/wp-admin/includes/class-plugin-installer-skin.php
@@ -24,6 +24,12 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
private $is_downgrading = false;
/**
+ * Constructor.
+ *
+ * Sets up the plugin installer skin.
+ *
+ * @since 2.8.0
+ *
* @param array $args
*/
public function __construct( $args = array() ) {
@@ -293,13 +299,13 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$warning = sprintf(
/* translators: %s: Documentation URL. */
__( 'You are uploading an older version of a current plugin. You can continue to install the older version, but be sure to <a href="%s">back up your database and files</a> first.' ),
- __( 'https://wordpress.org/documentation/article/wordpress-backups/' )
+ __( 'https://developer.wordpress.org/advanced-administration/security/backup/' )
);
} else {
$warning = sprintf(
/* translators: %s: Documentation URL. */
__( 'You are updating a plugin. Be sure to <a href="%s">back up your database and files</a> first.' ),
- __( 'https://wordpress.org/documentation/article/wordpress-backups/' )
+ __( 'https://developer.wordpress.org/advanced-administration/security/backup/' )
);
}
diff --git a/wp-admin/includes/class-theme-installer-skin.php b/wp-admin/includes/class-theme-installer-skin.php
index d83e038..85f8797 100644
--- a/wp-admin/includes/class-theme-installer-skin.php
+++ b/wp-admin/includes/class-theme-installer-skin.php
@@ -24,6 +24,12 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
private $is_downgrading = false;
/**
+ * Constructor.
+ *
+ * Sets up the theme installer skin.
+ *
+ * @since 2.8.0
+ *
* @param array $args
*/
public function __construct( $args = array() ) {
@@ -328,13 +334,13 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$warning = sprintf(
/* translators: %s: Documentation URL. */
__( 'You are uploading an older version of the active theme. You can continue to install the older version, but be sure to <a href="%s">back up your database and files</a> first.' ),
- __( 'https://wordpress.org/documentation/article/wordpress-backups/' )
+ __( 'https://developer.wordpress.org/advanced-administration/security/backup/' )
);
} else {
$warning = sprintf(
/* translators: %s: Documentation URL. */
__( 'You are updating a theme. Be sure to <a href="%s">back up your database and files</a> first.' ),
- __( 'https://wordpress.org/documentation/article/wordpress-backups/' )
+ __( 'https://developer.wordpress.org/advanced-administration/security/backup/' )
);
}
diff --git a/wp-admin/includes/class-wp-automatic-updater.php b/wp-admin/includes/class-wp-automatic-updater.php
index bb8cb40..c96bede 100644
--- a/wp-admin/includes/class-wp-automatic-updater.php
+++ b/wp-admin/includes/class-wp-automatic-updater.php
@@ -233,7 +233,7 @@ class WP_Automatic_Updater {
// If the `disable_autoupdate` flag is set, override any user-choice, but allow filters.
if ( ! empty( $item->disable_autoupdate ) ) {
- $update = $item->disable_autoupdate;
+ $update = false;
}
/**
@@ -446,6 +446,34 @@ class WP_Automatic_Updater {
$allow_relaxed_file_ownership = true;
}
+ $is_debug = WP_DEBUG && WP_DEBUG_LOG;
+ if ( 'plugin' === $type ) {
+ $was_active = is_plugin_active( $upgrader_item );
+ if ( $is_debug ) {
+ error_log( ' Upgrading plugin ' . var_export( $item->slug, true ) . '...' );
+ }
+ }
+
+ if ( 'theme' === $type && $is_debug ) {
+ error_log( ' Upgrading theme ' . var_export( $item->theme, true ) . '...' );
+ }
+
+ /*
+ * Enable maintenance mode before upgrading the plugin or theme.
+ *
+ * This avoids potential non-fatal errors being detected
+ * while scraping for a fatal error if some files are still
+ * being moved.
+ *
+ * While these checks are intended only for plugins,
+ * maintenance mode is enabled for all upgrade types as any
+ * update could contain an error or warning, which could cause
+ * the scrape to miss a fatal error in the plugin update.
+ */
+ if ( 'translation' !== $type ) {
+ $upgrader->maintenance_mode( true );
+ }
+
// Boom, this site's about to get a whole new splash of paint!
$upgrade_result = $upgrader->upgrade(
$upgrader_item,
@@ -460,6 +488,19 @@ class WP_Automatic_Updater {
)
);
+ /*
+ * After WP_Upgrader::upgrade() completes, maintenance mode is disabled.
+ *
+ * Re-enable maintenance mode while attempting to detect fatal errors
+ * and potentially rolling back.
+ *
+ * This avoids errors if the site is visited while fatal errors exist
+ * or while files are still being moved.
+ */
+ if ( 'translation' !== $type ) {
+ $upgrader->maintenance_mode( true );
+ }
+
// If the filesystem is unavailable, false is returned.
if ( false === $upgrade_result ) {
$upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
@@ -470,6 +511,9 @@ class WP_Automatic_Updater {
&& ( 'up_to_date' === $upgrade_result->get_error_code()
|| 'locked' === $upgrade_result->get_error_code() )
) {
+ // Allow visitors to browse the site again.
+ $upgrader->maintenance_mode( false );
+
/*
* These aren't actual errors, treat it as a skipped-update instead
* to avoid triggering the post-core update failure routines.
@@ -486,6 +530,100 @@ class WP_Automatic_Updater {
}
}
+ $is_debug = WP_DEBUG && WP_DEBUG_LOG;
+
+ if ( 'theme' === $type && $is_debug ) {
+ error_log( ' Theme ' . var_export( $item->theme, true ) . ' has been upgraded.' );
+ }
+
+ if ( 'plugin' === $type ) {
+ if ( $is_debug ) {
+ error_log( ' Plugin ' . var_export( $item->slug, true ) . ' has been upgraded.' );
+ if ( is_plugin_inactive( $upgrader_item ) ) {
+ error_log( ' ' . var_export( $upgrader_item, true ) . ' is inactive and will not be checked for fatal errors.' );
+ }
+ }
+
+ if ( $was_active && ! is_wp_error( $upgrade_result ) ) {
+
+ /*
+ * The usual time limit is five minutes. However, as a loopback request
+ * is about to be performed, increase the time limit to account for this.
+ */
+ if ( function_exists( 'set_time_limit' ) ) {
+ set_time_limit( 10 * MINUTE_IN_SECONDS );
+ }
+
+ /*
+ * Avoids a race condition when there are 2 sequential plugins that have
+ * fatal errors. It seems a slight delay is required for the loopback to
+ * use the updated plugin code in the request. This can cause the second
+ * plugin's fatal error checking to be inaccurate, and may also affect
+ * subsequent plugin checks.
+ */
+ sleep( 2 );
+
+ if ( $this->has_fatal_error() ) {
+ $upgrade_result = new WP_Error();
+ $temp_backup = array(
+ array(
+ 'dir' => 'plugins',
+ 'slug' => $item->slug,
+ 'src' => WP_PLUGIN_DIR,
+ ),
+ );
+
+ $backup_restored = $upgrader->restore_temp_backup( $temp_backup );
+ if ( is_wp_error( $backup_restored ) ) {
+ $upgrade_result->add(
+ 'plugin_update_fatal_error_rollback_failed',
+ sprintf(
+ /* translators: %s: The plugin's slug. */
+ __( "The update for '%s' contained a fatal error. The previously installed version could not be restored." ),
+ $item->slug
+ )
+ );
+
+ $upgrade_result->merge_from( $backup_restored );
+ } else {
+ $upgrade_result->add(
+ 'plugin_update_fatal_error_rollback_successful',
+ sprintf(
+ /* translators: %s: The plugin's slug. */
+ __( "The update for '%s' contained a fatal error. The previously installed version has been restored." ),
+ $item->slug
+ )
+ );
+
+ $backup_deleted = $upgrader->delete_temp_backup( $temp_backup );
+ if ( is_wp_error( $backup_deleted ) ) {
+ $upgrade_result->merge_from( $backup_deleted );
+ }
+ }
+
+ /*
+ * Should emails not be working, log the message(s) so that
+ * the log file contains context for the fatal error,
+ * and whether a rollback was performed.
+ *
+ * `trigger_error()` is not used as it outputs a stack trace
+ * to this location rather than to the fatal error, which will
+ * appear above this entry in the log file.
+ */
+ if ( $is_debug ) {
+ error_log( ' ' . implode( "\n", $upgrade_result->get_error_messages() ) );
+ }
+ } elseif ( $is_debug ) {
+ error_log( ' The update for ' . var_export( $item->slug, true ) . ' has no fatal errors.' );
+ }
+ }
+ }
+
+ // All processes are complete. Allow visitors to browse the site again.
+ if ( 'translation' !== $type ) {
+ $upgrader->maintenance_mode( false );
+ }
+
$this->update_results[ $type ][] = (object) array(
'item' => $item,
'result' => $upgrade_result,
@@ -514,6 +652,12 @@ class WP_Automatic_Updater {
return;
}
+ $is_debug = WP_DEBUG && WP_DEBUG_LOG;
+
+ if ( $is_debug ) {
+ error_log( 'Automatic updates starting...' );
+ }
+
// Don't automatically run these things, as we'll handle it ourselves.
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
remove_action( 'upgrader_process_complete', 'wp_version_check' );
@@ -524,22 +668,43 @@ class WP_Automatic_Updater {
wp_update_plugins(); // Check for plugin updates.
$plugin_updates = get_site_transient( 'update_plugins' );
if ( $plugin_updates && ! empty( $plugin_updates->response ) ) {
+ if ( $is_debug ) {
+ error_log( ' Automatic plugin updates starting...' );
+ }
+
foreach ( $plugin_updates->response as $plugin ) {
$this->update( 'plugin', $plugin );
}
+
// Force refresh of plugin update information.
wp_clean_plugins_cache();
+
+ if ( $is_debug ) {
+ error_log( ' Automatic plugin updates complete.' );
+ }
}
// Next, those themes we all love.
wp_update_themes(); // Check for theme updates.
$theme_updates = get_site_transient( 'update_themes' );
if ( $theme_updates && ! empty( $theme_updates->response ) ) {
+ if ( $is_debug ) {
+ error_log( ' Automatic theme updates starting...' );
+ }
+
foreach ( $theme_updates->response as $theme ) {
$this->update( 'theme', (object) $theme );
}
// Force refresh of theme update information.
wp_clean_themes_cache();
+
+ if ( $is_debug ) {
+ error_log( ' Automatic theme updates complete.' );
+ }
+ }
+
+ if ( $is_debug ) {
+ error_log( 'Automatic updates complete.' );
}
// Next, process any core update.
@@ -1163,7 +1328,7 @@ class WP_Automatic_Updater {
// List failed plugin updates.
if ( ! empty( $failed_updates['plugin'] ) ) {
- $body[] = __( 'These plugins failed to update:' );
+ $body[] = __( 'The following plugins failed to update. If there was a fatal error in the update, the previously installed version has been restored.' );
foreach ( $failed_updates['plugin'] as $item ) {
$body_message = '';
@@ -1551,4 +1716,91 @@ Thanks! -- The WordPress Team"
wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
}
+
+ /**
+ * Performs a loopback request to check for potential fatal errors.
+ *
+ * Fatal errors cannot be detected unless maintenance mode is enabled.
+ *
+ * @since 6.6.0
+ *
+ * @global int $upgrading The Unix timestamp marking when upgrading WordPress began.
+ *
+ * @return bool Whether a fatal error was detected.
+ */
+ protected function has_fatal_error() {
+ global $upgrading;
+
+ $maintenance_file = ABSPATH . '.maintenance';
+ if ( ! file_exists( $maintenance_file ) ) {
+ return false;
+ }
+
+ require $maintenance_file;
+ if ( ! is_int( $upgrading ) ) {
+ return false;
+ }
+
+ $scrape_key = md5( $upgrading );
+ $scrape_nonce = (string) $upgrading;
+ $transient = 'scrape_key_' . $scrape_key;
+ set_transient( $transient, $scrape_nonce, 30 );
+
+ $cookies = wp_unslash( $_COOKIE );
+ $scrape_params = array(
+ 'wp_scrape_key' => $scrape_key,
+ 'wp_scrape_nonce' => $scrape_nonce,
+ );
+ $headers = array(
+ 'Cache-Control' => 'no-cache',
+ );
+
+ /** This filter is documented in wp-includes/class-wp-http-streams.php */
+ $sslverify = apply_filters( 'https_local_ssl_verify', false );
+
+ // Include Basic auth in the loopback request.
+ if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
+ $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) );
+ }
+
+ // Time to wait for loopback request to finish.
+ $timeout = 50; // 50 seconds.
+
+ $is_debug = WP_DEBUG && WP_DEBUG_LOG;
+ if ( $is_debug ) {
+ error_log( ' Scraping home page...' );
+ }
+
+ $needle_start = "###### wp_scraping_result_start:$scrape_key ######";
+ $needle_end = "###### wp_scraping_result_end:$scrape_key ######";
+ $url = add_query_arg( $scrape_params, home_url( '/' ) );
+ $response = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
+
+ if ( is_wp_error( $response ) ) {
+ if ( $is_debug ) {
+ error_log( 'Loopback request failed: ' . $response->get_error_message() );
+ }
+ return true;
+ }
+
+ // If this outputs `true` in the log, it means there were no fatal errors detected.
+ if ( $is_debug ) {
+ error_log( var_export( substr( $response['body'], strpos( $response['body'], '###### wp_scraping_result_start:' ) ), true ) );
+ }
+
+ $body = wp_remote_retrieve_body( $response );
+ $scrape_result_position = strpos( $body, $needle_start );
+ $result = null;
+
+ if ( false !== $scrape_result_position ) {
+ $error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) );
+ $error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) );
+ $result = json_decode( trim( $error_output ), true );
+ }
+
+ delete_transient( $transient );
+
+ // Only fatal errors will result in a 'type' key.
+ return isset( $result['type'] );
+ }
}
diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php
index d4970e2..6c45a4e 100644
--- a/wp-admin/includes/class-wp-comments-list-table.php
+++ b/wp-admin/includes/class-wp-comments-list-table.php
@@ -237,7 +237,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$status_links = array();
$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
- $stati = array(
+ $statuses = array(
/* translators: %s: Number of comments. */
'all' => _nx_noop(
'All <span class="count">(%s)</span>',
@@ -282,7 +282,7 @@ class WP_Comments_List_Table extends WP_List_Table {
);
if ( ! EMPTY_TRASH_DAYS ) {
- unset( $stati['trash'] );
+ unset( $statuses['trash'] );
}
$link = admin_url( 'edit-comments.php' );
@@ -291,7 +291,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$link = add_query_arg( 'comment_type', $comment_type, $link );
}
- foreach ( $stati as $status => $label ) {
+ foreach ( $statuses as $status => $label ) {
if ( 'mine' === $status ) {
$current_user_id = get_current_user_id();
$num_comments->mine = get_comments(
diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php
index ed6a9e7..2d6fb41 100644
--- a/wp-admin/includes/class-wp-debug-data.php
+++ b/wp-admin/includes/class-wp-debug-data.php
@@ -134,6 +134,7 @@ class WP_Debug_Data {
if ( ! $is_multisite ) {
$info['wp-paths-sizes'] = array(
+ /* translators: Filesystem directory paths and storage sizes. */
'label' => __( 'Directories and Sizes' ),
'fields' => array(),
);
@@ -346,6 +347,7 @@ class WP_Debug_Data {
$is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] );
$is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR );
$is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) );
+ $is_writable_fonts_dir = wp_is_writable( wp_get_font_dir()['basedir'] );
$info['wp-filesystem'] = array(
'label' => __( 'Filesystem Permissions' ),
@@ -376,6 +378,11 @@ class WP_Debug_Data {
'value' => ( $is_writable_template_directory ? __( 'Writable' ) : __( 'Not writable' ) ),
'debug' => ( $is_writable_template_directory ? 'writable' : 'not writable' ),
),
+ 'fonts' => array(
+ 'label' => __( 'The fonts directory' ),
+ 'value' => ( $is_writable_fonts_dir ? __( 'Writable' ) : __( 'Not writable' ) ),
+ 'debug' => ( $is_writable_fonts_dir ? 'writable' : 'not writable' ),
+ ),
),
);
@@ -482,6 +489,15 @@ class WP_Debug_Data {
'value' => $loading,
'debug' => 'loading...',
),
+ 'fonts_path' => array(
+ 'label' => __( 'Fonts directory location' ),
+ 'value' => wp_get_font_dir()['basedir'],
+ ),
+ 'fonts_size' => array(
+ 'label' => __( 'Fonts directory size' ),
+ 'value' => $loading,
+ 'debug' => 'loading...',
+ ),
'database_size' => array(
'label' => __( 'Database size' ),
'value' => $loading,
@@ -1636,6 +1652,7 @@ class WP_Debug_Data {
'themes_size' => get_theme_root(),
'plugins_size' => WP_PLUGIN_DIR,
'uploads_size' => $upload_dir['basedir'],
+ 'fonts_size' => wp_get_font_dir()['basedir'],
);
$exclude = $paths;
diff --git a/wp-admin/includes/class-wp-links-list-table.php b/wp-admin/includes/class-wp-links-list-table.php
index 5159c1c..66c4990 100644
--- a/wp-admin/includes/class-wp-links-list-table.php
+++ b/wp-admin/includes/class-wp-links-list-table.php
@@ -50,7 +50,10 @@ class WP_Links_List_Table extends WP_List_Table {
public function prepare_items() {
global $cat_id, $s, $orderby, $order;
- wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) );
+ $cat_id = ! empty( $_REQUEST['cat_id'] ) ? absint( $_REQUEST['cat_id'] ) : 0;
+ $orderby = ! empty( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : '';
+ $order = ! empty( $_REQUEST['order'] ) ? sanitize_text_field( $_REQUEST['order'] ) : '';
+ $s = ! empty( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '';
$args = array(
'hide_invisible' => 0,
diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php
index 4e6aaa4..2879a0a 100644
--- a/wp-admin/includes/class-wp-list-table.php
+++ b/wp-admin/includes/class-wp-list-table.php
@@ -388,7 +388,13 @@ class WP_List_Table {
$input_id = $input_id . '-search-input';
if ( ! empty( $_REQUEST['orderby'] ) ) {
- echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
+ if ( is_array( $_REQUEST['orderby'] ) ) {
+ foreach ( $_REQUEST['orderby'] as $key => $value ) {
+ echo '<input type="hidden" name="orderby[' . esc_attr( $key ) . ']" value="' . esc_attr( $value ) . '" />';
+ }
+ } else {
+ echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
+ }
}
if ( ! empty( $_REQUEST['order'] ) ) {
echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
@@ -635,7 +641,7 @@ class WP_List_Table {
return false;
}
- if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
+ if ( isset( $_REQUEST['action'] ) && '-1' !== $_REQUEST['action'] ) {
return $_REQUEST['action'];
}
@@ -753,7 +759,7 @@ class WP_List_Table {
$month_count = count( $months );
- if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
+ if ( ! $month_count || ( 1 === $month_count && 0 === (int) $months[0]->month ) ) {
return;
}
@@ -764,7 +770,7 @@ class WP_List_Table {
<option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
<?php
foreach ( $months as $arc_row ) {
- if ( 0 == $arc_row->year ) {
+ if ( 0 === (int) $arc_row->year ) {
continue;
}
@@ -989,10 +995,10 @@ class WP_List_Table {
* - `edit_comments_per_page`
* - `sites_network_per_page`
* - `site_themes_network_per_page`
- * - `themes_network_per_page'`
+ * - `themes_network_per_page`
* - `users_network_per_page`
* - `edit_post_per_page`
- * - `edit_page_per_page'`
+ * - `edit_page_per_page`
* - `edit_{$post_type}_per_page`
* - `edit_post_tag_per_page`
* - `edit_category_per_page`
@@ -1053,11 +1059,11 @@ class WP_List_Table {
$disable_prev = false;
$disable_next = false;
- if ( 1 == $current ) {
+ if ( 1 === $current ) {
$disable_first = true;
$disable_prev = true;
}
- if ( $total_pages == $current ) {
+ if ( $total_pages === $current ) {
$disable_last = true;
$disable_next = true;
}
diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php
index cc0206e..96a1d99 100644
--- a/wp-admin/includes/class-wp-ms-themes-list-table.php
+++ b/wp-admin/includes/class-wp-ms-themes-list-table.php
@@ -99,7 +99,9 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
public function prepare_items() {
global $status, $totals, $page, $orderby, $order, $s;
- wp_reset_vars( array( 'orderby', 'order', 's' ) );
+ $orderby = ! empty( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : '';
+ $order = ! empty( $_REQUEST['order'] ) ? sanitize_text_field( $_REQUEST['order'] ) : '';
+ $s = ! empty( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '';
$themes = array(
/**
diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php
index f3452a7..1a318d3 100644
--- a/wp-admin/includes/class-wp-plugin-install-list-table.php
+++ b/wp-admin/includes/class-wp-plugin-install-list-table.php
@@ -92,7 +92,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
global $tabs, $tab, $paged, $type, $term;
- wp_reset_vars( array( 'tab' ) );
+ $tab = ! empty( $_REQUEST['tab'] ) ? sanitize_text_field( $_REQUEST['tab'] ) : '';
$paged = $this->get_pagenum();
@@ -626,7 +626,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
} elseif ( ! $compatible_wp ) {
$incompatible_notice_message .= __( 'This plugin does not work with your version of WordPress.' );
if ( current_user_can( 'update_core' ) ) {
- $incompatible_notice_message .= printf(
+ $incompatible_notice_message .= sprintf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php
index 4cc0132..379cf56 100644
--- a/wp-admin/includes/class-wp-plugins-list-table.php
+++ b/wp-admin/includes/class-wp-plugins-list-table.php
@@ -90,7 +90,8 @@ class WP_Plugins_List_Table extends WP_List_Table {
public function prepare_items() {
global $status, $plugins, $totals, $page, $orderby, $order, $s;
- wp_reset_vars( array( 'orderby', 'order' ) );
+ $orderby = ! empty( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : '';
+ $order = ! empty( $_REQUEST['order'] ) ? sanitize_text_field( $_REQUEST['order'] ) : '';
/**
* Filters the full array of plugins to list in the Plugins list table.
@@ -452,8 +453,8 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
?>
<p class="search-box">
- <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
- <input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>" />
+ <label for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?></label>
+ <input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" />
<?php submit_button( $text, 'hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?>
</p>
<?php
diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php
index baf3ef6..826be9b 100644
--- a/wp-admin/includes/class-wp-posts-list-table.php
+++ b/wp-admin/includes/class-wp-posts-list-table.php
@@ -65,7 +65,7 @@ class WP_Posts_List_Table extends WP_List_Table {
*
* @see WP_List_Table::__construct() for more information on default arguments.
*
- * @global WP_Post_Type $post_type_object
+ * @global WP_Post_Type $post_type_object Global post type object.
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param array $args An associative array of arguments.
diff --git a/wp-admin/includes/class-wp-screen.php b/wp-admin/includes/class-wp-screen.php
index 67bceef..4bb5995 100644
--- a/wp-admin/includes/class-wp-screen.php
+++ b/wp-admin/includes/class-wp-screen.php
@@ -984,7 +984,7 @@ final class WP_Screen {
}
/**
- * @global array $wp_meta_boxes
+ * @global array $wp_meta_boxes Global meta box state.
*
* @return bool
*/
@@ -1103,7 +1103,7 @@ final class WP_Screen {
*
* @since 4.4.0
*
- * @global array $wp_meta_boxes
+ * @global array $wp_meta_boxes Global meta box state.
*/
public function render_meta_boxes_preferences() {
global $wp_meta_boxes;
diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php
index da6c81e..12ca7f7 100644
--- a/wp-admin/includes/class-wp-site-health.php
+++ b/wp-admin/includes/class-wp-site-health.php
@@ -18,7 +18,7 @@ class WP_Site_Health {
private $mysql_server_version = '';
private $mysql_required_version = '5.5';
private $mysql_recommended_version = '8.0';
- private $mariadb_recommended_version = '10.4';
+ private $mariadb_recommended_version = '10.5';
public $php_memory_limit;
@@ -1284,120 +1284,6 @@ class WP_Site_Health {
}
/**
- * Tests if the database server is capable of using utf8mb4.
- *
- * @since 5.2.0
- *
- * @return array The test results.
- */
- public function get_test_utf8mb4_support() {
- if ( ! $this->mysql_server_version ) {
- $this->prepare_sql_data();
- }
-
- $result = array(
- 'label' => __( 'UTF8MB4 is supported' ),
- 'status' => 'good',
- 'badge' => array(
- 'label' => __( 'Performance' ),
- 'color' => 'blue',
- ),
- 'description' => sprintf(
- '<p>%s</p>',
- __( 'UTF8MB4 is the character set WordPress prefers for database storage because it safely supports the widest set of characters and encodings, including Emoji, enabling better support for non-English languages.' )
- ),
- 'actions' => '',
- 'test' => 'utf8mb4_support',
- );
-
- if ( ! $this->is_mariadb ) {
- if ( version_compare( $this->mysql_server_version, '5.5.3', '<' ) ) {
- $result['status'] = 'recommended';
-
- $result['label'] = __( 'utf8mb4 requires a MySQL update' );
-
- $result['description'] .= sprintf(
- '<p>%s</p>',
- sprintf(
- /* translators: %s: Version number. */
- __( 'WordPress&#8217; utf8mb4 support requires MySQL version %s or greater. Please contact your server administrator.' ),
- '5.5.3'
- )
- );
- } else {
- $result['description'] .= sprintf(
- '<p>%s</p>',
- __( 'Your MySQL version supports utf8mb4.' )
- );
- }
- } else { // MariaDB introduced utf8mb4 support in 5.5.0.
- if ( version_compare( $this->mysql_server_version, '5.5.0', '<' ) ) {
- $result['status'] = 'recommended';
-
- $result['label'] = __( 'utf8mb4 requires a MariaDB update' );
-
- $result['description'] .= sprintf(
- '<p>%s</p>',
- sprintf(
- /* translators: %s: Version number. */
- __( 'WordPress&#8217; utf8mb4 support requires MariaDB version %s or greater. Please contact your server administrator.' ),
- '5.5.0'
- )
- );
- } else {
- $result['description'] .= sprintf(
- '<p>%s</p>',
- __( 'Your MariaDB version supports utf8mb4.' )
- );
- }
- }
-
- // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_client_info
- $mysql_client_version = mysqli_get_client_info();
-
- /*
- * libmysql has supported utf8mb4 since 5.5.3, same as the MySQL server.
- * mysqlnd has supported utf8mb4 since 5.0.9.
- */
- if ( str_contains( $mysql_client_version, 'mysqlnd' ) ) {
- $mysql_client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $mysql_client_version );
- if ( version_compare( $mysql_client_version, '5.0.9', '<' ) ) {
- $result['status'] = 'recommended';
-
- $result['label'] = __( 'utf8mb4 requires a newer client library' );
-
- $result['description'] .= sprintf(
- '<p>%s</p>',
- sprintf(
- /* translators: 1: Name of the library, 2: Number of version. */
- __( 'WordPress&#8217; utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer. Please contact your server administrator.' ),
- 'mysqlnd',
- '5.0.9'
- )
- );
- }
- } else {
- if ( version_compare( $mysql_client_version, '5.5.3', '<' ) ) {
- $result['status'] = 'recommended';
-
- $result['label'] = __( 'utf8mb4 requires a newer client library' );
-
- $result['description'] .= sprintf(
- '<p>%s</p>',
- sprintf(
- /* translators: 1: Name of the library, 2: Number of version. */
- __( 'WordPress&#8217; utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer. Please contact your server administrator.' ),
- 'libmysql',
- '5.5.3'
- )
- );
- }
- }
-
- return $result;
- }
-
- /**
* Tests if the site can communicate with WordPress.org.
*
* @since 5.2.0
@@ -1489,7 +1375,7 @@ class WP_Site_Health {
'actions' => sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
/* translators: Documentation explaining debugging in WordPress. */
- esc_url( __( 'https://wordpress.org/documentation/article/debugging-in-wordpress/' ) ),
+ esc_url( __( 'https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/' ) ),
__( 'Learn more about debugging in WordPress.' ),
/* translators: Hidden accessibility text. */
__( '(opens in a new tab)' )
@@ -1953,11 +1839,19 @@ class WP_Site_Health {
$result['description'] = __( 'Could not determine available disk space for updates.' );
$result['status'] = 'recommended';
} elseif ( $available_space < 20 * MB_IN_BYTES ) {
- $result['description'] = __( 'Available disk space is critically low, less than 20 MB available. Proceed with caution, updates may fail.' );
- $result['status'] = 'critical';
+ $result['description'] = sprintf(
+ /* translators: %s: Available disk space in MB or GB. */
+ __( 'Available disk space is critically low, less than %s available. Proceed with caution, updates may fail.' ),
+ size_format( 20 * MB_IN_BYTES )
+ );
+ $result['status'] = 'critical';
} elseif ( $available_space < 100 * MB_IN_BYTES ) {
- $result['description'] = __( 'Available disk space is low, less than 100 MB available.' );
- $result['status'] = 'recommended';
+ $result['description'] = sprintf(
+ /* translators: %s: Available disk space in MB or GB. */
+ __( 'Available disk space is low, less than %s available.' ),
+ size_format( 100 * MB_IN_BYTES )
+ );
+ $result['status'] = 'recommended';
}
return $result;
@@ -2504,7 +2398,7 @@ class WP_Site_Health {
'label' => '',
'actions' => sprintf(
'<p><a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
- __( 'https://wordpress.org/documentation/article/optimization/#Caching' ),
+ __( 'https://developer.wordpress.org/advanced-administration/performance/optimization/#caching' ),
__( 'Learn more about page cache' ),
/* translators: Hidden accessibility text. */
__( '(opens in a new tab)' )
@@ -2613,7 +2507,7 @@ class WP_Site_Health {
$action_url = apply_filters(
'site_status_persistent_object_cache_url',
/* translators: Localized Support reference. */
- __( 'https://wordpress.org/documentation/article/optimization/#persistent-object-cache' )
+ __( 'https://developer.wordpress.org/advanced-administration/performance/optimization/#persistent-object-cache' )
);
$result = array(
@@ -2693,6 +2587,107 @@ class WP_Site_Health {
}
/**
+ * Calculates total amount of autoloaded data.
+ *
+ * @since 6.6.0
+ *
+ * @return int Autoloaded data in bytes.
+ */
+ public function get_autoloaded_options_size() {
+ $alloptions = wp_load_alloptions();
+
+ $total_length = 0;
+
+ foreach ( $alloptions as $option_value ) {
+ if ( is_array( $option_value ) || is_object( $option_value ) ) {
+ $option_value = maybe_serialize( $option_value );
+ }
+ $total_length += strlen( (string) $option_value );
+ }
+
+ return $total_length;
+ }
+
+ /**
+ * Tests the number of autoloaded options.
+ *
+ * @since 6.6.0
+ *
+ * @return array The test results.
+ */
+ public function get_test_autoloaded_options() {
+ $autoloaded_options_size = $this->get_autoloaded_options_size();
+ $autoloaded_options_count = count( wp_load_alloptions() );
+
+ $base_description = __( 'Autoloaded options are configuration settings for plugins and themes that are automatically loaded with every page load in WordPress. Having too many autoloaded options can slow down your site.' );
+
+ $result = array(
+ 'label' => __( 'Autoloaded options are acceptable' ),
+ 'status' => 'good',
+ 'badge' => array(
+ 'label' => __( 'Performance' ),
+ 'color' => 'blue',
+ ),
+ 'description' => sprintf(
+ /* translators: 1: Number of autoloaded options, 2: Autoloaded options size. */
+ '<p>' . esc_html( $base_description ) . ' ' . __( 'Your site has %1$s autoloaded options (size: %2$s) in the options table, which is acceptable.' ) . '</p>',
+ $autoloaded_options_count,
+ size_format( $autoloaded_options_size )
+ ),
+ 'actions' => '',
+ 'test' => 'autoloaded_options',
+ );
+
+ /**
+ * Filters max bytes threshold to trigger warning in Site Health.
+ *
+ * @since 6.6.0
+ *
+ * @param int $limit Autoloaded options threshold size. Default 800000.
+ */
+ $limit = apply_filters( 'site_status_autoloaded_options_size_limit', 800000 );
+
+ if ( $autoloaded_options_size < $limit ) {
+ return $result;
+ }
+
+ $result['status'] = 'critical';
+ $result['label'] = __( 'Autoloaded options could affect performance' );
+ $result['description'] = sprintf(
+ /* translators: 1: Number of autoloaded options, 2: Autoloaded options size. */
+ '<p>' . esc_html( $base_description ) . ' ' . __( 'Your site has %1$s autoloaded options (size: %2$s) in the options table, which could cause your site to be slow. You can review the options being autoloaded in your database and remove any options that are no longer needed by your site.' ) . '</p>',
+ $autoloaded_options_count,
+ size_format( $autoloaded_options_size )
+ );
+
+ /**
+ * Filters description to be shown on Site Health warning when threshold is met.
+ *
+ * @since 6.6.0
+ *
+ * @param string $description Description message when autoloaded options bigger than threshold.
+ */
+ $result['description'] = apply_filters( 'site_status_autoloaded_options_limit_description', $result['description'] );
+
+ $result['actions'] = sprintf(
+ /* translators: 1: HelpHub URL, 2: Link description. */
+ '<p><a target="_blank" rel="noopener" href="%1$s">%2$s</a></p>',
+ esc_url( __( 'https://developer.wordpress.org/advanced-administration/performance/optimization/#autoloaded-options' ) ),
+ __( 'More info about optimizing autoloaded options' )
+ );
+
+ /**
+ * Filters actionable information to tackle the problem. It can be a link to an external guide.
+ *
+ * @since 6.6.0
+ *
+ * @param string $actions Call to Action to be used to point to the right direction to solve the issue.
+ */
+ $result['actions'] = apply_filters( 'site_status_autoloaded_options_action_to_perform', $result['actions'] );
+ return $result;
+ }
+
+ /**
* Returns a set of tests that belong to the site status page.
*
* Each site status test is defined here, they may be `direct` tests, that run on page load, or `async` tests
@@ -2739,10 +2734,6 @@ class WP_Site_Health {
'label' => __( 'Database Server version' ),
'test' => 'sql_server',
),
- 'utf8mb4_support' => array(
- 'label' => __( 'MySQL utf8mb4 support' ),
- 'test' => 'utf8mb4_support',
- ),
'ssl_support' => array(
'label' => __( 'Secure communication' ),
'test' => 'ssl_support',
@@ -2780,6 +2771,10 @@ class WP_Site_Health {
'label' => __( 'Available disk space' ),
'test' => 'available_updates_disk_space',
),
+ 'autoloaded_options' => array(
+ 'label' => __( 'Autoloaded options' ),
+ 'test' => 'autoloaded_options',
+ ),
),
'async' => array(
'dotorg_communication' => array(
@@ -3443,12 +3438,12 @@ class WP_Site_Health {
* @since 6.1.0
*
* @return WP_Error|array {
- * Page cache detail or else a WP_Error if unable to determine.
+ * Page cache detail or else a WP_Error if unable to determine.
*
- * @type string $status Page cache status. Good, Recommended or Critical.
- * @type bool $advanced_cache_present Whether page cache plugin is available or not.
- * @type string[] $headers Client caching response headers detected.
- * @type float $response_time Response time of site.
+ * @type string $status Page cache status. Good, Recommended or Critical.
+ * @type bool $advanced_cache_present Whether page cache plugin is available or not.
+ * @type string[] $headers Client caching response headers detected.
+ * @type float $response_time Response time of site.
* }
*/
private function get_page_cache_detail() {
diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php
index b3d9ec5..c7f3463 100644
--- a/wp-admin/includes/class-wp-terms-list-table.php
+++ b/wp-admin/includes/class-wp-terms-list-table.php
@@ -27,8 +27,8 @@ class WP_Terms_List_Table extends WP_List_Table {
*
* @see WP_List_Table::__construct() for more information on default arguments.
*
- * @global string $post_type
- * @global string $taxonomy
+ * @global string $post_type Global post type.
+ * @global string $taxonomy Global taxonomy.
* @global string $action
* @global object $tax
*
@@ -330,7 +330,8 @@ class WP_Terms_List_Table extends WP_List_Table {
}
/**
- * @global string $taxonomy
+ * @global string $taxonomy Global taxonomy.
+ *
* @param WP_Term $tag Term object.
* @param int $level
*/
diff --git a/wp-admin/includes/class-wp-theme-install-list-table.php b/wp-admin/includes/class-wp-theme-install-list-table.php
index 945fb6e..e273d4b 100644
--- a/wp-admin/includes/class-wp-theme-install-list-table.php
+++ b/wp-admin/includes/class-wp-theme-install-list-table.php
@@ -36,7 +36,8 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
require ABSPATH . 'wp-admin/includes/theme-install.php';
global $tabs, $tab, $paged, $type, $theme_field_defaults;
- wp_reset_vars( array( 'tab' ) );
+
+ $tab = ! empty( $_REQUEST['tab'] ) ? sanitize_text_field( $_REQUEST['tab'] ) : '';
$search_terms = array();
$search_string = '';
diff --git a/wp-admin/includes/class-wp-upgrader-skin.php b/wp-admin/includes/class-wp-upgrader-skin.php
index 83b4ba4..a5c80fa 100644
--- a/wp-admin/includes/class-wp-upgrader-skin.php
+++ b/wp-admin/includes/class-wp-upgrader-skin.php
@@ -20,7 +20,6 @@ class WP_Upgrader_Skin {
* Holds the upgrader data.
*
* @since 2.8.0
- *
* @var WP_Upgrader
*/
public $upgrader;
@@ -29,7 +28,6 @@ class WP_Upgrader_Skin {
* Whether header is done.
*
* @since 2.8.0
- *
* @var bool
*/
public $done_header = false;
@@ -38,7 +36,6 @@ class WP_Upgrader_Skin {
* Whether footer is done.
*
* @since 2.8.0
- *
* @var bool
*/
public $done_footer = false;
@@ -47,7 +44,6 @@ class WP_Upgrader_Skin {
* Holds the result of an upgrade.
*
* @since 2.8.0
- *
* @var string|bool|WP_Error
*/
public $result = false;
@@ -56,7 +52,6 @@ class WP_Upgrader_Skin {
* Holds the options of an upgrade.
*
* @since 2.8.0
- *
* @var array
*/
public $options = array();
@@ -82,6 +77,8 @@ class WP_Upgrader_Skin {
}
/**
+ * Sets the relationship between the skin being used and the upgrader.
+ *
* @since 2.8.0
*
* @param WP_Upgrader $upgrader
@@ -94,6 +91,8 @@ class WP_Upgrader_Skin {
}
/**
+ * Sets up the strings used in the update process.
+ *
* @since 3.0.0
*/
public function add_strings() {
@@ -141,6 +140,8 @@ class WP_Upgrader_Skin {
}
/**
+ * Displays the header before the update process.
+ *
* @since 2.8.0
*/
public function header() {
@@ -153,6 +154,8 @@ class WP_Upgrader_Skin {
}
/**
+ * Displays the footer following the update process.
+ *
* @since 2.8.0
*/
public function footer() {
@@ -164,6 +167,8 @@ class WP_Upgrader_Skin {
}
/**
+ * Displays an error message about the update.
+ *
* @since 2.8.0
*
* @param string|WP_Error $errors Errors.
@@ -186,6 +191,8 @@ class WP_Upgrader_Skin {
}
/**
+ * Displays a message about the update.
+ *
* @since 2.8.0
* @since 5.9.0 Renamed `$string` (a PHP reserved keyword) to `$feedback` for PHP 8 named parameter support.
*
@@ -218,7 +225,7 @@ class WP_Upgrader_Skin {
public function before() {}
/**
- * Performs and action following an update.
+ * Performs an action following an update.
*
* @since 2.8.0
*/
@@ -262,11 +269,15 @@ class WP_Upgrader_Skin {
}
/**
+ * Displays the header before the bulk update process.
+ *
* @since 3.0.0
*/
public function bulk_header() {}
/**
+ * Displays the footer following the bulk update process.
+ *
* @since 3.0.0
*/
public function bulk_footer() {}
diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php
index 1fbfa99..9474ce0 100644
--- a/wp-admin/includes/class-wp-upgrader.php
+++ b/wp-admin/includes/class-wp-upgrader.php
@@ -196,6 +196,7 @@ class WP_Upgrader {
/* translators: %s: Directory name. */
$this->strings['fs_no_folder'] = __( 'Unable to locate needed folder (%s).' );
+ $this->strings['no_package'] = __( 'Package not available.' );
$this->strings['download_failed'] = __( 'Download failed.' );
$this->strings['installing_package'] = __( 'Installing the latest version&#8230;' );
$this->strings['no_files'] = __( 'The package contains no files.' );
@@ -527,7 +528,10 @@ class WP_Upgrader {
set_time_limit( 300 );
}
- if ( empty( $source ) || empty( $destination ) ) {
+ if (
+ ( ! is_string( $source ) || '' === $source || trim( $source ) !== $source ) ||
+ ( ! is_string( $destination ) || '' === $destination || trim( $destination ) !== $destination )
+ ) {
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
}
$this->skin->feedback( 'installing_package' );
@@ -824,7 +828,7 @@ class WP_Upgrader {
* Download the package. Note: If the package is the full path
* to an existing local file, it will be returned untouched.
*/
- $download = $this->download_package( $options['package'], true, $options['hook_extra'] );
+ $download = $this->download_package( $options['package'], false, $options['hook_extra'] );
/*
* Allow for signature soft-fail.
@@ -897,6 +901,7 @@ class WP_Upgrader {
$this->skin->set_result( $result );
if ( is_wp_error( $result ) ) {
+ // An automatic plugin update will have already performed its rollback.
if ( ! empty( $options['hook_extra']['temp_backup'] ) ) {
$this->temp_restores[] = $options['hook_extra']['temp_backup'];
@@ -905,8 +910,12 @@ class WP_Upgrader {
* Actions running on `shutdown` are immune to PHP timeouts,
* so in case the failure was due to a PHP timeout,
* it will still be able to properly restore the previous version.
+ *
+ * Zero arguments are accepted as a string can sometimes be passed
+ * internally during actions, causing an error because
+ * `WP_Upgrader::restore_temp_backup()` expects an array.
*/
- add_action( 'shutdown', array( $this, 'restore_temp_backup' ) );
+ add_action( 'shutdown', array( $this, 'restore_temp_backup' ), 10, 0 );
}
$this->skin->error( $result );
@@ -979,15 +988,25 @@ class WP_Upgrader {
*/
public function maintenance_mode( $enable = false ) {
global $wp_filesystem;
+
+ if ( ! $wp_filesystem ) {
+ require_once ABSPATH . 'wp-admin/includes/file.php';
+ WP_Filesystem();
+ }
+
$file = $wp_filesystem->abspath() . '.maintenance';
if ( $enable ) {
- $this->skin->feedback( 'maintenance_start' );
+ if ( ! wp_doing_cron() ) {
+ $this->skin->feedback( 'maintenance_start' );
+ }
// Create maintenance file to signal that we are upgrading.
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
$wp_filesystem->delete( $file );
$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
- $this->skin->feedback( 'maintenance_end' );
+ if ( ! wp_doing_cron() ) {
+ $this->skin->feedback( 'maintenance_end' );
+ }
$wp_filesystem->delete( $file );
}
}
@@ -1012,7 +1031,7 @@ class WP_Upgrader {
$lock_option = $lock_name . '.lock';
// Try to lock.
- $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() ) );
+ $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'off') /* LOCK */", $lock_option, time() ) );
if ( ! $lock_result ) {
$lock_result = get_option( $lock_option );
@@ -1129,17 +1148,33 @@ class WP_Upgrader {
* Restores the plugin or theme from temporary backup.
*
* @since 6.3.0
+ * @since 6.6.0 Added the `$temp_backups` parameter.
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
*
+ * @param array[] $temp_backups {
+ * Optional. An array of temporary backups.
+ *
+ * @type array ...$0 {
+ * Information about the backup.
+ *
+ * @type string $dir The temporary backup location in the upgrade-temp-backup directory.
+ * @type string $slug The item's slug.
+ * @type string $src The directory where the original is stored. For example, `WP_PLUGIN_DIR`.
+ * }
+ * }
* @return bool|WP_Error True on success, false on early exit, otherwise WP_Error.
*/
- public function restore_temp_backup() {
+ public function restore_temp_backup( array $temp_backups = array() ) {
global $wp_filesystem;
$errors = new WP_Error();
- foreach ( $this->temp_restores as $args ) {
+ if ( empty( $temp_backups ) ) {
+ $temp_backups = $this->temp_restores;
+ }
+
+ foreach ( $temp_backups as $args ) {
if ( empty( $args['slug'] ) || empty( $args['src'] ) || empty( $args['dir'] ) ) {
return false;
}
@@ -1182,17 +1217,33 @@ class WP_Upgrader {
* Deletes a temporary backup.
*
* @since 6.3.0
+ * @since 6.6.0 Added the `$temp_backups` parameter.
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
*
+ * @param array[] $temp_backups {
+ * Optional. An array of temporary backups.
+ *
+ * @type array ...$0 {
+ * Information about the backup.
+ *
+ * @type string $dir The temporary backup location in the upgrade-temp-backup directory.
+ * @type string $slug The item's slug.
+ * @type string $src The directory where the original is stored. For example, `WP_PLUGIN_DIR`.
+ * }
+ * }
* @return bool|WP_Error True on success, false on early exit, otherwise WP_Error.
*/
- public function delete_temp_backup() {
+ public function delete_temp_backup( array $temp_backups = array() ) {
global $wp_filesystem;
$errors = new WP_Error();
- foreach ( $this->temp_backups as $args ) {
+ if ( empty( $temp_backups ) ) {
+ $temp_backups = $this->temp_backups;
+ }
+
+ foreach ( $temp_backups as $args ) {
if ( empty( $args['slug'] ) || empty( $args['dir'] ) ) {
return false;
}
diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php
index d05f98f..277231a 100644
--- a/wp-admin/includes/export.php
+++ b/wp-admin/includes/export.php
@@ -401,7 +401,7 @@ function export_wp( $args = array() ) {
*
* @param int[] $post_ids Optional. Array of post IDs to filter the query by.
*/
- function wxr_authors_list( array $post_ids = null ) {
+ function wxr_authors_list( ?array $post_ids = null ) {
global $wpdb;
if ( ! empty( $post_ids ) ) {
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index 5832569..bc5ef44 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -326,7 +326,7 @@ function wp_print_file_editor_templates() {
printf(
/* translators: %s: Documentation URL. */
__( 'You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.' ),
- __( 'https://wordpress.org/documentation/article/changing-file-permissions/' )
+ __( 'https://developer.wordpress.org/advanced-administration/server/file-permissions/' )
);
?>
</p>
@@ -1089,7 +1089,7 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
* @param array|false $overrides Optional. An associative array of names => values
* to override default variables. Default false.
* See _wp_handle_upload() for accepted values.
- * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
+ * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null.
* @return array See _wp_handle_upload() for return value.
*/
function wp_handle_upload( &$file, $overrides = false, $time = null ) {
@@ -1120,7 +1120,7 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
* @param array|false $overrides Optional. An associative array of names => values
* to override default variables. Default false.
* See _wp_handle_upload() for accepted values.
- * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
+ * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null.
* @return array See _wp_handle_upload() for return value.
*/
function wp_handle_sideload( &$file, $overrides = false, $time = null ) {
@@ -1155,7 +1155,7 @@ function wp_handle_sideload( &$file, $overrides = false, $time = null ) {
function download_url( $url, $timeout = 300, $signature_verification = false ) {
// WARNING: The file is not automatically deleted, the script must delete or move the file.
if ( ! $url ) {
- return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.' ) );
+ return new WP_Error( 'http_no_url', __( 'No URL Provided.' ) );
}
$url_path = parse_url( $url, PHP_URL_PATH );
@@ -2249,7 +2249,7 @@ function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_own
* The return value can be overridden by defining the `FS_METHOD` constant in `wp-config.php`,
* or filtering via {@see 'filesystem_method'}.
*
- * @link https://wordpress.org/documentation/article/editing-wp-config-php/#wordpress-upgrade-constants
+ * @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#wordpress-upgrade-constants
*
* Plugins may define a custom transport handler, See WP_Filesystem().
*
@@ -2664,7 +2664,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
<p class="request-filesystem-credentials-action-buttons">
<?php wp_nonce_field( 'filesystem-credentials', '_fs_nonce', false, true ); ?>
<button class="button cancel-button" data-js-action="close" type="button"><?php _e( 'Cancel' ); ?></button>
- <?php submit_button( __( 'Proceed' ), '', 'upgrade', false ); ?>
+ <?php submit_button( __( 'Proceed' ), 'primary', 'upgrade', false ); ?>
</p>
</div>
</form>
@@ -2795,7 +2795,7 @@ function wp_opcache_invalidate_directory( $dir ) {
__( '%s expects a non-empty string.' ),
'<code>wp_opcache_invalidate_directory()</code>'
);
- trigger_error( $error_message );
+ wp_trigger_error( '', $error_message );
}
return;
}
diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php
index 2d150e6..d3a4147 100644
--- a/wp-admin/includes/image-edit.php
+++ b/wp-admin/includes/image-edit.php
@@ -159,8 +159,8 @@ function wp_image_editor( $post_id, $msg = false ) {
<label for="imgedit-scale-height-<?php echo $post_id; ?>" class="screen-reader-text"><?php _e( 'scale height' ); ?></label>
<input type="number" step="1" min="0" max="<?php echo isset( $meta['height'] ) ? $meta['height'] : ''; ?>" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
<button id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary"><?php esc_html_e( 'Scale' ); ?></button>
- <span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>"><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e( 'Images cannot be scaled to a size larger than the original.' ); ?></span>
</div>
+ <span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>"><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e( 'Images cannot be scaled to a size larger than the original.' ); ?></span>
</fieldset>
</div>
</div>
@@ -736,7 +736,7 @@ function image_edit_apply_changes( $image, $changes ) {
$h = $size['height'];
$scale = 1 / _image_get_preview_ratio( $w, $h ); // Discard preview scaling.
- $image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
+ $image->crop( (int) ( $sel->x * $scale ), (int) ( $sel->y * $scale ), (int) ( $sel->w * $scale ), (int) ( $sel->h * $scale ) );
} else {
$scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // Discard preview scaling.
$image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 3de25dc..6ec4b66 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -1664,7 +1664,8 @@ function get_media_item( $attachment_id, $args = null ) {
$meta = wp_get_attachment_metadata( $post->ID );
if ( isset( $meta['width'], $meta['height'] ) ) {
- $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
+ /* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
+ $media_dims .= "<span id='media-dims-$post->ID'>" . sprintf( __( '%1$s by %2$s pixels' ), $meta['width'], $meta['height'] ) . '</span>';
}
/**
@@ -3240,7 +3241,8 @@ function edit_form_image_editor( $post ) {
printf(
/* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */
__( '<a href="%1$s" %2$s>Learn how to describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
- esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
+ /* translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. */
+ esc_url( __( 'https://www.w3.org/WAI/tutorials/images/decision-tree/' ) ),
'target="_blank" rel="noopener"',
sprintf(
'<span class="screen-reader-text"> %s</span>',
@@ -3265,7 +3267,14 @@ function edit_form_image_editor( $post ) {
'textarea_name' => 'content',
'textarea_rows' => 5,
'media_buttons' => false,
- 'tinymce' => false,
+ /**
+ * Filters the TinyMCE argument for the media description field on the attachment details screen.
+ *
+ * @since 6.6.0
+ *
+ * @param bool $tinymce Whether to activate TinyMCE in media description field. Default false.
+ */
+ 'tinymce' => apply_filters( 'activate_tinymce_for_media_description', false ),
'quicktags' => $quicktags_settings,
);
@@ -3306,7 +3315,8 @@ function attachment_submitbox_metadata() {
$meta = wp_get_attachment_metadata( $attachment_id );
if ( isset( $meta['width'], $meta['height'] ) ) {
- $media_dims .= "<span id='media-dims-$attachment_id'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
+ /* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
+ $media_dims .= "<span id='media-dims-$attachment_id'>" . sprintf( __( '%1$s by %2$s pixels' ), $meta['width'], $meta['height'] ) . '</span>';
}
/** This filter is documented in wp-admin/includes/media.php */
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
@@ -3441,6 +3451,9 @@ function attachment_submitbox_metadata() {
echo ' ' . strtoupper( esc_html( $meta['bitrate_mode'] ) );
}
break;
+ case 'length_formatted':
+ echo human_readable_duration( $meta['length_formatted'] );
+ break;
default:
echo esc_html( $meta[ $key ] );
break;
diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
index 387910e..43e3344 100644
--- a/wp-admin/includes/meta-boxes.php
+++ b/wp-admin/includes/meta-boxes.php
@@ -1354,7 +1354,7 @@ function link_xfn_meta_box( $link ) {
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check( 'friendship', 'friend' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friend' ); ?>
</label>
<label for="friendship">
- <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?>
+ <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> />&nbsp;<?php /* translators: xfn (friendship relation): http://gmpg.org/xfn/ */ _x( 'none', 'Type of relation' ); ?>
</label>
</fieldset></td>
</tr>
@@ -1405,7 +1405,7 @@ function link_xfn_meta_box( $link ) {
<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check( 'geographical', 'neighbor' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'neighbor' ); ?>
</label>
<label for="geographical">
- <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?>
+ <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> />&nbsp;<?php /* translators: xfn (geographical relation): http://gmpg.org/xfn/ */ _x( 'none', 'Type of relation' ); ?>
</label>
</fieldset></td>
</tr>
@@ -1434,7 +1434,7 @@ function link_xfn_meta_box( $link ) {
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check( 'family', 'spouse' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'spouse' ); ?>
</label>
<label for="family">
- <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?>
+ <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> />&nbsp;<?php /* translators: xfn (family relation): http://gmpg.org/xfn/ */ _x( 'none', 'Type of relation' ); ?>
</label>
</fieldset></td>
</tr>
@@ -1679,13 +1679,15 @@ function register_and_do_post_meta_boxes( $post ) {
add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
}
- $stati = get_post_stati( array( 'public' => true ) );
- if ( empty( $stati ) ) {
- $stati = array( 'publish' );
+ $statuses = get_post_stati( array( 'public' => true ) );
+
+ if ( empty( $statuses ) ) {
+ $statuses = array( 'publish' );
}
- $stati[] = 'private';
- if ( in_array( get_post_status( $post ), $stati, true ) ) {
+ $statuses[] = 'private';
+
+ if ( in_array( get_post_status( $post ), $statuses, true ) ) {
/*
* If the post type support comments, or the post has comments,
* allow the Comments meta box.
diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php
index f950821..06fc294 100644
--- a/wp-admin/includes/misc.php
+++ b/wp-admin/includes/misc.php
@@ -556,7 +556,7 @@ function wp_print_plugin_file_tree( $tree, $label = '', $level = 2, $size = 1, $
}
/**
- * Flushes rewrite rules if siteurl, home or page_on_front changed.
+ * Flushes rewrite rules if `siteurl`, `home` or `page_on_front` changed.
*
* @since 2.1.0
*
@@ -575,13 +575,12 @@ function update_home_siteurl( $old_value, $value ) {
}
}
-
/**
- * Resets global variables based on $_GET and $_POST.
+ * Resets global variables based on `$_GET` and `$_POST`.
*
* This function resets global variables based on the names passed
- * in the $vars array to the value of $_POST[$var] or $_GET[$var] or ''
- * if neither is defined.
+ * in the `$vars` array to the value of `$_POST[$var]` or `$_GET[$var]` or an
+ * empty string if neither is defined.
*
* @since 2.0.0
*
@@ -755,7 +754,7 @@ function set_screen_options() {
/**
* Filters a screen option value before it is set.
*
- * The filter can also be used to modify non-standard [items]_per_page
+ * The filter can also be used to modify non-standard `[items]_per_page`
* settings. See the parent function for a full list of standard options.
*
* Returning false from the filter will skip saving the current option.
@@ -1305,7 +1304,7 @@ function wp_refresh_metabox_loader_nonces( $response, $data ) {
}
/**
- * Adds the latest Heartbeat and REST-API nonce to the Heartbeat response.
+ * Adds the latest Heartbeat and REST API nonce to the Heartbeat response.
*
* @since 5.0.0
*
@@ -1399,11 +1398,11 @@ function wp_admin_canonical_url() {
$filtered_url = remove_query_arg( $removable_query_args, $current_url );
/**
- * Filters the admin canonical url value.
+ * Filters the admin canonical URL value.
*
* @since 6.5.0
*
- * @param string $filtered_url The admin canonical url value.
+ * @param string $filtered_url The admin canonical URL value.
*/
$filtered_url = apply_filters( 'wp_admin_canonical_url', $filtered_url );
?>
@@ -1647,8 +1646,8 @@ function wp_check_php_version() {
$response['is_lower_than_future_minimum'] = false;
- // The minimum supported PHP version will be updated to 7.2. Check if the current version is lower.
- if ( version_compare( $version, '7.2', '<' ) ) {
+ // The minimum supported PHP version will be updated to 7.4 in the future. Check if the current version is lower.
+ if ( version_compare( $version, '7.4', '<' ) ) {
$response['is_lower_than_future_minimum'] = true;
// Force showing of warnings.
diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php
index 02ddf94..6814d11 100644
--- a/wp-admin/includes/ms.php
+++ b/wp-admin/includes/ms.php
@@ -1169,6 +1169,6 @@ function get_site_screen_help_tab_args() {
*/
function get_site_screen_help_sidebar_content() {
return '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
- '<p>' . __( '<a href="https://wordpress.org/documentation/article/network-admin-sites-screen/">Documentation on Site Management</a>' ) . '</p>' .
+ '<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/multisite/admin/#network-admin-sites-screen">Documentation on Site Management</a>' ) . '</p>' .
'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support forums</a>' ) . '</p>';
}
diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php
index 8f18057..aa72117 100644
--- a/wp-admin/includes/nav-menu.php
+++ b/wp-admin/includes/nav-menu.php
@@ -204,7 +204,7 @@ function wp_nav_menu_setup() {
*
* @since 3.0.0
*
- * @global array $wp_meta_boxes
+ * @global array $wp_meta_boxes Global meta box state.
*/
function wp_initial_nav_menu_meta_boxes() {
global $wp_meta_boxes;
diff --git a/wp-admin/includes/network.php b/wp-admin/includes/network.php
index 6a85b6f..fb3d8d2 100644
--- a/wp-admin/includes/network.php
+++ b/wp-admin/includes/network.php
@@ -33,8 +33,9 @@ function network_domain_check() {
* @return bool Whether subdomain installation is allowed
*/
function allow_subdomain_install() {
- $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
- if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
+ $home = get_option( 'home' );
+ $domain = parse_url( $home, PHP_URL_HOST );
+ if ( parse_url( $home, PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
return false;
}
@@ -148,26 +149,8 @@ function network_step1( $errors = false ) {
die();
}
- $hostname = get_clean_basedomain();
- $has_ports = strstr( $hostname, ':' );
- if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
- wp_admin_notice(
- '<strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ),
- array(
- 'additional_classes' => array( 'error' ),
- )
- );
-
- echo '<p>' . sprintf(
- /* translators: %s: Port number. */
- __( 'You cannot use port numbers such as %s.' ),
- '<code>' . $has_ports . '</code>'
- ) . '</p>';
- echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
- echo '</div>';
- require_once ABSPATH . 'wp-admin/admin-footer.php';
- die();
- }
+ // Strip standard port from hostname.
+ $hostname = preg_replace( '/(?::80|:443)$/', '', get_clean_basedomain() );
echo '<form method="post">';
@@ -694,7 +677,7 @@ define( 'BLOG_ID_CURRENT_SITE', 1 );
printf(
/* translators: %s: Documentation URL. */
__( 'It seems your network is running with Nginx web server. <a href="%s">Learn more about further configuration</a>.' ),
- __( 'https://wordpress.org/documentation/article/nginx/' )
+ __( 'https://developer.wordpress.org/advanced-administration/server/web-server/nginx/' )
);
echo '</p></li>';
diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php
index 704d81b..59537e2 100644
--- a/wp-admin/includes/plugin-install.php
+++ b/wp-admin/includes/plugin-install.php
@@ -174,7 +174,8 @@ function plugins_api( $action, $args = array() ) {
if ( $ssl && is_wp_error( $request ) ) {
if ( ! wp_is_json_request() ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
@@ -320,6 +321,8 @@ function install_search_form( $deprecated = true ) {
?>
<form class="search-form search-plugins" method="get">
<input type="hidden" name="tab" value="search" />
+ <label for="search-plugins"><?php _e( 'Search Plugins' ); ?></label>
+ <input type="search" name="s" id="search-plugins" value="<?php echo esc_attr( $term ); ?>" class="wp-filter-search" />
<label class="screen-reader-text" for="typeselector">
<?php
/* translators: Hidden accessibility text. */
@@ -331,13 +334,6 @@ function install_search_form( $deprecated = true ) {
<option value="author"<?php selected( 'author', $type ); ?>><?php _e( 'Author' ); ?></option>
<option value="tag"<?php selected( 'tag', $type ); ?>><?php _ex( 'Tag', 'Plugin Installer' ); ?></option>
</select>
- <label class="screen-reader-text" for="search-plugins">
- <?php
- /* translators: Hidden accessibility text. */
- _e( 'Search Plugins' );
- ?>
- </label>
- <input type="search" name="s" id="search-plugins" value="<?php echo esc_attr( $term ); ?>" class="wp-filter-search" placeholder="<?php esc_attr_e( 'Search plugins...' ); ?>" />
<?php submit_button( __( 'Search Plugins' ), 'hide-if-js', false, false, array( 'id' => 'search-submit' ) ); ?>
</form>
<?php
@@ -953,7 +949,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
if ( $status['url'] ) {
if ( $compatible_php && $compatible_wp && $all_plugin_dependencies_installed && ! empty( $data->download_link ) ) {
$button = sprintf(
- '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
+ '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s" role="button">%s</a>',
esc_attr( $data->slug ),
esc_url( $status['url'] ),
/* translators: %s: Plugin name and version. */
@@ -974,7 +970,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
if ( $status['url'] ) {
if ( $compatible_php && $compatible_wp ) {
$button = sprintf(
- '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
+ '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s" role="button">%s</a>',
esc_attr( $status['file'] ),
esc_attr( $data->slug ),
esc_url( $status['url'] ),
@@ -1021,7 +1017,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
}
$button = sprintf(
- '<a href="%1$s" data-name="%2$s" data-slug="%3$s" data-plugin="%4$s" class="button button-primary activate-now" aria-label="%5$s">%6$s</a>',
+ '<a href="%1$s" data-name="%2$s" data-slug="%3$s" data-plugin="%4$s" class="button button-primary activate-now" aria-label="%5$s" role="button">%6$s</a>',
esc_url( $activate_url ),
esc_attr( $name ),
esc_attr( $data->slug ),
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index bcae273..5b63855 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -319,10 +319,8 @@ function get_plugins( $plugin_folder = '' ) {
closedir( $plugins_subdir );
}
- } else {
- if ( str_ends_with( $file, '.php' ) ) {
- $plugin_files[] = $file;
- }
+ } elseif ( str_ends_with( $file, '.php' ) ) {
+ $plugin_files[] = $file;
}
}
@@ -2032,7 +2030,7 @@ function get_admin_page_parent( $parent_page = '' ) {
*
* @since 1.5.0
*
- * @global string $title
+ * @global string $title The title of the current screen.
* @global array $menu
* @global array $submenu
* @global string $pagenow The filename of the current screen.
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index a313324..2102064 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -72,7 +72,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
}
}
- if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] )
+ if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] !== $post_data['user_ID'] )
&& ! current_user_can( $ptype->cap->edit_others_posts ) ) {
if ( $update ) {
@@ -165,7 +165,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
}
foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) {
- if ( ! empty( $post_data[ 'hidden_' . $timeunit ] ) && $post_data[ 'hidden_' . $timeunit ] != $post_data[ $timeunit ] ) {
+ if ( ! empty( $post_data[ 'hidden_' . $timeunit ] ) && $post_data[ 'hidden_' . $timeunit ] !== $post_data[ $timeunit ] ) {
$post_data['edit_date'] = '1';
break;
}
@@ -375,7 +375,7 @@ function edit_post( $post_data = null ) {
continue;
}
- if ( $meta->post_id != $post_id ) {
+ if ( (int) $meta->post_id !== $post_id ) {
continue;
}
@@ -402,7 +402,7 @@ function edit_post( $post_data = null ) {
continue;
}
- if ( $meta->post_id != $post_id ) {
+ if ( (int) $meta->post_id !== $post_id ) {
continue;
}
@@ -516,7 +516,7 @@ function bulk_edit_posts( $post_data = null ) {
}
}
- if ( -1 == $post_data['_status'] ) {
+ if ( '-1' === $post_data['_status'] ) {
$post_data['post_status'] = null;
unset( $post_data['post_status'] );
} else {
@@ -550,7 +550,7 @@ function bulk_edit_posts( $post_data = null ) {
);
foreach ( $reset as $field ) {
- if ( isset( $post_data[ $field ] ) && ( '' === $post_data[ $field ] || -1 == $post_data[ $field ] ) ) {
+ if ( isset( $post_data[ $field ] ) && ( '' === $post_data[ $field ] || '-1' === $post_data[ $field ] ) ) {
unset( $post_data[ $field ] );
}
}
@@ -1084,7 +1084,7 @@ function get_post_meta_by_id( $mid ) {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param int $postid A post ID.
+ * @param int $post_id A post ID.
* @return array[] {
* Array of meta data arrays for the given post ID.
*
@@ -1098,7 +1098,7 @@ function get_post_meta_by_id( $mid ) {
* }
* }
*/
-function has_meta( $postid ) {
+function has_meta( $post_id ) {
global $wpdb;
return $wpdb->get_results(
@@ -1106,7 +1106,7 @@ function has_meta( $postid ) {
"SELECT meta_key, meta_value, meta_id, post_id
FROM $wpdb->postmeta WHERE post_id = %d
ORDER BY meta_key,meta_id",
- $postid
+ $post_id
),
ARRAY_A
);
@@ -1139,7 +1139,7 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
* @since 2.3.0
* @access private
*
- * @param int|object $post Post ID or post object.
+ * @param int|WP_Post $post Post ID or post object.
* @return void|int|WP_Error Void if nothing fixed. 0 or WP_Error on update failure. The post ID on update success.
*/
function _fix_attachment_links( $post ) {
@@ -1199,9 +1199,9 @@ function _fix_attachment_links( $post ) {
* @return string[] An array of all the statuses for the supplied post type.
*/
function get_available_post_statuses( $type = 'post' ) {
- $stati = wp_count_posts( $type );
+ $statuses = wp_count_posts( $type );
- return array_keys( get_object_vars( $stati ) );
+ return array_keys( get_object_vars( $statuses ) );
}
/**
@@ -1217,9 +1217,11 @@ function wp_edit_posts_query( $q = false ) {
if ( false === $q ) {
$q = $_GET;
}
- $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0;
- $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
- $post_stati = get_post_stati();
+
+ $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0;
+ $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
+
+ $post_statuses = get_post_stati();
if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types(), true ) ) {
$post_type = $q['post_type'];
@@ -1231,7 +1233,7 @@ function wp_edit_posts_query( $q = false ) {
$post_status = '';
$perm = '';
- if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati, true ) ) {
+ if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_statuses, true ) ) {
$post_status = $q['post_status'];
$perm = 'readable';
}
@@ -1402,7 +1404,7 @@ function wp_edit_attachments_query( $q = false ) {
* @return string Space-separated string of class names.
*/
function postbox_classes( $box_id, $screen_id ) {
- if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) {
+ if ( isset( $_GET['edit'] ) && $_GET['edit'] === $box_id ) {
$classes = array( '' );
} elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) {
$closed = get_user_option( 'closedpostboxes_' . $screen_id );
@@ -1461,7 +1463,7 @@ function get_sample_permalink( $post, $title = null, $name = null ) {
$original_filter = $post->filter;
// Hack: get_permalink() would return plain permalink for drafts, so we will fake that our post is published.
- if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ), true ) ) {
+ if ( in_array( $post->post_status, array( 'auto-draft', 'draft', 'pending', 'future' ), true ) ) {
$post->post_status = 'publish';
$post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID );
}
@@ -1575,7 +1577,7 @@ function get_sample_permalink_html( $post, $new_title = null, $new_slug = null )
// Encourage a pretty permalink setting.
if ( ! get_option( 'permalink_structure' ) && current_user_can( 'manage_options' )
- && ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID )
+ && ! ( 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post->ID )
) {
$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small">' . __( 'Change Permalink Structure' ) . "</a></span>\n";
}
@@ -1711,7 +1713,7 @@ function wp_check_post_lock( $post ) {
$lock = explode( ':', $lock );
$time = $lock[0];
- $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );
+ $user = isset( $lock[1] ) ? (int) $lock[1] : (int) get_post_meta( $post->ID, '_edit_last', true );
if ( ! get_userdata( $user ) ) {
return false;
@@ -1720,7 +1722,7 @@ function wp_check_post_lock( $post ) {
/** This filter is documented in wp-admin/includes/ajax-actions.php */
$time_window = apply_filters( 'wp_check_post_lock_window', 150 );
- if ( $time && $time > time() - $time_window && get_current_user_id() != $user ) {
+ if ( $time && $time > time() - $time_window && get_current_user_id() !== $user ) {
return $user;
}
@@ -1750,7 +1752,7 @@ function wp_set_post_lock( $post ) {
$user_id = get_current_user_id();
- if ( 0 == $user_id ) {
+ if ( 0 === $user_id ) {
return false;
}
@@ -1827,7 +1829,7 @@ function _admin_notice_post_locked() {
if ( $locked ) {
$query_args = array();
if ( get_post_type_object( $post->post_type )->public ) {
- if ( 'publish' === $post->post_status || $user->ID != $post->post_author ) {
+ if ( 'publish' === $post->post_status || $user->ID !== (int) $post->post_author ) {
// Latest content is in autosave.
$nonce = wp_create_nonce( 'post_preview_' . $post->ID );
$query_args['preview_id'] = $post->ID;
@@ -2079,7 +2081,7 @@ function post_preview() {
$is_autosave = false;
- if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author
+ if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() === (int) $post->post_author
&& ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status )
) {
$saved_post_id = edit_post();
@@ -2154,7 +2156,7 @@ function wp_autosave( $post_data ) {
$post_data['post_category'] = explode( ',', $post_data['catslist'] );
}
- if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author
+ if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() === (int) $post->post_author
&& ( 'auto-draft' === $post->post_status || 'draft' === $post->post_status )
) {
// Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked.
@@ -2179,19 +2181,19 @@ function redirect_post( $post_id = '' ) {
if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) {
$status = get_post_status( $post_id );
- if ( isset( $_POST['publish'] ) ) {
- switch ( $status ) {
- case 'pending':
- $message = 8;
- break;
- case 'future':
- $message = 9;
- break;
- default:
- $message = 6;
- }
- } else {
- $message = 'draft' === $status ? 10 : 1;
+ switch ( $status ) {
+ case 'pending':
+ $message = 8;
+ break;
+ case 'future':
+ $message = 9;
+ break;
+ case 'draft':
+ $message = 10;
+ break;
+ default:
+ $message = isset( $_POST['publish'] ) ? 6 : 1;
+ break;
}
$location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
@@ -2343,7 +2345,7 @@ function get_block_editor_server_block_settings() {
*
* @global WP_Post $post Global post object.
* @global WP_Screen $current_screen WordPress current screen object.
- * @global array $wp_meta_boxes
+ * @global array $wp_meta_boxes Global meta box state.
*/
function the_block_editor_meta_boxes() {
global $post, $current_screen, $wp_meta_boxes;
@@ -2406,7 +2408,7 @@ function the_block_editor_meta_boxes() {
$meta_boxes = (array) $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ];
foreach ( $meta_boxes as $meta_box ) {
- if ( false == $meta_box || ! $meta_box['title'] ) {
+ if ( false === $meta_box || ! $meta_box['title'] ) {
continue;
}
diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php
index 63655cc..33e90a9 100644
--- a/wp-admin/includes/schema.php
+++ b/wp-admin/includes/schema.php
@@ -594,9 +594,9 @@ function populate_options( array $options = array() ) {
}
if ( in_array( $option, $fat_options, true ) ) {
- $autoload = 'no';
+ $autoload = 'off';
} else {
- $autoload = 'yes';
+ $autoload = 'on';
}
if ( ! empty( $insert ) ) {
@@ -1243,39 +1243,13 @@ We hope you enjoy your new site. Thanks!
--The Team @ SITE_NAME'
);
- $misc_exts = array(
- // Images.
- 'jpg',
- 'jpeg',
- 'png',
- 'gif',
- 'webp',
- 'avif',
- // Video.
- 'mov',
- 'avi',
- 'mpg',
- '3gp',
- '3g2',
- // "audio".
- 'midi',
- 'mid',
- // Miscellaneous.
- 'pdf',
- 'doc',
- 'ppt',
- 'odt',
- 'pptx',
- 'docx',
- 'pps',
- 'ppsx',
- 'xls',
- 'xlsx',
- 'key',
- );
- $audio_exts = wp_get_audio_extensions();
- $video_exts = wp_get_video_extensions();
- $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) );
+ $allowed_file_types = array();
+ $all_mime_types = get_allowed_mime_types();
+
+ foreach ( $all_mime_types as $ext => $mime ) {
+ array_push( $allowed_file_types, ...explode( '|', $ext ) );
+ }
+ $upload_filetypes = array_unique( $allowed_file_types );
$sitemeta = array(
'site_name' => __( 'My Network' ),
diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php
index bf5aefc..a3a41a6 100644
--- a/wp-admin/includes/screen.php
+++ b/wp-admin/includes/screen.php
@@ -89,7 +89,7 @@ function get_hidden_columns( $screen ) {
*
* @since 2.7.0
*
- * @global array $wp_meta_boxes
+ * @global array $wp_meta_boxes Global meta box state.
*
* @param WP_Screen $screen
*/
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 90b375e..f78acff 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -1050,7 +1050,7 @@ function wp_import_upload_form( $action ) {
* @since 2.5.0
* @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
*
- * @global array $wp_meta_boxes
+ * @global array $wp_meta_boxes Global meta box state.
*
* @param string $id Meta box ID (used in the 'id' attribute for the meta box).
* @param string $title Title of the meta box.
@@ -1287,7 +1287,7 @@ function _get_plugin_from_callback( $callback ) {
*
* @since 2.5.0
*
- * @global array $wp_meta_boxes
+ * @global array $wp_meta_boxes Global meta box state.
*
* @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or
* add_submenu_page() to create a new screen (and hence screen_id)
@@ -1472,7 +1472,7 @@ function do_meta_boxes( $screen, $context, $data_object ) {
* @since 2.6.0
* @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
*
- * @global array $wp_meta_boxes
+ * @global array $wp_meta_boxes Global meta box state.
*
* @param string $id Meta box ID (used in the 'id' attribute for the meta box).
* @param string|array|WP_Screen $screen The screen or screens on which the meta box is shown (such as a
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
index 36dc28b..64ef380 100644
--- a/wp-admin/includes/theme.php
+++ b/wp-admin/includes/theme.php
@@ -568,7 +568,8 @@ function themes_api( $action, $args = array() ) {
if ( $ssl && is_wp_error( $request ) ) {
if ( ! wp_doing_ajax() ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
diff --git a/wp-admin/includes/translation-install.php b/wp-admin/includes/translation-install.php
index 01c61bb..ef9fcc6 100644
--- a/wp-admin/includes/translation-install.php
+++ b/wp-admin/includes/translation-install.php
@@ -59,7 +59,8 @@ function translations_api( $type, $args = null ) {
$request = wp_remote_post( $url, $options );
if ( $ssl && is_wp_error( $request ) ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php
index fd00326..9b6ece8 100644
--- a/wp-admin/includes/update-core.php
+++ b/wp-admin/includes/update-core.php
@@ -765,6 +765,11 @@ $_old_files = array(
'wp-admin/images/about-header-freedoms.svg',
'wp-admin/images/about-header-contribute.svg',
'wp-admin/images/about-header-background.svg',
+ // 6.6
+ 'wp-includes/blocks/block/editor.css',
+ 'wp-includes/blocks/block/editor.min.css',
+ 'wp-includes/blocks/block/editor-rtl.css',
+ 'wp-includes/blocks/block/editor-rtl.min.css',
);
/**
diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php
index ba27ddd..312289f 100644
--- a/wp-admin/includes/update.php
+++ b/wp-admin/includes/update.php
@@ -145,7 +145,8 @@ function get_core_checksums( $version, $locale ) {
$response = wp_remote_get( $url, $options );
if ( $ssl && is_wp_error( $response ) ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
@@ -923,48 +924,14 @@ function wp_print_admin_notice_templates() {
<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
</script>
<script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
- <div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
+ <div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errorMessage ) { #>notice-error<# } else { #>notice-success<# } #>">
<p>
- <# if ( data.successes ) { #>
- <# if ( 1 === data.successes ) { #>
- <# if ( 'plugin' === data.type ) { #>
- <?php
- /* translators: %s: Number of plugins. */
- printf( __( '%s plugin successfully updated.' ), '{{ data.successes }}' );
- ?>
- <# } else { #>
- <?php
- /* translators: %s: Number of themes. */
- printf( __( '%s theme successfully updated.' ), '{{ data.successes }}' );
- ?>
- <# } #>
- <# } else { #>
- <# if ( 'plugin' === data.type ) { #>
- <?php
- /* translators: %s: Number of plugins. */
- printf( __( '%s plugins successfully updated.' ), '{{ data.successes }}' );
- ?>
- <# } else { #>
- <?php
- /* translators: %s: Number of themes. */
- printf( __( '%s themes successfully updated.' ), '{{ data.successes }}' );
- ?>
- <# } #>
- <# } #>
+ <# if ( data.successMessage ) { #>
+ {{{ data.successMessage }}}
<# } #>
- <# if ( data.errors ) { #>
+ <# if ( data.errorMessage ) { #>
<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
- <# if ( 1 === data.errors ) { #>
- <?php
- /* translators: %s: Number of failed updates. */
- printf( __( '%s update failed.' ), '{{ data.errors }}' );
- ?>
- <# } else { #>
- <?php
- /* translators: %s: Number of failed updates. */
- printf( __( '%s updates failed.' ), '{{ data.errors }}' );
- ?>
- <# } #>
+ {{{ data.errorMessage }}}
<span class="screen-reader-text">
<?php
/* translators: Hidden accessibility text. */
@@ -975,7 +942,7 @@ function wp_print_admin_notice_templates() {
</button>
<# } #>
</p>
- <# if ( data.errors ) { #>
+ <# if ( data.errorMessages ) { #>
<ul class="bulk-action-errors hidden">
<# _.each( data.errorMessages, function( errorMessage ) { #>
<li>{{ errorMessage }}</li>
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index cb39391..715f5e2 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -52,6 +52,21 @@ if ( ! function_exists( 'wp_install' ) ) :
wp_check_mysql_version();
wp_cache_flush();
make_db_current_silent();
+
+ /*
+ * Ensure update checks are delayed after installation.
+ *
+ * This prevents users being presented with a maintenance mode screen
+ * immediately after installation.
+ */
+ wp_unschedule_hook( 'wp_version_check' );
+ wp_unschedule_hook( 'wp_update_plugins' );
+ wp_unschedule_hook( 'wp_update_themes' );
+
+ wp_schedule_event( time() + HOUR_IN_SECONDS, 'twicedaily', 'wp_version_check' );
+ wp_schedule_event( time() + ( 1.5 * HOUR_IN_SECONDS ), 'twicedaily', 'wp_update_plugins' );
+ wp_schedule_event( time() + ( 2 * HOUR_IN_SECONDS ), 'twicedaily', 'wp_update_themes' );
+
populate_options();
populate_roles();
@@ -147,7 +162,7 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
- * @global string $table_prefix
+ * @global string $table_prefix The database table prefix.
*
* @param int $user_id User ID.
*/