Edit File by line
/home/barbar84/www/wp-conte.../plugins/wordpres.../src/config/migratio...
File: 20200507054848_DeleteDuplicateIndexables.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Config\Migrations;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\Lib\Migrations\Migration;
[4] Fix | Delete
use Yoast\WP\Lib\Model;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Class DeleteDuplicateIndexables.
[8] Fix | Delete
*/
[9] Fix | Delete
class DeleteDuplicateIndexables extends Migration {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* The plugin this migration belongs to.
[13] Fix | Delete
*
[14] Fix | Delete
* @var string
[15] Fix | Delete
*/
[16] Fix | Delete
public static $plugin = 'free';
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Migration up.
[20] Fix | Delete
*/
[21] Fix | Delete
public function up() {
[22] Fix | Delete
$table_name = $this->get_table_name();
[23] Fix | Delete
[24] Fix | Delete
/*
[25] Fix | Delete
* Deletes duplicate indexables that have the same object_id and object_type.
[26] Fix | Delete
* The rows with a higher ID are deleted as those should be unused and could be outdated.
[27] Fix | Delete
*/
[28] Fix | Delete
$this->query( 'DELETE wyi FROM ' . $table_name . ' wyi INNER JOIN ' . $table_name . ' wyi2 WHERE wyi2.object_id = wyi.object_id AND wyi2.object_type = wyi.object_type AND wyi2.id < wyi.id;' );
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Migration down.
[33] Fix | Delete
*/
[34] Fix | Delete
public function down() {
[35] Fix | Delete
// Nothing to do.
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* Retrieves the table name to use.
[40] Fix | Delete
*
[41] Fix | Delete
* @return string The table name to use.
[42] Fix | Delete
*/
[43] Fix | Delete
protected function get_table_name() {
[44] Fix | Delete
return Model::get_table_name( 'Indexable' );
[45] Fix | Delete
}
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function