, __( 'Invalid cookie format.' ) );
}
return $parts;
}
/**
* Generates the recovery mode cookie value.
*
* The cookie is a base64 encoded string with the following format:
*
* recovery_mode|iat|rand|signature
*
* Where "recovery_mode" is a constant string,
* iat is the time the cookie was generated at,
* rand is a randomly generated password that is also used as a session identifier
* and signature is an hmac of the preceding 3 parts.
*
* @since 5.2.0
*
* @return string Generated cookie content.
*/
private function generate_cookie() {
$to_sign = sprintf( 'recovery_mode|%s|%s', time(), wp_generate_password( 20, false ) );
$signed = $this->recovery_mode_hash( $to_sign );
return base64_encode( sprintf( '%s|%s', $to_sign, $signed ) );
}
/**
* Gets a form of `wp_hash()` specific to Recovery Mode.
*
* We cannot use `wp_hash()` because it is defined in `pluggable.php` which is not loaded until after plugins are loaded,
* which is too late to verify the recovery mode cookie.
*
* This tries to use the `AUTH` salts first, but if they aren't valid specific salts will be generated and stored.
*
* @since 5.2.0
*
* @param string $data Data to hash.
* @return string|false The hashed $data, or false on failure.
*/
private function recovery_mode_hash( $data ) {
if ( ! defined( 'AUTH_KEY' ) || AUTH_KEY === 'put your unique phrase here' ) {
$auth_key = get_site_option( 'recovery_mode_auth_key' );
if ( ! $auth_key ) {
if ( ! function_exists( 'wp_generate_password' ) ) {
require_once ABSPATH . WPINC . '/pluggable.php';
}
$auth_key = wp_generate_password( 64, true, true );
update_site_option( 'recovery_mode_auth_key', $auth_key );
}
} else {
$auth_key = AUTH_KEY;
}
if ( ! defined( 'AUTH_SALT' ) || AUTH_SALT === 'put your unique phrase here' || AUTH_SALT === $auth_key ) {
$auth_salt = get_site_option( 'recovery_mode_auth_salt' );
if ( ! $auth_salt ) {
if ( ! function_exists( 'wp_generate_password' ) ) {
require_once ABSPATH . WPINC . '/pluggable.php';
}
$auth_salt = wp_generate_password( 64, true, true );
update_site_option( 'recovery_mode_auth_salt', $auth_salt );
}
} else {
$auth_salt = AUTH_SALT;
}
$secret = $auth_key . $auth_salt;
return hash_hmac( 'sha1', $data, $secret );
}
}
Fatal error: Uncaught Error: Class 'WP_Recovery_Mode_Cookie_Service' not found in /home/ghalamokaaghaz/public_html/wp-includes/class-wp-recovery-mode.php:80
Stack trace:
#0 /home/ghalamokaaghaz/public_html/wp-includes/error-protection.php(153): WP_Recovery_Mode->__construct()
#1 /home/ghalamokaaghaz/public_html/wp-settings.php(420): wp_recovery_mode()
#2 /home/ghalamokaaghaz/public_html/wp-config.php(174): require_once('/home/ghalamoka...')
#3 /home/ghalamokaaghaz/public_html/wp-load.php(50): require_once('/home/ghalamoka...')
#4 /home/ghalamokaaghaz/public_html/wp-blog-header.php(13): require_once('/home/ghalamoka...')
#5 /home/ghalamokaaghaz/public_html/index.php(17): require('/home/ghalamoka...')
#6 {main}
thrown in /home/ghalamokaaghaz/public_html/wp-includes/class-wp-recovery-mode.php on line 80
Fatal error: Uncaught Error: Class 'WP_Recovery_Mode_Cookie_Service' not found in /home/ghalamokaaghaz/public_html/wp-includes/class-wp-recovery-mode.php:80
Stack trace:
#0 /home/ghalamokaaghaz/public_html/wp-includes/error-protection.php(153): WP_Recovery_Mode->__construct()
#1 /home/ghalamokaaghaz/public_html/wp-includes/class-wp-fatal-error-handler.php(51): wp_recovery_mode()
#2 [internal function]: WP_Fatal_Error_Handler->handle()
#3 {main}
thrown in /home/ghalamokaaghaz/public_html/wp-includes/class-wp-recovery-mode.php on line 80