Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wordpres.../src/user-met.../infrastr...
File: cleanup-repository.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\User_Meta\Infrastructure;
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* Repository going into the database to clean up.
[5] Fix | Delete
*/
[6] Fix | Delete
class Cleanup_Repository {
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Deletes empty usermeta based on their meta_keys and returns the number of the deleted meta.
[10] Fix | Delete
*
[11] Fix | Delete
* @param array<string> $meta_keys The meta to be potentially deleted.
[12] Fix | Delete
* @param int $limit The number of maximum deletions.
[13] Fix | Delete
*
[14] Fix | Delete
* @return int|false The number of rows that was deleted or false if the query failed.
[15] Fix | Delete
*/
[16] Fix | Delete
public function delete_empty_usermeta_query( $meta_keys, $limit ) {
[17] Fix | Delete
global $wpdb;
[18] Fix | Delete
[19] Fix | Delete
// phpcs:disable WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber -- Reason: we're passing an array instead.
[20] Fix | Delete
$delete_query = $wpdb->prepare(
[21] Fix | Delete
'DELETE FROM %i
[22] Fix | Delete
WHERE meta_key IN ( ' . \implode( ', ', \array_fill( 0, \count( $meta_keys ), '%s' ) ) . ' )
[23] Fix | Delete
AND meta_value = ""
[24] Fix | Delete
ORDER BY user_id
[25] Fix | Delete
LIMIT %d',
[26] Fix | Delete
\array_merge( [ $wpdb->usermeta ], $meta_keys, [ $limit ] )
[27] Fix | Delete
);
[28] Fix | Delete
// phpcs:enable
[29] Fix | Delete
[30] Fix | Delete
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
[31] Fix | Delete
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
[32] Fix | Delete
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already.
[33] Fix | Delete
return $wpdb->query( $delete_query );
[34] Fix | Delete
// phpcs:enable
[35] Fix | Delete
}
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function