This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,155 @@
<?php
/**
* Yoast SEO Plugin File.
*
* @package WPSEO\Migrations
*/
use Yoast\WP\SEO\ORM\Yoast_Model;
use YoastSEO_Vendor\Ruckusing_Migration_Base;
/**
* Indexable migration.
*/
class WpYoastIndexable extends Ruckusing_Migration_Base {
/**
* Migration up.
*/
public function up() {
$table_name = $this->get_table_name();
$indexable_table = $this->create_table( $table_name );
$indexable_table->column( 'permalink', 'string', [ 'null' => true, 'limit' => 191 ] );
$indexable_table->column( 'object_id', 'integer', [ 'unsigned' => true, 'null' => true, 'limit' => 11 ] );
$indexable_table->column( 'object_type', 'string', [ 'limit' => 16 ] );
$indexable_table->column( 'object_sub_type', 'string', [ 'null' => true, 'limit' => 100 ] );
$indexable_table->column(
'number_of_pages',
'integer',
[
'unsigned' => true,
'null' => true,
'default' => null,
'limit' => 11,
]
);
$indexable_table->column( 'canonical', 'string', [ 'null' => true, 'limit' => 191 ] );
$indexable_table->column( 'title', 'string', [ 'null' => true, 'limit' => 191 ] );
$indexable_table->column( 'description', 'text', [ 'null' => true ] );
$indexable_table->column( 'breadcrumb_title', 'string', [ 'null' => true, 'limit' => 191 ] );
$indexable_table->column( 'is_robots_noindex', 'boolean', [ 'null' => true, 'default' => false ] );
$indexable_table->column( 'is_robots_nofollow', 'boolean', [ 'null' => true, 'default' => false ] );
$indexable_table->column( 'is_robots_noarchive', 'boolean', [ 'null' => true, 'default' => false ] );
$indexable_table->column( 'is_robots_noimageindex', 'boolean', [ 'null' => true, 'default' => false ] );
$indexable_table->column( 'is_robots_nosnippet', 'boolean', [ 'null' => true, 'default' => false ] );
$indexable_table->column( 'primary_focus_keyword', 'string', [ 'null' => true, 'limit' => 191 ] );
$indexable_table->column( 'primary_focus_keyword_score', 'integer', [ 'null' => true, 'limit' => 3 ] );
$indexable_table->column( 'readability_score', 'integer', [ 'null' => true, 'limit' => 3 ] );
$indexable_table->column( 'is_cornerstone', 'boolean', [ 'default' => false ] );
$indexable_table->column( 'link_count', 'integer', [ 'null' => true, 'limit' => 11 ] );
$indexable_table->column( 'incoming_link_count', 'integer', [ 'null' => true, 'limit' => 11 ] );
// Exexcute the SQL to create the table.
$indexable_table->finish();
$this->add_index(
$table_name,
[
'permalink',
],
[
'name' => 'unique_permalink',
'unique' => true,
]
);
$this->add_index(
$table_name,
[
'object_type',
'object_sub_type',
],
[
'name' => 'indexable',
]
);
$this->add_index(
$table_name,
[
'primary_focus_keyword_score',
'object_type',
'object_sub_type',
],
[
'name' => 'primary_focus_keyword_score',
]
);
$this->add_index(
$table_name,
[
'is_cornerstone',
'object_type',
'object_sub_type',
],
[
'name' => 'cornerstones',
]
);
$this->add_index(
$table_name,
[
'incoming_link_count',
'object_type',
'object_sub_type',
],
[
'name' => 'orphaned_content',
]
);
$this->add_index(
$table_name,
[
'is_robots_noindex',
'object_id',
'object_type',
'object_sub_type',
],
[
'name' => 'robots_noindex',
]
);
$this->add_timestamps( $table_name );
}
/**
* Migration down.
*/
public function down() {
$this->drop_table( $this->get_table_name() );
}
/**
* Retrieves the table name to use.
*
* @return string The table name to use.
*/
protected function get_table_name() {
return Yoast_Model::get_table_name( 'Indexable' );
}
}

View File

