Edit File by line
/home/barbar84/www/wp-conte.../plugins/wordpres.../src/config/migratio...
File: 20171228151840_WpYoastIndexable.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
* Indexable migration.
[8] Fix | Delete
*/
[9] Fix | Delete
class WpYoastIndexable 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
$this->add_table();
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Migration down.
[29] Fix | Delete
*
[30] Fix | Delete
* @return void
[31] Fix | Delete
*/
[32] Fix | Delete
public function down() {
[33] Fix | Delete
$this->drop_table( $this->get_table_name() );
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* Creates the indexable table.
[38] Fix | Delete
*/
[39] Fix | Delete
private function add_table() {
[40] Fix | Delete
$table_name = $this->get_table_name();
[41] Fix | Delete
[42] Fix | Delete
$indexable_table = $this->create_table( $table_name );
[43] Fix | Delete
[44] Fix | Delete
// Permalink.
[45] Fix | Delete
$indexable_table->column( 'permalink', 'mediumtext', [ 'null' => true ] );
[46] Fix | Delete
$indexable_table->column(
[47] Fix | Delete
'permalink_hash',
[48] Fix | Delete
'string',
[49] Fix | Delete
[
[50] Fix | Delete
'null' => true,
[51] Fix | Delete
'limit' => 191,
[52] Fix | Delete
]
[53] Fix | Delete
);
[54] Fix | Delete
[55] Fix | Delete
// Object information.
[56] Fix | Delete
$indexable_table->column(
[57] Fix | Delete
'object_id',
[58] Fix | Delete
'integer',
[59] Fix | Delete
[
[60] Fix | Delete
'unsigned' => true,
[61] Fix | Delete
'null' => true,
[62] Fix | Delete
'limit' => 11,
[63] Fix | Delete
]
[64] Fix | Delete
);
[65] Fix | Delete
$indexable_table->column(
[66] Fix | Delete
'object_type',
[67] Fix | Delete
'string',
[68] Fix | Delete
[
[69] Fix | Delete
'null' => false,
[70] Fix | Delete
'limit' => 32,
[71] Fix | Delete
]
[72] Fix | Delete
);
[73] Fix | Delete
$indexable_table->column(
[74] Fix | Delete
'object_sub_type',
[75] Fix | Delete
'string',
[76] Fix | Delete
[
[77] Fix | Delete
'null' => true,
[78] Fix | Delete
'limit' => 32,
[79] Fix | Delete
]
[80] Fix | Delete
);
[81] Fix | Delete
[82] Fix | Delete
// Ownership.
[83] Fix | Delete
$indexable_table->column(
[84] Fix | Delete
'author_id',
[85] Fix | Delete
'integer',
[86] Fix | Delete
[
[87] Fix | Delete
'unsigned' => true,
[88] Fix | Delete
'null' => true,
[89] Fix | Delete
'limit' => 11,
[90] Fix | Delete
]
[91] Fix | Delete
);
[92] Fix | Delete
$indexable_table->column(
[93] Fix | Delete
'post_parent',
[94] Fix | Delete
'integer',
[95] Fix | Delete
[
[96] Fix | Delete
'unsigned' => true,
[97] Fix | Delete
'null' => true,
[98] Fix | Delete
'limit' => 11,
[99] Fix | Delete
]
[100] Fix | Delete
);
[101] Fix | Delete
[102] Fix | Delete
// Title and description.
[103] Fix | Delete
$indexable_table->column(
[104] Fix | Delete
'title',
[105] Fix | Delete
'string',
[106] Fix | Delete
[
[107] Fix | Delete
'null' => true,
[108] Fix | Delete
'limit' => 191,
[109] Fix | Delete
]
[110] Fix | Delete
);
[111] Fix | Delete
$indexable_table->column( 'description', 'text', [ 'null' => true ] );
[112] Fix | Delete
$indexable_table->column(
[113] Fix | Delete
'breadcrumb_title',
[114] Fix | Delete
'string',
[115] Fix | Delete
[
[116] Fix | Delete
'null' => true,
[117] Fix | Delete
'limit' => 191,
[118] Fix | Delete
]
[119] Fix | Delete
);
[120] Fix | Delete
[121] Fix | Delete
// Post metadata: status, public, protected.
[122] Fix | Delete
$indexable_table->column(
[123] Fix | Delete
'post_status',
[124] Fix | Delete
'string',
[125] Fix | Delete
[
[126] Fix | Delete
'null' => true,
[127] Fix | Delete
'limit' => 191,
[128] Fix | Delete
]
[129] Fix | Delete
);
[130] Fix | Delete
$indexable_table->column(
[131] Fix | Delete
'is_public',
[132] Fix | Delete
'boolean',
[133] Fix | Delete
[
[134] Fix | Delete
'null' => true,
[135] Fix | Delete
'default' => null,
[136] Fix | Delete
]
[137] Fix | Delete
);
[138] Fix | Delete
$indexable_table->column( 'is_protected', 'boolean', [ 'default' => false ] );
[139] Fix | Delete
$indexable_table->column(
[140] Fix | Delete
'has_public_posts',
[141] Fix | Delete
'boolean',
[142] Fix | Delete
[
[143] Fix | Delete
'null' => true,
[144] Fix | Delete
'default' => null,
[145] Fix | Delete
]
[146] Fix | Delete
);
[147] Fix | Delete
[148] Fix | Delete
$indexable_table->column(
[149] Fix | Delete
'number_of_pages',
[150] Fix | Delete
'integer',
[151] Fix | Delete
[
[152] Fix | Delete
'unsigned' => true,
[153] Fix | Delete
'null' => true,
[154] Fix | Delete
'default' => null,
[155] Fix | Delete
'limit' => 11,
[156] Fix | Delete
]
[157] Fix | Delete
);
[158] Fix | Delete
[159] Fix | Delete
$indexable_table->column( 'canonical', 'mediumtext', [ 'null' => true ] );
[160] Fix | Delete
[161] Fix | Delete
// SEO and readability analysis.
[162] Fix | Delete
$indexable_table->column(
[163] Fix | Delete
'primary_focus_keyword',
[164] Fix | Delete
'string',
[165] Fix | Delete
[
[166] Fix | Delete
'null' => true,
[167] Fix | Delete
'limit' => 191,
[168] Fix | Delete
]
[169] Fix | Delete
);
[170] Fix | Delete
$indexable_table->column(
[171] Fix | Delete
'primary_focus_keyword_score',
[172] Fix | Delete
'integer',
[173] Fix | Delete
[
[174] Fix | Delete
'null' => true,
[175] Fix | Delete
'limit' => 3,
[176] Fix | Delete
]
[177] Fix | Delete
);
[178] Fix | Delete
$indexable_table->column(
[179] Fix | Delete
'readability_score',
[180] Fix | Delete
'integer',
[181] Fix | Delete
[
[182] Fix | Delete
'null' => true,
[183] Fix | Delete
'limit' => 3,
[184] Fix | Delete
]
[185] Fix | Delete
);
[186] Fix | Delete
$indexable_table->column( 'is_cornerstone', 'boolean', [ 'default' => false ] );
[187] Fix | Delete
[188] Fix | Delete
// Robots.
[189] Fix | Delete
$indexable_table->column(
[190] Fix | Delete
'is_robots_noindex',
[191] Fix | Delete
'boolean',
[192] Fix | Delete
[
[193] Fix | Delete
'null' => true,
[194] Fix | Delete
'default' => false,
[195] Fix | Delete
]
[196] Fix | Delete
);
[197] Fix | Delete
$indexable_table->column(
[198] Fix | Delete
'is_robots_nofollow',
[199] Fix | Delete
'boolean',
[200] Fix | Delete
[
[201] Fix | Delete
'null' => true,
[202] Fix | Delete
'default' => false,
[203] Fix | Delete
]
[204] Fix | Delete
);
[205] Fix | Delete
$indexable_table->column(
[206] Fix | Delete
'is_robots_noarchive',
[207] Fix | Delete
'boolean',
[208] Fix | Delete
[
[209] Fix | Delete
'null' => true,
[210] Fix | Delete
'default' => false,
[211] Fix | Delete
]
[212] Fix | Delete
);
[213] Fix | Delete
$indexable_table->column(
[214] Fix | Delete
'is_robots_noimageindex',
[215] Fix | Delete
'boolean',
[216] Fix | Delete
[
[217] Fix | Delete
'null' => true,
[218] Fix | Delete
'default' => false,
[219] Fix | Delete
]
[220] Fix | Delete
);
[221] Fix | Delete
$indexable_table->column(
[222] Fix | Delete
'is_robots_nosnippet',
[223] Fix | Delete
'boolean',
[224] Fix | Delete
[
[225] Fix | Delete
'null' => true,
[226] Fix | Delete
'default' => false,
[227] Fix | Delete
]
[228] Fix | Delete
);
[229] Fix | Delete
[230] Fix | Delete
// Twitter.
[231] Fix | Delete
$indexable_table->column(
[232] Fix | Delete
'twitter_title',
[233] Fix | Delete
'string',
[234] Fix | Delete
[
[235] Fix | Delete
'null' => true,
[236] Fix | Delete
'limit' => 191,
[237] Fix | Delete
]
[238] Fix | Delete
);
[239] Fix | Delete
$indexable_table->column( 'twitter_image', 'mediumtext', [ 'null' => true ] );
[240] Fix | Delete
$indexable_table->column( 'twitter_description', 'mediumtext', [ 'null' => true ] );
[241] Fix | Delete
$indexable_table->column(
[242] Fix | Delete
'twitter_image_id',
[243] Fix | Delete
'string',
[244] Fix | Delete
[
[245] Fix | Delete
'null' => true,
[246] Fix | Delete
'limit' => 191,
[247] Fix | Delete
]
[248] Fix | Delete
);
[249] Fix | Delete
$indexable_table->column(
[250] Fix | Delete
'twitter_image_source',
[251] Fix | Delete
'string',
[252] Fix | Delete
[
[253] Fix | Delete
'null' => true,
[254] Fix | Delete
'limit' => 191,
[255] Fix | Delete
]
[256] Fix | Delete
);
[257] Fix | Delete
[258] Fix | Delete
// Open-Graph.
[259] Fix | Delete
$indexable_table->column(
[260] Fix | Delete
'open_graph_title',
[261] Fix | Delete
'string',
[262] Fix | Delete
[
[263] Fix | Delete
'null' => true,
[264] Fix | Delete
'limit' => 191,
[265] Fix | Delete
]
[266] Fix | Delete
);
[267] Fix | Delete
$indexable_table->column( 'open_graph_description', 'mediumtext', [ 'null' => true ] );
[268] Fix | Delete
$indexable_table->column( 'open_graph_image', 'mediumtext', [ 'null' => true ] );
[269] Fix | Delete
$indexable_table->column(
[270] Fix | Delete
'open_graph_image_id',
[271] Fix | Delete
'string',
[272] Fix | Delete
[
[273] Fix | Delete
'null' => true,
[274] Fix | Delete
'limit' => 191,
[275] Fix | Delete
]
[276] Fix | Delete
);
[277] Fix | Delete
$indexable_table->column(
[278] Fix | Delete
'open_graph_image_source',
[279] Fix | Delete
'string',
[280] Fix | Delete
[
[281] Fix | Delete
'null' => true,
[282] Fix | Delete
'limit' => 191,
[283] Fix | Delete
]
[284] Fix | Delete
);
[285] Fix | Delete
$indexable_table->column( 'open_graph_image_meta', 'text', [ 'null' => true ] );
[286] Fix | Delete
[287] Fix | Delete
// Link count.
[288] Fix | Delete
$indexable_table->column(
[289] Fix | Delete
'link_count',
[290] Fix | Delete
'integer',
[291] Fix | Delete
[
[292] Fix | Delete
'null' => true,
[293] Fix | Delete
'limit' => 11,
[294] Fix | Delete
]
[295] Fix | Delete
);
[296] Fix | Delete
$indexable_table->column(
[297] Fix | Delete
'incoming_link_count',
[298] Fix | Delete
'integer',
[299] Fix | Delete
[
[300] Fix | Delete
'null' => true,
[301] Fix | Delete
'limit' => 11,
[302] Fix | Delete
]
[303] Fix | Delete
);
[304] Fix | Delete
[305] Fix | Delete
// Prominent words.
[306] Fix | Delete
$indexable_table->column(
[307] Fix | Delete
'prominent_words_version',
[308] Fix | Delete
'integer',
[309] Fix | Delete
[
[310] Fix | Delete
'null' => true,
[311] Fix | Delete
'limit' => 11,
[312] Fix | Delete
'unsigned' => true,
[313] Fix | Delete
'default' => null,
[314] Fix | Delete
]
[315] Fix | Delete
);
[316] Fix | Delete
[317] Fix | Delete
$indexable_table->finish();
[318] Fix | Delete
[319] Fix | Delete
$this->add_indexes( $table_name );
[320] Fix | Delete
[321] Fix | Delete
$this->add_timestamps( $table_name );
[322] Fix | Delete
}
[323] Fix | Delete
[324] Fix | Delete
/**
[325] Fix | Delete
* Adds indexes to the indexable table.
[326] Fix | Delete
*
[327] Fix | Delete
* @param string $indexable_table_name The name of the indexable table.
[328] Fix | Delete
*/
[329] Fix | Delete
private function add_indexes( $indexable_table_name ) {
[330] Fix | Delete
$this->add_index(
[331] Fix | Delete
$indexable_table_name,
[332] Fix | Delete
[
[333] Fix | Delete
'object_type',
[334] Fix | Delete
'object_sub_type',
[335] Fix | Delete
],
[336] Fix | Delete
[
[337] Fix | Delete
'name' => 'object_type_and_sub_type',
[338] Fix | Delete
]
[339] Fix | Delete
);
[340] Fix | Delete
[341] Fix | Delete
$this->add_index(
[342] Fix | Delete
$indexable_table_name,
[343] Fix | Delete
'permalink_hash',
[344] Fix | Delete
[
[345] Fix | Delete
'name' => 'permalink_hash',
[346] Fix | Delete
]
[347] Fix | Delete
);
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
/**
[351] Fix | Delete
* Retrieves the table name to use for storing indexables.
[352] Fix | Delete
*
[353] Fix | Delete
* @return string The table name to use.
[354] Fix | Delete
*/
[355] Fix | Delete
protected function get_table_name() {
[356] Fix | Delete
return Model::get_table_name( 'Indexable' );
[357] Fix | Delete
}
[358] Fix | Delete
}
[359] Fix | Delete
[360] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function