get_core_checksums( string $version, string $locale )
Gets the checksums for the given version of ClassicPress.
Parameters
- $version
-
(Required) Version string to query.
- $locale
-
(Required) Locale to query.
Return
(bool|array) False on failure. An array of checksums on success.
Source
File: wp-admin/includes/update.php
function get_core_checksums( $version, $locale ) {
$url = 'https://api-v1.classicpress.net/checksums/md5/' . $version . '.json';
$options = array(
'timeout' => wp_doing_cron() ? 30 : 3,
);
$response = wp_remote_get( $url, $options );
if ( is_wp_error( $response ) ) {
trigger_error(
sprintf(
/* translators: %s: support forums URL */
__( 'An unexpected error occurred. Something may be wrong with ClassicPress.net or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
__( 'https://forums.classicpress.net/c/support' )
) . ' ' . __( '(ClassicPress could not establish a secure connection to ClassicPress.net. Please contact your server administrator.)' ),
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
);
// Retry request
$response = wp_remote_get( $url, $options );
}
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
return false;
}
$body = trim( wp_remote_retrieve_body( $response ) );
$body = json_decode( $body, true );
if (
! is_array( $body ) ||
! isset( $body['checksums'] ) ||
! is_array( $body['checksums'] )
) {
return false;
}
return $body['checksums'];
}
Changelog
Version | Description |
---|---|
1.3.0 | Correctly returns checksums for the given ClassicPress version, not the WordPress version. The $locale parameter is now ignored. |
WP-3.7.0 | Introduced. |