Edit File by line
/home/barbar84/www/wp-conte.../plugins/wordpres.../src/config/migratio...
File: 20200616130143_ReplacePermalinkHashIndex.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
* ReplacePermalinkHashIndex class.
[8] Fix | Delete
*/
[9] Fix | Delete
class ReplacePermalinkHashIndex 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
* @return void
[22] Fix | Delete
*/
[23] Fix | Delete
public function up() {
[24] Fix | Delete
$table_name = $this->get_table_name();
[25] Fix | Delete
$adapter = $this->get_adapter();
[26] Fix | Delete
[27] Fix | Delete
if ( ! $adapter->has_table( $table_name ) ) {
[28] Fix | Delete
return;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
$this->change_column(
[32] Fix | Delete
$table_name,
[33] Fix | Delete
'permalink_hash',
[34] Fix | Delete
'string',
[35] Fix | Delete
[
[36] Fix | Delete
'null' => true,
[37] Fix | Delete
'limit' => 40,
[38] Fix | Delete
]
[39] Fix | Delete
);
[40] Fix | Delete
[41] Fix | Delete
if ( $adapter->has_index( $table_name, [ 'permalink_hash' ], [ 'name' => 'permalink_hash' ] ) ) {
[42] Fix | Delete
$this->remove_index(
[43] Fix | Delete
$table_name,
[44] Fix | Delete
[
[45] Fix | Delete
'permalink_hash',
[46] Fix | Delete
],
[47] Fix | Delete
[
[48] Fix | Delete
'name' => 'permalink_hash',
[49] Fix | Delete
]
[50] Fix | Delete
);
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
if ( ! $adapter->has_index( $table_name, [ 'permalink_hash', 'object_type' ], [ 'name' => 'permalink_hash_and_object_type' ] ) ) {
[54] Fix | Delete
$this->add_index(
[55] Fix | Delete
$table_name,
[56] Fix | Delete
[
[57] Fix | Delete
'permalink_hash',
[58] Fix | Delete
'object_type',
[59] Fix | Delete
],
[60] Fix | Delete
[
[61] Fix | Delete
'name' => 'permalink_hash_and_object_type',
[62] Fix | Delete
]
[63] Fix | Delete
);
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
/**
[68] Fix | Delete
* Migration down.
[69] Fix | Delete
*
[70] Fix | Delete
* @return void
[71] Fix | Delete
*/
[72] Fix | Delete
public function down() {
[73] Fix | Delete
$table_name = $this->get_table_name();
[74] Fix | Delete
$adapter = $this->get_adapter();
[75] Fix | Delete
[76] Fix | Delete
if ( ! $adapter->has_table( $table_name ) ) {
[77] Fix | Delete
return;
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
if ( $adapter->has_index( $table_name, [ 'permalink_hash', 'object_type' ], [ 'name' => 'permalink_hash_and_object_type' ] ) ) {
[81] Fix | Delete
$this->remove_index(
[82] Fix | Delete
$table_name,
[83] Fix | Delete
[
[84] Fix | Delete
'permalink_hash',
[85] Fix | Delete
'object_type',
[86] Fix | Delete
],
[87] Fix | Delete
[
[88] Fix | Delete
'name' => 'permalink_hash_and_object_type',
[89] Fix | Delete
]
[90] Fix | Delete
);
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
$this->change_column(
[94] Fix | Delete
$table_name,
[95] Fix | Delete
'permalink_hash',
[96] Fix | Delete
'string',
[97] Fix | Delete
[
[98] Fix | Delete
'null' => true,
[99] Fix | Delete
'limit' => 191,
[100] Fix | Delete
]
[101] Fix | Delete
);
[102] Fix | Delete
[103] Fix | Delete
if ( ! $adapter->has_index( $table_name, [ 'permalink_hash' ], [ 'name' => 'permalink_hash' ] ) ) {
[104] Fix | Delete
$this->add_index(
[105] Fix | Delete
$table_name,
[106] Fix | Delete
[
[107] Fix | Delete
'permalink_hash',
[108] Fix | Delete
],
[109] Fix | Delete
[
[110] Fix | Delete
'name' => 'permalink_hash',
[111] Fix | Delete
]
[112] Fix | Delete
);
[113] Fix | Delete
}
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
/**
[117] Fix | Delete
* Retrieves the table name to use for storing indexables.
[118] Fix | Delete
*
[119] Fix | Delete
* @return string The table name to use.
[120] Fix | Delete
*/
[121] Fix | Delete
protected function get_table_name() {
[122] Fix | Delete
return Model::get_table_name( 'Indexable' );
[123] Fix | Delete
}
[124] Fix | Delete
}
[125] Fix | Delete
[126] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function