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/clone/wp-conte.../plugins/wordpres.../src/user-met.../applicat...
File: cleanup-service.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\User_Meta\Application;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\User_Meta\Infrastructure\Cleanup_Repository;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Service with all usermeta cleanup queries.
[7] Fix | Delete
*/
[8] Fix | Delete
class Cleanup_Service {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* The additional contactmethods collector.
[12] Fix | Delete
*
[13] Fix | Delete
* @var Additional_Contactmethods_Collector $additional_contactmethods_collector The additional contactmethods collector.
[14] Fix | Delete
*/
[15] Fix | Delete
private $additional_contactmethods_collector;
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* The custom meta collector.
[19] Fix | Delete
*
[20] Fix | Delete
* @var Custom_Meta_Collector $custom_meta_collector The custom meta collector.
[21] Fix | Delete
*/
[22] Fix | Delete
private $custom_meta_collector;
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* The cleanup repository.
[26] Fix | Delete
*
[27] Fix | Delete
* @var Cleanup_Repository $custom_meta_collector The custom meta repository.
[28] Fix | Delete
*/
[29] Fix | Delete
private $cleanup_repository;
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* The constructor.
[33] Fix | Delete
*
[34] Fix | Delete
* @param Additional_Contactmethods_Collector $additional_contactmethods_collector The additional contactmethods collector.
[35] Fix | Delete
* @param Custom_Meta_Collector $custom_meta_collector The custom meta collector.
[36] Fix | Delete
* @param Cleanup_Repository $cleanup_repository The cleanup repository.
[37] Fix | Delete
*/
[38] Fix | Delete
public function __construct(
[39] Fix | Delete
Additional_Contactmethods_Collector $additional_contactmethods_collector,
[40] Fix | Delete
Custom_Meta_Collector $custom_meta_collector,
[41] Fix | Delete
Cleanup_Repository $cleanup_repository
[42] Fix | Delete
) {
[43] Fix | Delete
$this->additional_contactmethods_collector = $additional_contactmethods_collector;
[44] Fix | Delete
$this->custom_meta_collector = $custom_meta_collector;
[45] Fix | Delete
$this->cleanup_repository = $cleanup_repository;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Deletes selected empty usermeta.
[50] Fix | Delete
*
[51] Fix | Delete
* @param int $limit The limit we'll apply to the cleanups.
[52] Fix | Delete
*
[53] Fix | Delete
* @return int|bool The number of rows that was deleted or false if the query failed.
[54] Fix | Delete
*/
[55] Fix | Delete
public function cleanup_selected_empty_usermeta( int $limit ) {
[56] Fix | Delete
$meta_to_check = $this->get_meta_to_check();
[57] Fix | Delete
[58] Fix | Delete
return $this->cleanup_repository->delete_empty_usermeta_query( $meta_to_check, $limit );
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Gets which meta are going to be checked for emptiness.
[63] Fix | Delete
*
[64] Fix | Delete
* @return array<string> The meta to be checked for emptiness.
[65] Fix | Delete
*/
[66] Fix | Delete
private function get_meta_to_check() {
[67] Fix | Delete
$additional_contactmethods = $this->additional_contactmethods_collector->get_additional_contactmethods_keys();
[68] Fix | Delete
$custom_meta = $this->custom_meta_collector->get_non_empty_custom_meta();
[69] Fix | Delete
[70] Fix | Delete
return \array_merge( $additional_contactmethods, $custom_meta );
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function