Skip to content

Commit

Permalink
Nightly build 2.0.0+nightly.20230529
Browse files Browse the repository at this point in the history
  • Loading branch information
ClassyBot committed May 30, 2023
1 parent c9fa238 commit 8e0fc1d
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 238 deletions.
16 changes: 8 additions & 8 deletions wp-admin/includes/class-wp-debug-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function debug_data() {
$blog_public = get_option( 'blog_public' );
$default_comment_status = get_option( 'default_comment_status' );
$environment_type = wp_get_environment_type();
$core_version = get_bloginfo( 'version' );
$core_version = classicpress_version() . ' (WP-' . get_bloginfo( 'version' ) . ')';
$core_updates = get_core_updates();
$core_update_needed = '';

Expand All @@ -70,7 +70,7 @@ public static function debug_data() {
'version' => array(
'label' => __( 'Version' ),
'value' => $core_version . $core_update_needed,
'debug' => $core_version,
'debug' => '**' . __( 'ClassicPress' ) . '** ' . $core_version,
),
'site_language' => array(
'label' => __( 'Site Language' ),
Expand Down Expand Up @@ -346,7 +346,7 @@ public static function debug_data() {
'label' => __( 'Filesystem Permissions' ),
'description' => __( 'Shows whether ClassicPress is able to write to the directories it needs access to.' ),
'fields' => array(
'wordpress' => array(
'root' => array(
'label' => __( 'The main ClassicPress directory' ),
'value' => ( $is_writable_abspath ? __( 'Writable' ) : __( 'Not writable' ) ),
'debug' => ( $is_writable_abspath ? 'writable' : 'not writable' ),
Expand Down Expand Up @@ -411,11 +411,11 @@ public static function debug_data() {
$loading = __( 'Loading…' );

$info['wp-paths-sizes']['fields'] = array(
'wordpress_path' => array(
'classicpress_path' => array(
'label' => __( 'ClassicPress directory location' ),
'value' => untrailingslashit( ABSPATH ),
),
'wordpress_size' => array(
'classicpress_size' => array(
'label' => __( 'ClassicPress directory size' ),
'value' => $loading,
'debug' => 'loading...',
Expand Down Expand Up @@ -1592,14 +1592,14 @@ public static function get_sizes() {
// Go through the various installation directories and calculate their sizes.
// No trailing slashes.
$paths = array(
'wordpress_size' => untrailingslashit( ABSPATH ),
'classicpress_size' => untrailingslashit( ABSPATH ),
'themes_size' => get_theme_root(),
'plugins_size' => WP_PLUGIN_DIR,
'uploads_size' => $upload_dir['basedir'],
);

$exclude = $paths;
unset( $exclude['wordpress_size'] );
unset( $exclude['classicpress_size'] );
$exclude = array_values( $exclude );

$size_total = 0;
Expand All @@ -1614,7 +1614,7 @@ public static function get_sizes() {
);

if ( microtime( true ) - WP_START_TIMESTAMP < $max_execution_time ) {
if ( 'wordpress_size' === $name ) {
if ( 'classicpress_size' === $name ) {
$dir_size = recurse_dirsize( $path, $exclude, $max_execution_time );
} else {
$dir_size = recurse_dirsize( $path, null, $max_execution_time );
Expand Down
88 changes: 17 additions & 71 deletions wp-admin/includes/class-wp-site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,12 +724,12 @@ public function get_test_theme_version() {
* @return array The test results.
*/
public function get_test_php_version() {
$response = wp_check_php_version();
global $required_php_version;

$result = array(
'label' => sprintf(
/* translators: %s: The current PHP version. */
__( 'Your site is running the current version of PHP (%s)' ),
__( 'Your site is running PHP version (%s)' ),
PHP_VERSION
),
'status' => 'good',
Expand All @@ -742,7 +742,7 @@ public function get_test_php_version() {
sprintf(
/* translators: %s: The minimum recommended PHP version. */
__( 'PHP is one of the programming languages used to build ClassicPress. Newer versions of PHP receive regular security updates and may increase your site&#8217;s performance. The minimum recommended version of PHP is %s.' ),
$response ? $response['recommended_version'] : ''
$required_php_version
)
),
'actions' => sprintf(
Expand All @@ -756,73 +756,19 @@ public function get_test_php_version() {
);

// PHP is up to date.
if ( ! $response || version_compare( PHP_VERSION, $response['recommended_version'], '>=' ) ) {
if ( version_compare( PHP_VERSION, $required_php_version, '>=' ) ) {
return $result;
}

// The PHP version is older than the recommended version, but still receiving active support.
if ( $response['is_supported'] ) {
$result['label'] = sprintf(
/* translators: %s: The server PHP version. */
__( 'Your site is running on an older version of PHP (%s)' ),
PHP_VERSION
);
$result['status'] = 'recommended';

return $result;
}

// The PHP version is still receiving security fixes, but is lower than
// the expected minimum version that will be required by ClassicPress 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.

$result['label'] = sprintf(
/* translators: %s: The server PHP version. */
__( 'Your site is running on an outdated version of PHP (%s), which soon will not be supported by ClassicPress.' ),
PHP_VERSION
);

$result['status'] = 'critical';
$result['badge']['label'] = __( 'Requirements' );

return $result;
}

// The PHP version is only receiving security fixes.
if ( $response['is_secure'] ) {
} else {
// The PHP version is older than the recommended version.
$result['label'] = sprintf(
/* translators: %s: The server PHP version. */
__( 'Your site is running on an older version of PHP (%s), which should be updated' ),
__( 'Your site is running on an older and unsupported version of PHP (%s), which should be updated' ),
PHP_VERSION
);
$result['status'] = 'recommended';
$result['status'] = 'critical';

return $result;
}

// No more security updates for the PHP version, and lower than the expected minimum version required by ClassicPress.
if ( $response['is_lower_than_future_minimum'] ) {
$message = sprintf(
/* translators: %s: The server PHP version. */
__( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates and soon will not be supported by ClassicPress.' ),
PHP_VERSION
);
} else {
// No more security updates for the PHP version, must be updated.
$message = sprintf(
/* translators: %s: The server PHP version. */
__( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates. It should be updated.' ),
PHP_VERSION
);
}

$result['label'] = $message;
$result['status'] = 'critical';

$result['badge']['label'] = __( 'Security' );

return $result;
}

/**
Expand Down Expand Up @@ -887,7 +833,7 @@ public function get_test_php_extensions() {
__( 'PHP modules perform most of the tasks on the server that make your site run. Any changes to these must be made by your server administrator.' ),
sprintf(
/* translators: 1: Link to the hosting group page about recommended PHP modules. 2: Additional link attributes. 3: Accessibility text. */
__( 'The ClassicPress Hosting Team maintains a list of those modules, both recommended and required, in <a href="%1$s" %2$s>the team handbook%3$s</a>.' ),
__( 'ClassicPress maintains a list of those modules, both recommended and required, in <a href="%1$s" %2$s>the server requirements%3$s</a>.' ),
/* translators: Localized team handbook, if one exists. */
esc_url( __( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions' ) ),
'target="_blank" rel="noopener"',
Expand Down Expand Up @@ -1413,7 +1359,7 @@ public function get_test_utf8mb4_support() {
*/
public function get_test_dotorg_communication() {
$result = array(
'label' => __( 'Can communicate with WordPress.org' ),
'label' => __( 'Can communicate with ClassicPress.net' ),
'status' => '',
'badge' => array(
'label' => __( 'Security' ),
Expand All @@ -1428,7 +1374,7 @@ public function get_test_dotorg_communication() {
);

$wp_dotorg = wp_remote_get(
'https://api.wordpress.org',
'https://api-v1.classicpress.net',
array(
'timeout' => 10,
)
Expand All @@ -1438,7 +1384,7 @@ public function get_test_dotorg_communication() {
} else {
$result['status'] = 'critical';

$result['label'] = __( 'Could not reach WordPress.org' );
$result['label'] = __( 'Could not reach ClassicPress.net' );

$result['description'] .= sprintf(
'<p>%s</p>',
Expand All @@ -1448,8 +1394,8 @@ public function get_test_dotorg_communication() {
__( 'Error' ),
sprintf(
/* translators: 1: The IP address WordPress.org resolves to. 2: The error returned by the lookup. */
__( 'Your site is unable to reach WordPress.org at %1$s, and returned the error: %2$s' ),
gethostbyname( 'api.wordpress.org' ),
__( 'Your site is unable to reach ClassicPress.net at %1$s, and returned the error: %2$s' ),
gethostbyname( 'api-v1.classicpress.net' ),
$wp_dotorg->get_error_message()
)
)
Expand Down Expand Up @@ -2532,9 +2478,9 @@ public function get_test_persistent_object_cache() {
public static function get_tests() {
$tests = array(
'direct' => array(
'wordpress_version' => array(
'classicpress_version' => array(
'label' => __( 'ClassicPress Version' ),
'test' => 'wordpress_version',
'test' => 'classicpress_version',
),
'plugin_version' => array(
'label' => __( 'Plugin Versions' ),
Expand Down Expand Up @@ -2600,7 +2546,7 @@ public static function get_tests() {
),
'async' => array(
'dotorg_communication' => array(
'label' => __( 'Communication with WordPress.org' ),
'label' => __( 'Communication with ClassicPress.net' ),
'test' => rest_url( 'wp-site-health/v1/tests/dotorg-communication' ),
'has_rest' => true,
'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_dotorg_communication' ),
Expand Down
3 changes: 1 addition & 2 deletions wp-admin/includes/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1646,8 +1646,7 @@ function register_and_do_post_meta_boxes( $post ) {
'normal',
'core',
array(
'__back_compat_meta_box' => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ),
'__block_editor_compatible_meta_box' => true,
'__back_compat_meta_box' => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ),
)
);
}
Expand Down
6 changes: 3 additions & 3 deletions wp-admin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ function display_header( $body_classes = '' ) {
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
<title><?php _e( 'ClassicPress &rsaquo; Installation' ); ?></title>
<?php wp_admin_css( 'install', true ); ?>
</head>
<body class="wp-core-ui<?php echo $body_classes; ?>">
<p id="logo"><?php _e( 'WordPress' ); ?></p>
<p id="logo"><?php _e( 'ClassicPress' ); ?></p>

<?php
} // End display_header().
Expand Down Expand Up @@ -212,7 +212,7 @@ function display_setup_form( $error = null ) {
</td>
</tr>
</table>
<p class="step"><?php submit_button( __( 'Install WordPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p>
<p class="step"><?php submit_button( __( 'Install ClassicPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p>
<input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" />
</form>
<?php
Expand Down
13 changes: 11 additions & 2 deletions wp-includes/class-wp-theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final class WP_Theme implements ArrayAccess {
* @since 3.4.0
* @since 5.4.0 Added `Requires at least` and `Requires PHP` headers.
* @since 6.1.0 Added `Update URI` header.
* @since CP-2.0.0 Added support for `Requires CP` header and fallback for `Update URI`.
* @var string[]
*/
private static $file_headers = array(
Expand All @@ -40,6 +41,7 @@ final class WP_Theme implements ArrayAccess {
'TextDomain' => 'Text Domain',
'DomainPath' => 'Domain Path',
'RequiresWP' => 'Requires at least',
'RequiresCP' => 'Requires CP',
'RequiresPHP' => 'Requires PHP',
'UpdateURI' => 'Update URI',
);
Expand Down Expand Up @@ -293,6 +295,10 @@ public function __construct( $theme_dir, $theme_root, $_child = null ) {
return;
} else {
$this->headers = get_file_data( $this->theme_root . '/' . $theme_file, self::$file_headers, 'theme' );
// If no Update URI is defined and Requires CP is set fall back to ClassicPress directory URL.
if ( ! $this->headers['UpdateURI'] && filter_var( $this->headers['RequiresCP'], FILTER_VALIDATE_FLOAT ) !== false ) {
$this->headers['UpdateURI'] = 'https://directory.classicpress.net/wp-json/wp/v2/themes?byslug=' . preg_replace( '/[^a-zA-Z0-9_\-]/', '', $this->stylesheet );
}
// Default themes always trump their pretenders.
// Properly identify default themes that are inside a directory within wp-content/themes.
$default_theme_slug = array_search( $this->headers['Name'], self::$default_themes, true );
Expand Down Expand Up @@ -831,10 +837,12 @@ public function display( $header, $markup = true, $translate = true ) {
* @since 3.4.0
* @since 5.4.0 Added support for `Requires at least` and `Requires PHP` headers.
* @since 6.1.0 Added support for `Update URI` header.
* @since CP-2.0.0 Added support for `Requires CP` header.
*
*
* @param string $header Theme header. Accepts 'Name', 'Description', 'Author', 'Version',
* 'ThemeURI', 'AuthorURI', 'Status', 'Tags', 'RequiresWP', 'RequiresPHP',
* 'UpdateURI'.
* 'ThemeURI', 'AuthorURI', 'Status', 'Tags', 'RequiresWP',
* 'RequiresCP', 'RequiresPHP', 'UpdateURI'.
* @param string $value Value to sanitize.
* @return string|array An array for Tags header, string otherwise.
*/
Expand Down Expand Up @@ -884,6 +892,7 @@ private function sanitize_header( $header, $value ) {
case 'Version':
case 'RequiresWP':
case 'RequiresPHP':
case 'RequiresCP':
case 'UpdateURI':
$value = strip_tags( $value );
break;
Expand Down
Loading

0 comments on commit 8e0fc1d

Please sign in to comment.