auto-patch 638-dev-dev01-2024-05-14T20_44_36
This commit is contained in:
@@ -33,7 +33,7 @@ class WPSEO_Upgrade_History {
|
||||
/**
|
||||
* Retrieves the content of the history items currently stored.
|
||||
*
|
||||
* @return array The contents of the history option.
|
||||
* @return array<array<string>> The contents of the history option.
|
||||
*/
|
||||
public function get() {
|
||||
$data = get_option( $this->get_option_name(), [] );
|
||||
@@ -47,9 +47,9 @@ class WPSEO_Upgrade_History {
|
||||
/**
|
||||
* Adds a new history entry in the storage.
|
||||
*
|
||||
* @param string $old_version The version we are upgrading from.
|
||||
* @param string $new_version The version we are upgrading to.
|
||||
* @param array $option_names The options that need to be stored.
|
||||
* @param string $old_version The version we are upgrading from.
|
||||
* @param string $new_version The version we are upgrading to.
|
||||
* @param array<string> $option_names The options that need to be stored.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -76,23 +76,24 @@ class WPSEO_Upgrade_History {
|
||||
/**
|
||||
* Retrieves the data for the specified option names from the database.
|
||||
*
|
||||
* @param array $option_names The option names to retrieve.
|
||||
* @param array<string> $option_names The option names to retrieve.
|
||||
*
|
||||
* @return array
|
||||
* @return array<int|string|bool|float,array<string|int|bool|float>> The retrieved data.
|
||||
*/
|
||||
protected function get_options_data( array $option_names ) {
|
||||
$wpdb = $this->get_wpdb();
|
||||
|
||||
$sql = $wpdb->prepare(
|
||||
'
|
||||
SELECT option_value, option_name FROM ' . $wpdb->options . ' WHERE
|
||||
option_name IN ( ' . implode( ',', array_fill( 0, count( $option_names ), '%s' ) ) . ' )
|
||||
',
|
||||
$option_names
|
||||
$results = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
'
|
||||
SELECT %i, %i FROM ' . $wpdb->options . ' WHERE
|
||||
%i IN ( ' . implode( ',', array_fill( 0, count( $option_names ), '%s' ) ) . ' )
|
||||
',
|
||||
array_merge( [ 'option_value', 'option_name', 'option_name' ], $option_names )
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
$results = $wpdb->get_results( $sql, ARRAY_A );
|
||||
|
||||
$data = [];
|
||||
foreach ( $results as $result ) {
|
||||
$data[ $result['option_name'] ] = maybe_unserialize( $result['option_value'] );
|
||||
@@ -104,7 +105,7 @@ class WPSEO_Upgrade_History {
|
||||
/**
|
||||
* Stores the new history state.
|
||||
*
|
||||
* @param array $data The data to store.
|
||||
* @param array<array<string>> $data The data to store.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user