@@ -0,0 +1,96 @@
<?php
/**
* Yoast SEO Plugin File.
*
* @package WPSEO\Migrations
*/
use Yoast\WP\SEO\ORM\Yoast_Model;
use YoastSEO_Vendor\Ruckusing_Migration_Base;
/**
* Migration for the Primary Term.
*/
class WpYoastPrimaryTerm extends Ruckusing_Migration_Base {
/**
* Migration up.
*
* @return void
*/
public function up() {
$table_name = $this->get_table_name();
$indexable_table = $this->create_table( $table_name );
$indexable_table->column(
'post_id',
'integer',
[
'unsigned' => true,
'null' => false,
'limit' => 11,
]
);
$indexable_table->column(
'term_id',
'integer',
[
'unsigned' => true,
'null' => false,
'limit' => 11,
]
);
$indexable_table->column(
'taxonomy',
'string',
[
'null' => false,
'limit' => 191,
]
);
// Executes the SQL to create the table.
$indexable_table->finish();
$this->add_index(
$table_name,
[
'post_id',
'taxonomy',
],
[
'name' => 'post_taxonomy',
]
);
$this->add_index(
$table_name,
[
'post_id',
'term_id',
],
[
'name' => 'post_term',
]
);
$this->add_timestamps( $table_name );
}
/**
* Migration down.
*/
public function down() {
$this->drop_table( $this->get_table_name() );
}
/**
* Retrieves the table name to use.
*
* @return string Table name to use.
*/
protected function get_table_name() {
return Yoast_Model::get_table_name( 'Primary_Term' );
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Yoast SEO Plugin File.
*
* @package WPSEO\Migrations
*/
use Yoast\WP\SEO\ORM\Yoast_Model;
use YoastSEO_Vendor\Ruckusing_Migration_Base;
/**
* Class DropIndexableMetaTableIfExists
*/
class WpYoastDropIndexableMetaTableIfExists extends Ruckusing_Migration_Base {
/**
* Migration up.
*/
public function up() {
$table_name = $this->get_table_name();
// This can be done safely as it executes a DROP IF EXISTS.
$this->drop_table( $table_name );
}
/**
* Migration down.
*/
public function down() {
// No down required. This specific table should never exist.
}
/**
* Retrieves the table name to use.
*
* @return string The table name to use.
*/
protected function get_table_name() {
return Yoast_Model::get_table_name( 'Indexable_Meta' );
}
}

View File

@@ -0,0 +1,86 @@
<?php
/**
* Yoast SEO Plugin File.
*
* @package WPSEO\Migrations
*/
use Yoast\WP\SEO\ORM\Yoast_Model;
use YoastSEO_Vendor\Ruckusing_Migration_Base;
/**
* Class WpYoastExpandIndexable
*/
class WpYoastExpandIndexable extends Ruckusing_Migration_Base {
/**
* Migration up.
*/
public function up() {
$table_name = $this->get_table_name();
$this->add_column( $table_name, 'og_title', 'string', [ 'null' => true, 'limit' => 191 ] );
$this->add_column( $table_name, 'og_image', 'mediumtext', [ 'null' => true ] );
$this->add_column( $table_name, 'og_description', 'mediumtext', [ 'null' => true ] );
$this->add_column( $table_name, 'twitter_title', 'string', [ 'null' => true, 'limit' => 191 ] );
$this->add_column( $table_name, 'twitter_image', 'mediumtext', [ 'null' => true ] );
$this->add_column( $table_name, 'twitter_description', 'mediumtext', [ 'null' => true ] );
$this->add_column( $table_name, 'permalink_hash', 'string', [ 'null' => true, 'limit' => 191 ] );
$this->add_index( $table_name, 'permalink_hash' );
$this->remove_index(
$table_name,
[
'permalink',
],
[
'name' => 'unique_permalink',
'unique' => true,
]
);
$this->change_column( $table_name, 'permalink', 'mediumtext', [ 'null' => true ] );
$this->change_column( $table_name, 'canonical', 'mediumtext', [ 'null' => true ] );
}
/**
* Migration down.
*/
public function down() {
$table_name = $this->get_table_name();
$this->remove_column( $table_name, 'og_title' );
$this->remove_column( $table_name, 'og_image' );
$this->remove_column( $table_name, 'og_description' );
$this->remove_column( $table_name, 'twitter_title' );
$this->remove_column( $table_name, 'twitter_image' );
$this->remove_column( $table_name, 'twitter_description' );
$this->remove_index( $table_name, 'permalink_hash' );
$this->remove_column( $table_name, 'permalink_hash' );
$this->change_column( $table_name, 'permalink', 'string', [ 'null' => true, 'limit' => 191 ] );
$this->change_column( $table_name, 'canonical', 'string', [ 'null' => true, 'limit' => 191 ] );
$this->add_index(
$table_name,
[
'permalink',
],
[
'name' => 'unique_permalink',
'unique' => true,
]
);
}
/**
* Retrieves the table name to use.
*
* @return string The table name to use.
*/
protected function get_table_name() {
return Yoast_Model::get_table_name( 'Indexable' );
}
}

View File

@@ -0,0 +1,7 @@
The ruckusing framework requires a constant to be defined that points to a directory that matches the directory structure it itself uses.
From there it will require files to load. If the plugin is installed with composer we have no way of determining where ruckusing is installed.
This doesn't matter any way as all it's files are autoloaded. Instead we just give it a directory that matches it's own structure with no files.
Ruckusing will then scan this directory and not load any files. Then see that all the classes it wanted exist anyway and happily continue on.

View File

@@ -0,0 +1,7 @@
The ruckusing framework requires a constant to be defined that points to a directory that matches the directory structure it itself uses.
From there it will require files to load. If the plugin is installed with composer we have no way of determining where ruckusing is installed.
This doesn't matter any way as all it's files are autoloaded. Instead we just give it a directory that matches it's own structure with no files.
Ruckusing will then scan this directory and not load any files. Then see that all the classes it wanted exist anyway and happily continue on.