From 7b853d4b69cece9c0705aee98a17d1c9029b4157 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Sun, 9 Jul 2023 19:52:24 +0000 Subject: [PATCH] Docs: Replace multiple single line comments with multi-line comments. This changeset updates various comments as per WordPress PHP Inline Documentation Standards. See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments. Props costdev, audrasjb. See #58459. Built from https://develop.svn.wordpress.org/trunk@56174 git-svn-id: http://core.svn.wordpress.org/trunk@55686 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 36 ++++++++++++------- wp-admin/includes/class-core-upgrader.php | 6 ++-- wp-admin/includes/class-plugin-upgrader.php | 24 ++++++++----- wp-admin/includes/class-theme-upgrader.php | 12 ++++--- .../includes/class-wp-automatic-updater.php | 30 ++++++++++------ wp-admin/includes/class-wp-debug-data.php | 18 ++++++---- .../includes/class-wp-filesystem-base.php | 24 ++++++++----- wp-admin/includes/class-wp-list-table.php | 18 ++++++---- .../class-wp-plugin-install-list-table.php | 6 ++-- .../includes/class-wp-plugins-list-table.php | 6 ++-- .../class-wp-privacy-policy-content.php | 12 ++++--- wp-admin/includes/class-wp-site-health.php | 32 +++++++++++------ wp-admin/includes/class-wp-upgrader.php | 18 ++++++---- wp-admin/includes/file.php | 36 ++++++++++++------- wp-admin/includes/image.php | 24 ++++++++----- wp-admin/includes/media.php | 12 ++++--- wp-admin/includes/meta-boxes.php | 12 ++++--- wp-includes/version.php | 2 +- 18 files changed, 218 insertions(+), 110 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 2b1dabcdae..1cbcdff3dc 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -298,16 +298,20 @@ function wp_ajax_autocomplete_user() { $return = array(); - // Check the type of request. - // Current allowed values are `add` and `search`. + /* + * Check the type of request. + * Current allowed values are `add` and `search`. + */ if ( isset( $_REQUEST['autocomplete_type'] ) && 'search' === $_REQUEST['autocomplete_type'] ) { $type = $_REQUEST['autocomplete_type']; } else { $type = 'add'; } - // Check the desired field for value. - // Current allowed values are `user_email` and `user_login`. + /* + * Check the desired field for value. + * Current allowed values are `user_email` and `user_login`. + */ if ( isset( $_REQUEST['autocomplete_field'] ) && 'user_email' === $_REQUEST['autocomplete_field'] ) { $field = $_REQUEST['autocomplete_field']; } else { @@ -1520,8 +1524,10 @@ function wp_ajax_add_menu_item() { require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; - // For performance reasons, we omit some object properties from the checklist. - // The following is a hacky way to restore them when adding non-custom items. + /* + * For performance reasons, we omit some object properties from the checklist. + * The following is a hacky way to restore them when adding non-custom items. + */ $menu_items_data = array(); foreach ( (array) $_POST['menu-item'] as $menu_item_data ) { @@ -2512,14 +2518,18 @@ function wp_ajax_media_create_image_subsizes() { } } - // Set a custom header with the attachment_id. - // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error. + /* + * Set a custom header with the attachment_id. + * Used by the browser/client to resume creating image sub-sizes after a PHP fatal error. + */ if ( ! headers_sent() ) { header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); } - // This can still be pretty slow and cause timeout or out of memory errors. - // The js that handles the response would need to also handle HTTP 500 errors. + /* + * This can still be pretty slow and cause timeout or out of memory errors. + * The js that handles the response would need to also handle HTTP 500 errors. + */ wp_update_image_subsizes( $attachment_id ); if ( ! empty( $_POST['_legacy_support'] ) ) { @@ -3769,8 +3779,10 @@ function wp_ajax_parse_embed() { } if ( is_ssl() && str_starts_with( $url, 'http://' ) ) { - // Admin is ssl and the user pasted non-ssl URL. - // Check if the provider supports ssl embeds and use that for the preview. + /* + * Admin is ssl and the user pasted non-ssl URL. + * Check if the provider supports ssl embeds and use that for the preview. + */ $ssl_shortcode = preg_replace( '%^(\\[embed[^\\]]*\\])http://%i', '$1https://', $shortcode ); $parsed = $wp_embed->run_shortcode( $ssl_shortcode ); diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php index dc8fb4b806..165e1f7bae 100644 --- a/wp-admin/includes/class-core-upgrader.php +++ b/wp-admin/includes/class-core-upgrader.php @@ -123,8 +123,10 @@ class Core_Upgrader extends WP_Upgrader { $download = $this->download_package( $current->packages->$to_download, true ); - // Allow for signature soft-fail. - // WARNING: This may be removed in the future. + /* + * Allow for signature soft-fail. + * WARNING: This may be removed in the future. + */ if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) { // Output the failure error as a normal feedback, and not as an error: /** This filter is documented in wp-admin/includes/update-core.php */ diff --git a/wp-admin/includes/class-plugin-upgrader.php b/wp-admin/includes/class-plugin-upgrader.php index 6fa17d23f0..0bb711f019 100644 --- a/wp-admin/includes/class-plugin-upgrader.php +++ b/wp-admin/includes/class-plugin-upgrader.php @@ -212,8 +212,10 @@ class Plugin_Upgrader extends WP_Upgrader { add_filter( 'upgrader_pre_install', array( $this, 'active_before' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 ); add_filter( 'upgrader_post_install', array( $this, 'active_after' ), 10, 2 ); - // There's a Trac ticket to move up the directory for zips which are made a bit differently, useful for non-.org plugins. - // 'source_selection' => array( $this, 'source_selection' ), + /* + * There's a Trac ticket to move up the directory for zips which are made a bit differently, useful for non-.org plugins. + * 'source_selection' => array( $this, 'source_selection' ), + */ if ( $parsed_args['clear_update_cache'] ) { // Clear cache so wp_update_plugins() knows about the new plugin. add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 ); @@ -252,8 +254,10 @@ class Plugin_Upgrader extends WP_Upgrader { // Force refresh of plugin update information. wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); - // Ensure any future auto-update failures trigger a failure email by removing - // the last failure notification from the list when plugins update successfully. + /* + * Ensure any future auto-update failures trigger a failure email by removing + * the last failure notification from the list when plugins update successfully. + */ $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); if ( isset( $past_failure_emails[ $plugin ] ) ) { @@ -389,8 +393,10 @@ class Plugin_Upgrader extends WP_Upgrader { // Cleanup our hooks, in case something else does an upgrade on this connection. remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ) ); - // Ensure any future auto-update failures trigger a failure email by removing - // the last failure notification from the list when plugins update successfully. + /* + * Ensure any future auto-update failures trigger a failure email by removing + * the last failure notification from the list when plugins update successfully. + */ $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); foreach ( $results as $plugin => $result ) { @@ -651,8 +657,10 @@ class Plugin_Upgrader extends WP_Upgrader { return $removed; } - // If plugin is in its own directory, recursively delete the directory. - // Base check on if plugin includes directory separator AND that it's not the root plugin folder. + /* + * If plugin is in its own directory, recursively delete the directory. + * Base check on if plugin includes directory separator AND that it's not the root plugin folder. + */ if ( strpos( $plugin, '/' ) && $this_plugin_dir !== $plugins_dir ) { $deleted = $wp_filesystem->delete( $this_plugin_dir, true ); } else { diff --git a/wp-admin/includes/class-theme-upgrader.php b/wp-admin/includes/class-theme-upgrader.php index 4a28f76c76..6bb9ba784a 100644 --- a/wp-admin/includes/class-theme-upgrader.php +++ b/wp-admin/includes/class-theme-upgrader.php @@ -351,8 +351,10 @@ class Theme_Upgrader extends WP_Upgrader { wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); - // Ensure any future auto-update failures trigger a failure email by removing - // the last failure notification from the list when themes update successfully. + /* + * Ensure any future auto-update failures trigger a failure email by removing + * the last failure notification from the list when themes update successfully. + */ $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); if ( isset( $past_failure_emails[ $theme ] ) ) { @@ -492,8 +494,10 @@ class Theme_Upgrader extends WP_Upgrader { remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) ); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) ); - // Ensure any future auto-update failures trigger a failure email by removing - // the last failure notification from the list when themes update successfully. + /* + * Ensure any future auto-update failures trigger a failure email by removing + * the last failure notification from the list when themes update successfully. + */ $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); foreach ( $results as $theme => $result ) { diff --git a/wp-admin/includes/class-wp-automatic-updater.php b/wp-admin/includes/class-wp-automatic-updater.php index 2ea1959fcc..e835f0cd35 100644 --- a/wp-admin/includes/class-wp-automatic-updater.php +++ b/wp-admin/includes/class-wp-automatic-updater.php @@ -470,8 +470,10 @@ class WP_Automatic_Updater { && ( 'up_to_date' === $upgrade_result->get_error_code() || 'locked' === $upgrade_result->get_error_code() ) ) { - // These aren't actual errors, treat it as a skipped-update instead - // to avoid triggering the post-core update failure routines. + /* + * These aren't actual errors, treat it as a skipped-update instead + * to avoid triggering the post-core update failure routines. + */ return false; } @@ -548,8 +550,10 @@ class WP_Automatic_Updater { $this->update( 'core', $core_update ); } - // Clean up, and check for any pending translations. - // (Core_Upgrader checks for core updates.) + /* + * Clean up, and check for any pending translations. + * (Core_Upgrader checks for core updates.) + */ $theme_stats = array(); if ( isset( $this->update_results['theme'] ) ) { foreach ( $this->update_results['theme'] as $upgrade ) { @@ -638,8 +642,10 @@ class WP_Automatic_Updater { $error_code = $result->get_error_code(); - // Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files. - // We should not try to perform a background update again until there is a successful one-click update performed by the user. + /* + * Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files. + * We should not try to perform a background update again until there is a successful one-click update performed by the user. + */ $critical = false; if ( 'disk_full' === $error_code || str_contains( $error_code, '__copy_dir' ) ) { $critical = true; @@ -831,8 +837,10 @@ class WP_Automatic_Updater { $body .= "\n\n"; - // Don't show this message if there is a newer version available. - // Potential for confusion, and also not useful for them to know at this point. + /* + * Don't show this message if there is a newer version available. + * Potential for confusion, and also not useful for them to know at this point. + */ if ( 'fail' === $type && ! $newer_version_available ) { $body .= __( 'An attempt was made, but your site could not be updated automatically.' ) . ' '; } @@ -903,8 +911,10 @@ class WP_Automatic_Updater { $body .= ' ' . __( 'Some data that describes the error your site encountered has been put together.' ); $body .= ' ' . __( 'Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:' ); - // If we had a rollback and we're still critical, then the rollback failed too. - // Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc. + /* + * If we had a rollback and we're still critical, then the rollback failed too. + * Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc. + */ if ( 'rollback_was_required' === $result->get_error_code() ) { $errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback ); } else { diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 08a89fa90c..8590cbbdb6 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -1619,20 +1619,26 @@ class WP_Debug_Data { $max_execution_time = ini_get( 'max_execution_time' ); } - // The max_execution_time defaults to 0 when PHP runs from cli. - // We still want to limit it below. + /* + * The max_execution_time defaults to 0 when PHP runs from cli. + * We still want to limit it below. + */ if ( empty( $max_execution_time ) ) { $max_execution_time = 30; // 30 seconds. } if ( $max_execution_time > 20 ) { - // If the max_execution_time is set to lower than 20 seconds, reduce it a bit to prevent - // edge-case timeouts that may happen after the size loop has finished running. + /* + * If the max_execution_time is set to lower than 20 seconds, reduce it a bit to prevent + * edge-case timeouts that may happen after the size loop has finished running. + */ $max_execution_time -= 2; } - // Go through the various installation directories and calculate their sizes. - // No trailing slashes. + /* + * Go through the various installation directories and calculate their sizes. + * No trailing slashes. + */ $paths = array( 'wordpress_size' => untrailingslashit( ABSPATH ), 'themes_size' => get_theme_root(), diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index a7e49f2fbd..07e3f37987 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -57,8 +57,10 @@ class WP_Filesystem_Base { public function abspath() { $folder = $this->find_folder( ABSPATH ); - // Perhaps the FTP folder is rooted at the WordPress install. - // Check for wp-includes folder in root. Could have some false positives, but rare. + /* + * Perhaps the FTP folder is rooted at the WordPress install. + * Check for wp-includes folder in root. Could have some false positives, but rare. + */ if ( ! $folder && $this->is_dir( '/' . WPINC ) ) { $folder = '/'; } @@ -305,8 +307,10 @@ class WP_Filesystem_Base { } } - // Only check this as a last resort, to prevent locating the incorrect install. - // All above procedures will fail quickly if this is the right branch to take. + /* + * Only check this as a last resort, to prevent locating the incorrect install. + * All above procedures will fail quickly if this is the right branch to take. + */ if ( isset( $files[ $last_path ] ) ) { if ( $this->verbose ) { /* translators: %s: Directory name. */ @@ -316,14 +320,18 @@ class WP_Filesystem_Base { return trailingslashit( $base . $last_path ); } - // Prevent this function from looping again. - // No need to proceed if we've just searched in `/`. + /* + * Prevent this function from looping again. + * No need to proceed if we've just searched in `/`. + */ if ( $loop || '/' === $base ) { return false; } - // As an extra last resort, Change back to / if the folder wasn't found. - // This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... + /* + * As an extra last resort, Change back to / if the folder wasn't found. + * This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... + */ return $this->search_for_folder( $folder, '/', true ); } diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index c5463f40f6..5ebe507952 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -1142,8 +1142,10 @@ class WP_List_Table { return $column; } - // We need a primary defined so responsive views show something, - // so let's fall back to the first non-checkbox column. + /* + * We need a primary defined so responsive views show something, + * so let's fall back to the first non-checkbox column. + */ foreach ( $columns as $col => $column_name ) { if ( 'cb' === $col ) { continue; @@ -1180,8 +1182,10 @@ class WP_List_Table { $columns = get_column_headers( $this->screen ); $default = $this->get_default_primary_column_name(); - // If the primary column doesn't exist, - // fall back to the first non-checkbox column. + /* + * If the primary column doesn't exist, + * fall back to the first non-checkbox column. + */ if ( ! isset( $columns[ $default ] ) ) { $default = self::get_default_primary_column_name(); } @@ -1666,8 +1670,10 @@ class WP_List_Table { $classes .= ' hidden'; } - // Comments column uses HTML in the display name with screen reader text. - // Strip tags to get closer to a user-friendly string. + /* + * Comments column uses HTML in the display name with screen reader text. + * Strip tags to get closer to a user-friendly string. + */ $data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"'; $attributes = "class='$classes' $data"; 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 0a1efba9ca..527e929cb0 100644 --- a/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -115,8 +115,10 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' ); if ( current_user_can( 'upload_plugins' ) ) { - // No longer a real tab. Here for filter compatibility. - // Gets skipped in get_views(). + /* + * No longer a real tab. Here for filter compatibility. + * Gets skipped in get_views(). + */ $tabs['upload'] = __( 'Upload Plugin' ); } diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php index b58ba5f352..56e76251da 100644 --- a/wp-admin/includes/class-wp-plugins-list-table.php +++ b/wp-admin/includes/class-wp-plugins-list-table.php @@ -261,8 +261,10 @@ class WP_Plugins_List_Table extends WP_List_Table { } } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { - // On the non-network screen, populate the active list with plugins that are individually activated. - // On the network admin screen, populate the active list with plugins that are network-activated. + /* + * On the non-network screen, populate the active list with plugins that are individually activated. + * On the network admin screen, populate the active list with plugins that are network-activated. + */ $plugins['active'][ $plugin_file ] = $plugin_data; if ( ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ) ) { diff --git a/wp-admin/includes/class-wp-privacy-policy-content.php b/wp-admin/includes/class-wp-privacy-policy-content.php index a96c411c77..46b10e15f6 100644 --- a/wp-admin/includes/class-wp-privacy-policy-content.php +++ b/wp-admin/includes/class-wp-privacy-policy-content.php @@ -103,11 +103,15 @@ final class WP_Privacy_Policy_Content { sort( $old ); sort( $new ); - // The == operator (equal, not identical) was used intentionally. - // See https://www.php.net/manual/en/language.operators.array.php + /* + * The == operator (equal, not identical) was used intentionally. + * See https://www.php.net/manual/en/language.operators.array.php + */ if ( $new != $old ) { - // A plugin was activated or deactivated, or some policy text has changed. - // Show a notice on the relevant screens to inform the admin. + /* + * A plugin was activated or deactivated, or some policy text has changed. + * Show a notice on the relevant screens to inform the admin. + */ add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) ); $state = 'changed'; } else { diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index 1d7eeef3d5..fa2e06ac7d 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -772,8 +772,10 @@ class WP_Site_Health { return $result; } - // The PHP version is still receiving security fixes, but is lower than - // the expected minimum version that will be required by WordPress in the near future. + /* + * The PHP version is still receiving security fixes, but is lower than + * the expected minimum version that will be required by WordPress in the near future. + */ if ( $response['is_secure'] && $response['is_lower_than_future_minimum'] ) { // The `is_secure` array key name doesn't actually imply this is a secure version of PHP. It only means it receives security updates. @@ -1557,8 +1559,10 @@ class WP_Site_Health { * @return array The test results. */ public function get_test_https_status() { - // Enforce fresh HTTPS detection results. This is normally invoked by using cron, - // but for Site Health it should always rely on the latest results. + /* + * Enforce fresh HTTPS detection results. This is normally invoked by using cron, + * but for Site Health it should always rely on the latest results. + */ wp_update_https_detection_errors(); $default_update_url = wp_get_default_update_https_url(); @@ -1585,8 +1589,10 @@ class WP_Site_Health { ); if ( ! wp_is_using_https() ) { - // If the website is not using HTTPS, provide more information - // about whether it is supported and how it can be enabled. + /* + * If the website is not using HTTPS, provide more information + * about whether it is supported and how it can be enabled. + */ $result['status'] = 'recommended'; $result['label'] = __( 'Your website does not use HTTPS' ); @@ -1840,8 +1846,10 @@ class WP_Site_Health { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health-auto-updates.php'; } - // Run the auto-update tests in a separate class, - // as there are many considerations to be made. + /* + * Run the auto-update tests in a separate class, + * as there are many considerations to be made. + */ $automatic_updates = new WP_Site_Health_Auto_Updates(); $tests = $automatic_updates->run_tests(); @@ -3378,9 +3386,11 @@ class WP_Site_Health { $headers = array(); - // Include basic auth in loopback requests. Note that this will only pass along basic auth when user is - // initiating the test. If a site requires basic auth, the test will fail when it runs in WP Cron as part of - // wp_site_health_scheduled_check. This logic is copied from WP_Site_Health::can_perform_loopback(). + /* + * Include basic auth in loopback requests. Note that this will only pass along basic auth when user is + * initiating the test. If a site requires basic auth, the test will fail when it runs in WP Cron as part of + * wp_site_health_scheduled_check. This logic is copied from WP_Site_Health::can_perform_loopback(). + */ 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'] ) ); } diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index b2d7745233..a2cea37917 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -563,8 +563,10 @@ class WP_Upgrader { // There are no files? return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); } else { - // It's only a single file, the upgrader will use the folder name of this file as the destination folder. - // Folder name is based on zip filename. + /* + * It's only a single file, the upgrader will use the folder name of this file as the destination folder. + * Folder name is based on zip filename. + */ $source = trailingslashit( $args['source'] ); } @@ -641,8 +643,10 @@ class WP_Upgrader { return $removed; } } elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) { - // If we're not clearing the destination folder and something exists there already, bail. - // But first check to see if there are actually any files in the folder. + /* + * If we're not clearing the destination folder and something exists there already, bail. + * But first check to see if there are actually any files in the folder. + */ $_files = $wp_filesystem->dirlist( $remote_destination ); if ( ! empty( $_files ) ) { $wp_filesystem->delete( $remote_source, true ); // Clear out the source files. @@ -821,8 +825,10 @@ class WP_Upgrader { */ $download = $this->download_package( $options['package'], true, $options['hook_extra'] ); - // Allow for signature soft-fail. - // WARNING: This may be removed in the future. + /* + * Allow for signature soft-fail. + * WARNING: This may be removed in the future. + */ if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) { // Don't output the 'no signature could be found' failure message for now. diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 6ef2aed553..91d15cc4cc 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -574,8 +574,10 @@ function wp_edit_theme_plugin_file( $args ) { } if ( function_exists( 'session_status' ) && PHP_SESSION_ACTIVE === session_status() ) { - // Close any active session to prevent HTTP requests from timing out - // when attempting to connect back to the site. + /* + * Close any active session to prevent HTTP requests from timing out + * when attempting to connect back to the site. + */ session_write_close(); } @@ -1251,8 +1253,10 @@ function download_url( $url, $timeout = 300, $signature_verification = false ) { $signature = wp_remote_retrieve_header( $response, 'X-Content-Signature' ); if ( ! $signature ) { - // Retrieve signatures from a file if the header wasn't included. - // WordPress.org stores signatures at $package_url.sig. + /* + * Retrieve signatures from a file if the header wasn't included. + * WordPress.org stores signatures at $package_url.sig. + */ $signature_url = false; @@ -1386,8 +1390,10 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f in_array( PHP_VERSION_ID, array( 70200, 70201, 70202 ), true ) && extension_loaded( 'opcache' ) ) { - // Sodium_Compat isn't compatible with PHP 7.2.0~7.2.2 due to a bug in the PHP Opcache extension, bail early as it'll fail. - // https://bugs.php.net/bug.php?id=75938 + /* + * Sodium_Compat isn't compatible with PHP 7.2.0~7.2.2 due to a bug in the PHP Opcache extension, bail early as it'll fail. + * https://bugs.php.net/bug.php?id=75938 + */ return new WP_Error( 'signature_verification_unsupported', sprintf( @@ -1420,8 +1426,10 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f // phpcs:enable } - // This cannot be performed in a reasonable amount of time. - // https://github.com/paragonie/sodium_compat#help-sodium_compat-is-slow-how-can-i-make-it-fast + /* + * This cannot be performed in a reasonable amount of time. + * https://github.com/paragonie/sodium_compat#help-sodium_compat-is-slow-how-can-i-make-it-fast + */ if ( ! $sodium_compat_is_fast ) { return new WP_Error( 'signature_verification_unsupported', @@ -2327,8 +2335,10 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false, 'private_key' => 'FTP_PRIKEY', ); - // If defined, set it to that. Else, if POST'd, set it to that. If not, set it to an empty string. - // Otherwise, keep it as it previously was (saved details in option). + /* + * If defined, set it to that. Else, if POST'd, set it to that. If not, set it to an empty string. + * Otherwise, keep it as it previously was (saved details in option). + */ foreach ( $ftp_constants as $key => $constant ) { if ( defined( $constant ) ) { $credentials[ $key ] = constant( $constant ); @@ -2531,8 +2541,10 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false, } } - // Make sure the `submit_button()` function is available during the REST API call - // from WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method(). + /* + * Make sure the `submit_button()` function is available during the REST API call + * from WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method(). + */ if ( ! function_exists( 'submit_button' ) ) { require_once ABSPATH . 'wp-admin/includes/template.php'; } diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index f937bdc2ff..fabe9da7c0 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -28,8 +28,10 @@ function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $s $src_file = get_attached_file( $src ); if ( ! file_exists( $src_file ) ) { - // If the file doesn't exist, attempt a URL fopen on the src link. - // This can occur with certain file replication plugins. + /* + * If the file doesn't exist, attempt a URL fopen on the src link. + * This can occur with certain file replication plugins. + */ $src = _load_image_to_edit_path( $src, 'full' ); } else { $src = $src_file; @@ -159,8 +161,10 @@ function wp_update_image_subsizes( $attachment_id ) { $image_file = wp_get_original_image_path( $attachment_id ); if ( empty( $image_meta ) || ! is_array( $image_meta ) ) { - // Previously failed upload? - // If there is an uploaded file, make all sub-sizes and generate all of the attachment meta. + /* + * Previously failed upload? + * If there is an uploaded file, make all sub-sizes and generate all of the attachment meta. + */ if ( ! empty( $image_file ) ) { $image_meta = wp_create_image_subsizes( $image_file, $attachment_id ); } else { @@ -283,8 +287,10 @@ function wp_create_image_subsizes( $file, $attachment_id ) { */ $threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id ); - // If the original image's dimensions are over the threshold, - // scale the image and use it as the "full" size. + /* + * If the original image's dimensions are over the threshold, + * scale the image and use it as the "full" size. + */ if ( $threshold && ( $image_meta['width'] > $threshold || $image_meta['height'] > $threshold ) ) { $editor = wp_get_image_editor( $file ); @@ -304,8 +310,10 @@ function wp_create_image_subsizes( $file, $attachment_id ) { } if ( ! is_wp_error( $resized ) ) { - // Append "-scaled" to the image file name. It will look like "my_image-scaled.jpg". - // This doesn't affect the sub-sizes names as they are generated from the original image (for best quality). + /* + * Append "-scaled" to the image file name. It will look like "my_image-scaled.jpg". + * This doesn't affect the sub-sizes names as they are generated from the original image (for best quality). + */ $saved = $editor->save( $editor->generate_filename( 'scaled' ) ); if ( ! is_wp_error( $saved ) ) { diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 9c75c55d03..0910693fc9 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -422,14 +422,18 @@ function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid $attachment_id = wp_insert_attachment( $attachment, $file, $post_id, true ); if ( ! is_wp_error( $attachment_id ) ) { - // Set a custom header with the attachment_id. - // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error. + /* + * Set a custom header with the attachment_id. + * Used by the browser/client to resume creating image sub-sizes after a PHP fatal error. + */ if ( ! headers_sent() ) { header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); } - // The image sub-sizes are created during wp_generate_attachment_metadata(). - // This is generally slow and may cause timeouts or out of memory errors. + /* + * The image sub-sizes are created during wp_generate_attachment_metadata(). + * This is generally slow and may cause timeouts or out of memory errors. + */ wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); } diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 1ac43f8221..7d0e1def8b 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -1672,8 +1672,10 @@ function register_and_do_post_meta_boxes( $post ) { */ do_action_deprecated( 'dbx_post_advanced', array( $post ), '3.7.0', 'add_meta_boxes' ); - // Allow the Discussion meta box to show up if the post type supports comments, - // or if comments or pings are open. + /* + * Allow the Discussion meta box to show up if the post type supports comments, + * or if comments or pings are open. + */ if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } @@ -1685,8 +1687,10 @@ function register_and_do_post_meta_boxes( $post ) { $stati[] = 'private'; if ( in_array( get_post_status( $post ), $stati, true ) ) { - // If the post type support comments, or the post has comments, - // allow the Comments meta box. + /* + * If the post type support comments, or the post has comments, + * allow the Comments meta box. + */ if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 1135cbf5fe..b4fb96e5dd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-beta3-56173'; +$wp_version = '6.3-beta3-56174'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.