Core_Command::get_core_checksums PHP Method

get_core_checksums() private static method

Security copy of the core function with Requests - Gets the checksums for the given version of WordPress.
private static get_core_checksums ( string $version, string $locale ) : boolean | array
$version string Version string to query.
$locale string Locale to query.
return boolean | array False on failure. An array of checksums on success.
    private static function get_core_checksums($version, $locale)
    {
        $url = 'https://api.wordpress.org/core/checksums/1.0/?' . http_build_query(compact('version', 'locale'), null, '&');
        $options = array('timeout' => 30);
        $headers = array('Accept' => 'application/json');
        $response = Utils\http_request('GET', $url, null, $headers, $options);
        if (!$response->success || 200 != $response->status_code) {
            return false;
        }
        $body = trim($response->body);
        $body = json_decode($body, true);
        if (!is_array($body) || !isset($body['checksums']) || !is_array($body['checksums'])) {
            return false;
        }
        return $body['checksums'];
    }