Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.103.1
|
||||
*
|
||||
* @since 1.0.103.1
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Enable author sitemap.
|
||||
*/
|
||||
function rank_math_1_0_103_1_update_html_sitemap() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$sitemap_settings = $all_opts['sitemap'];
|
||||
if ( isset( $sitemap_settings['authors_sitemap'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sitemap_settings['authors_sitemap'] = 'on';
|
||||
|
||||
Helper::update_all_settings( null, null, $sitemap_settings );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_103_1_update_html_sitemap();
|
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.104
|
||||
*
|
||||
* @since 1.0.104
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Update TOC block settings on existing sites.
|
||||
*/
|
||||
function rank_math_1_0_104_toc_block_settings() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
$general['toc_block_title'] = 'Table of Contents';
|
||||
$general['toc_block_list_style'] = 'ul';
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_104_toc_block_settings();
|
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.107.3
|
||||
*
|
||||
* @since 1.0.107.3
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Replace %searchphrase% variable to %search_query%
|
||||
*/
|
||||
function rank_math_1_0_107_3_replace_search_variable() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$titles = $all_opts['titles'];
|
||||
|
||||
$titles['search_title'] = str_replace( '%searchphrase%', '%search_query%', $titles['search_title'] );
|
||||
|
||||
RankMath\Helper::update_all_settings( null, $titles, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_107_3_replace_search_variable();
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.110
|
||||
*
|
||||
* @since 1.0.110
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Update the deprecated schema type Attorney and used it as LegalService.
|
||||
*/
|
||||
function rank_math_1_0_110_update_local_business_type() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$titles = $all_opts['titles'];
|
||||
|
||||
if ( 'Attorney' !== $titles['local_business_type'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$titles['local_business_type'] = 'LegalService';
|
||||
|
||||
Helper::update_all_settings( null, $titles, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_110_update_local_business_type();
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.201.1
|
||||
*
|
||||
* @since 1.0.201.1
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Remove the schedule event used to update the prompts.
|
||||
*/
|
||||
function rank_math_1_0_201_1_remove_prompt_event() {
|
||||
wp_clear_scheduled_hook( 'rank_math/content-ai/update_prompts' );
|
||||
}
|
||||
rank_math_1_0_201_1_remove_prompt_event();
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.201
|
||||
*
|
||||
* @since 1.0.201
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Add default values for the new Content AI settings.
|
||||
*/
|
||||
function rank_math_1_0_201_content_ai_settings() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
$general['content_ai_country'] = 'all';
|
||||
$general['content_ai_tone'] = 'Formal';
|
||||
$general['content_ai_audience'] = 'General Audience';
|
||||
$general['content_ai_language'] = Helper::content_ai_default_language();
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
|
||||
// Update credits to array format. This is needed in case the call to credits endpoint on server fails for some reason.
|
||||
Helper::update_credits( get_option( 'rank_math_ca_credits' ) );
|
||||
|
||||
// Fetch credits, plan & refresh date.
|
||||
if ( Helper::is_site_connected() ) {
|
||||
Helper::get_content_ai_credits( true );
|
||||
}
|
||||
}
|
||||
rank_math_1_0_201_content_ai_settings();
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.202.
|
||||
*
|
||||
* @since 1.0.202
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Convert English Language stored in Content AI settings to US English.
|
||||
*/
|
||||
function rank_math_1_0_202_content_ai_convert_english_language() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
if ( ! empty( $general['content_ai_language'] ) && 'English' === $general['content_ai_language'] ) {
|
||||
$general['content_ai_language'] = 'US English';
|
||||
}
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_202_content_ai_convert_english_language();
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.208.
|
||||
*
|
||||
* @since 1.0.208
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
use RankMath\Admin\Admin_Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Migrate users to a new server.
|
||||
*/
|
||||
function rank_math_1_0_208_content_ai_migrate_user() {
|
||||
// Early Bail if site is not connected or doesn't have a Content AI plan.
|
||||
$registered = Admin_Helper::get_registration_data();
|
||||
if (
|
||||
! Helper::get_content_ai_plan() ||
|
||||
empty( $registered ) ||
|
||||
empty( $registered['connected'] ) ||
|
||||
empty( $registered['api_key'] ) ||
|
||||
empty( $registered['username'] )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
Helper::migrate_user_to_nest_js( $registered['username'] );
|
||||
|
||||
set_site_transient( 'rank_math_content_ai_migrating_user', true, 300 ); // Set transient to show Error CTA on Content AI page for 5 minutes to complete the migration.
|
||||
}
|
||||
rank_math_1_0_208_content_ai_migrate_user();
|
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.209.
|
||||
*
|
||||
* @since 1.0.209
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
use RankMath\Admin\Admin_Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Migrate Free Content AI users to a new server.
|
||||
*/
|
||||
function rank_math_1_0_209_content_ai_migrate_user() {
|
||||
// Early Bail if site doesn't have a Content AI plan.
|
||||
if ( ! Helper::get_content_ai_plan() ) {
|
||||
Helper::migrate_user_to_nest_js();
|
||||
}
|
||||
}
|
||||
rank_math_1_0_209_content_ai_migrate_user();
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.211.
|
||||
*
|
||||
* @since 1.0.211
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Add value in options table to show a notification in Dashboard menu on existing setup.
|
||||
*/
|
||||
function rank_math_1_0_211_content_ai_store_notification_option() {
|
||||
update_option( 'rank_math_view_modules', true, false );
|
||||
}
|
||||
rank_math_1_0_211_content_ai_store_notification_option();
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.24.
|
||||
*
|
||||
* @since 1.0.24
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* // Clear SEO Analysis result.
|
||||
*/
|
||||
function rank_math_1_0_24_rseset_options() {
|
||||
delete_option( 'rank_math_seo_analysis_results' );
|
||||
}
|
||||
rank_math_1_0_24_rseset_options();
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.28.
|
||||
*
|
||||
* @since 1.0.28
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Clear SEO Analysis result.
|
||||
*/
|
||||
function rank_math_1_0_28_reset_options() {
|
||||
delete_option( 'rank_math_seo_analysis_results' );
|
||||
}
|
||||
rank_math_1_0_28_reset_options();
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.30
|
||||
*
|
||||
* @since 1.0.30
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Clear SEO Analysis result.
|
||||
*/
|
||||
function rank_math_1_0_30_reset_options() {
|
||||
global $wpdb;
|
||||
|
||||
$table_schema = [
|
||||
"ALTER TABLE {$wpdb->prefix}rank_math_redirections MODIFY sources TEXT CHARACTER SET {$wpdb->charset} COLLATE {$wpdb->charset}_bin NOT NULL;",
|
||||
"ALTER TABLE {$wpdb->prefix}rank_math_redirections_cache MODIFY from_url TEXT CHARACTER SET {$wpdb->charset} COLLATE {$wpdb->charset}_bin NOT NULL;",
|
||||
];
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
||||
foreach ( $table_schema as $table ) {
|
||||
dbDelta( $table );
|
||||
}
|
||||
|
||||
delete_option( 'rank_math_wc_category_base_redirection' );
|
||||
}
|
||||
rank_math_1_0_30_reset_options();
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.36.1
|
||||
*
|
||||
* @since 1.0.36.1
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Clear notice about disconnection.
|
||||
*/
|
||||
function rank_math_1_0_36_1_reset_options() {
|
||||
rank_math()->notification->remove_by_id( 'connect_data_cleared' );
|
||||
}
|
||||
rank_math_1_0_36_1_reset_options();
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.36
|
||||
*
|
||||
* @since 1.0.36
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Admin\Admin_Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Clear SEO Analysis result.
|
||||
*/
|
||||
function rank_math_1_0_36_reset_options() {
|
||||
Admin_Helper::get_registration_data( false );
|
||||
}
|
||||
rank_math_1_0_36_reset_options();
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.37.3
|
||||
*
|
||||
* @since 1.0.37.3
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Update Internal links.
|
||||
*/
|
||||
function rank_math_1_0_37_3_execute_internal_links_cron() {
|
||||
do_action( 'rank_math/links/internal_links' );
|
||||
}
|
||||
rank_math_1_0_37_3_execute_internal_links_cron();
|
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.37
|
||||
*
|
||||
* @since 1.0.37
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Add Dashboard role to admins.
|
||||
*/
|
||||
function rank_math_1_0_37_add_new_caps() {
|
||||
update_option( 'rank_math_registration_skip', 1 );
|
||||
}
|
||||
rank_math_1_0_37_add_new_caps();
|
||||
|
||||
/**
|
||||
* Convert old snippet variables to new one
|
||||
*/
|
||||
function rank_math_1_0_37_convert_snippet_variables() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$titles = $all_opts['titles'];
|
||||
|
||||
// Post Types.
|
||||
$post_types = Helper::get_accessible_post_types();
|
||||
$post_types[] = 'product';
|
||||
|
||||
foreach ( $post_types as $post_type ) {
|
||||
if (
|
||||
isset( $titles[ 'pt_' . $post_type . '_default_snippet_name' ] ) &&
|
||||
'%title%' === $titles[ 'pt_' . $post_type . '_default_snippet_name' ]
|
||||
) {
|
||||
$titles[ 'pt_' . $post_type . '_default_snippet_name' ] = '%seo_title%';
|
||||
}
|
||||
|
||||
if (
|
||||
isset( $titles[ 'pt_' . $post_type . '_default_snippet_desc' ] ) &&
|
||||
'%excerpt%' === $titles[ 'pt_' . $post_type . '_default_snippet_desc' ]
|
||||
) {
|
||||
$titles[ 'pt_' . $post_type . '_default_snippet_desc' ] = '%seo_description%';
|
||||
}
|
||||
}
|
||||
|
||||
Helper::update_all_settings( null, $titles, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_37_convert_snippet_variables();
|
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.39
|
||||
*
|
||||
* @since 1.0.39
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Convert old snippet variables to new one
|
||||
*/
|
||||
function rank_math_1_0_39_update_term_description() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$titles = $all_opts['titles'];
|
||||
|
||||
// Taxonomies.
|
||||
$taxonomies = Helper::get_accessible_taxonomies();
|
||||
|
||||
foreach ( $taxonomies as $taxonomy => $object ) {
|
||||
if ( ! isset( $titles[ 'tax_' . $taxonomy . '_description' ] ) ) {
|
||||
$titles[ 'tax_' . $taxonomy . '_description' ] = '%term_description%';
|
||||
}
|
||||
}
|
||||
|
||||
Helper::update_all_settings( null, $titles, null );
|
||||
}
|
||||
rank_math_1_0_39_update_term_description();
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.40
|
||||
*
|
||||
* @since 1.0.40
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Set Elementor Library Add metabox value to false.
|
||||
*/
|
||||
function rank_math_1_0_40_update_titles_settings() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$titles = $all_opts['titles'];
|
||||
|
||||
if ( isset( $titles['pt_elementor_library_add_meta_box'] ) ) {
|
||||
$titles['pt_elementor_library_add_meta_box'] = 'off';
|
||||
}
|
||||
|
||||
Helper::update_all_settings( null, $titles, null );
|
||||
}
|
||||
rank_math_1_0_40_update_titles_settings();
|
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.42
|
||||
*
|
||||
* @since 1.0.42
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Admin\Database\Database;
|
||||
use RankMath\Redirections\DB;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Set Elementor Library Add metabox value to false.
|
||||
*/
|
||||
function rank_math_1_0_42_delete_fake_redirection() {
|
||||
global $wpdb;
|
||||
|
||||
$table = Database::table( 'rank_math_redirections' );
|
||||
$table->select( 'id' )
|
||||
->whereLike( 'url_to', 'https://ischeck.xyz', '' )
|
||||
->orWhereLike( 'url_to', 'http://ischeck.xyz', '' )
|
||||
->orWhereLike( 'url_to', '//ischeck.xyz', '' );
|
||||
|
||||
$redirections = $table->get( ARRAY_A );
|
||||
$redirections = wp_list_pluck( $redirections, 'id' );
|
||||
|
||||
if ( ! empty( $redirections ) ) {
|
||||
DB::delete( $redirections );
|
||||
}
|
||||
}
|
||||
rank_math_1_0_42_delete_fake_redirection();
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.43
|
||||
*
|
||||
* @since 1.0.43
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Enable the new Image SEO module if either the "add_img_alt" or the
|
||||
* "add_img_title" is being used.
|
||||
*/
|
||||
function rank_math_1_0_43_maybe_enable_image_seo_module() {
|
||||
if ( Helper::get_settings( 'general.add_img_alt' ) || Helper::get_settings( 'general.add_img_title' ) ) {
|
||||
Helper::update_modules( [ 'image-seo' => 'on' ] );
|
||||
}
|
||||
}
|
||||
rank_math_1_0_43_maybe_enable_image_seo_module();
|
||||
|
||||
/**
|
||||
* Update setup mode on existing sites.
|
||||
*/
|
||||
function rank_math_1_0_43_update_setup_mode() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
$general['setup_mode'] = 'advanced';
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_43_update_setup_mode();
|
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.46
|
||||
*
|
||||
* @since 1.0.46
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Enable the core auto update option if it's set in RM.
|
||||
*/
|
||||
function rank_math_1_0_46_maybe_enable_auto_update() {
|
||||
if ( Helper::get_settings( 'general.enable_auto_update' ) ) {
|
||||
Helper::toggle_auto_update_setting( 'on' );
|
||||
}
|
||||
}
|
||||
rank_math_1_0_46_maybe_enable_auto_update();
|
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.47
|
||||
*
|
||||
* @since 1.0.47
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helpers\DB;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* The update routine file functiont to add primary key in rank_math_internal_meta table.
|
||||
*/
|
||||
function rank_math_1_0_47_update_internal_meta_table() {
|
||||
if ( ! is_multisite() ) {
|
||||
rank_math_1_0_47_add_primary_key_to_internal_meta_table();
|
||||
return;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE archived = '0' AND spam = '0' AND deleted = '0'" );
|
||||
if ( ! empty( $blog_ids ) ) {
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
rank_math_1_0_47_add_primary_key_to_internal_meta_table();
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Primary key to internal_meta table.
|
||||
*/
|
||||
function rank_math_1_0_47_add_primary_key_to_internal_meta_table() {
|
||||
if ( ! DB::check_table_exists( 'rank_math_internal_meta' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$row = $wpdb->get_results( "SHOW INDEXES FROM {$wpdb->prefix}rank_math_internal_meta WHERE Key_name = 'PRIMARY'" );
|
||||
if ( empty( $row ) ) {
|
||||
$wpdb->query( "ALTER TABLE {$wpdb->prefix}rank_math_internal_meta DROP INDEX object_id, ADD PRIMARY KEY(object_id);" );
|
||||
}
|
||||
}
|
||||
|
||||
rank_math_1_0_47_update_internal_meta_table();
|
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.49
|
||||
*
|
||||
* @since 1.0.49
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Enable the new Analytis module
|
||||
*/
|
||||
function rank_math_1_0_49_enable_new_analytics_module() {
|
||||
$active_modules = get_option( 'rank_math_modules', [] );
|
||||
if ( is_array( $active_modules ) && in_array( 'search-console', $active_modules, true ) ) {
|
||||
Helper::update_modules( [ 'analytics' => 'on' ] );
|
||||
rank_math_1_0_49_reconnect_sc_notification();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync the user roles with new module.
|
||||
*/
|
||||
function rank_math_1_0_49_sync_user_roles() {
|
||||
wp_roles();
|
||||
|
||||
foreach ( Helper::get_roles() as $slug => $role ) {
|
||||
$role = get_role( $slug );
|
||||
if ( ! $role ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $role->has_cap( 'rank_math_search_console' ) ) {
|
||||
$role->add_cap( 'rank_math_analytics' );
|
||||
$role->remove_cap( 'rank_math_search_console' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show notice to re-connect if Search Console was previously connected.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function rank_math_1_0_49_reconnect_sc_notification() {
|
||||
$key = 'rank_math_search_console_data';
|
||||
$option = get_option( $key, [] );
|
||||
if ( ! is_array( $option ) || empty( $option['authorized'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Helper::add_notification(
|
||||
sprintf(
|
||||
// Translators: placeholders are the opening and closing anchor tags.
|
||||
esc_html__( 'Thank you for updating Rank Math! We\'ve completely revamped our Analytics module with Google Analytics & Google Search Console integrations. For a seamless experience, please re-authenticate your Google account. %1$sClick here to Connect%2$s', 'rank-math' ),
|
||||
'<div style="margin: 10px 0;"><a href="' . Helper::get_admin_url( 'options-general#setting-panel-analytics' ) . '" class="button button-primary">',
|
||||
'</a></div>'
|
||||
),
|
||||
[
|
||||
'type' => 'warning',
|
||||
'id' => 'rank_math_analytics_reauthenticate',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
rank_math_1_0_49_sync_user_roles();
|
||||
rank_math_1_0_49_enable_new_analytics_module();
|
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.50
|
||||
*
|
||||
* @since 1.0.50
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Enable the new Analytis module
|
||||
*/
|
||||
function rank_math_1_0_50_delete_analytic_tables() {
|
||||
global $wpdb;
|
||||
|
||||
if ( defined( 'RANK_MATH_PRO_FILE' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_analytics_ga" ); // phpcs:ignore
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_analytics_adsense" ); // phpcs:ignore
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_analytics_object_links" ); // phpcs:ignore
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_analytics_keyword_manager" ); // phpcs:ignore
|
||||
|
||||
// Old tables.
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_links" ); // phpcs:ignore
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_redirections_0_9_17" ); // phpcs:ignore
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_redirection_sources_0_9_17" ); // phpcs:ignore
|
||||
}
|
||||
|
||||
/**
|
||||
* Recreate table if not exits.
|
||||
*/
|
||||
function rank_math_1_0_50_recreate_as() {
|
||||
global $wpdb;
|
||||
|
||||
if ( Helper::is_woocommerce_active() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$table_list = [
|
||||
'actionscheduler_actions',
|
||||
'actionscheduler_logs',
|
||||
'actionscheduler_groups',
|
||||
'actionscheduler_claims',
|
||||
];
|
||||
|
||||
$found_tables = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->prefix}actionscheduler%'" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
||||
foreach ( $table_list as $table_name ) {
|
||||
if ( ! in_array( $wpdb->prefix . $table_name, $found_tables, true ) ) {
|
||||
rank_math_1_0_50_recreate_tables();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Force the data store schema updates.
|
||||
*/
|
||||
function rank_math_1_0_50_recreate_tables() {
|
||||
$store = new ActionScheduler_HybridStore();
|
||||
add_action( 'action_scheduler/created_table', [ $store, 'set_autoincrement' ], 10, 2 );
|
||||
|
||||
$store_schema = new ActionScheduler_StoreSchema();
|
||||
$logger_schema = new ActionScheduler_LoggerSchema();
|
||||
$store_schema->register_tables( true );
|
||||
$logger_schema->register_tables( true );
|
||||
|
||||
remove_action( 'action_scheduler/created_table', [ $store, 'set_autoincrement' ], 10 );
|
||||
}
|
||||
|
||||
rank_math_1_0_50_recreate_as();
|
||||
rank_math_1_0_50_delete_analytic_tables();
|
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.52
|
||||
*
|
||||
* @since 1.0.52
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Enable the new Analytis module
|
||||
*/
|
||||
function rank_math_1_0_52_reindex_all_posts() {
|
||||
apply_filters( 'rank_math/tools/analytics_reindex_posts', 'Something went wrong.' );
|
||||
}
|
||||
|
||||
rank_math_1_0_52_reindex_all_posts();
|
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.54
|
||||
*
|
||||
* @since 1.0.54
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Delete extra accounts in Analytics.
|
||||
*/
|
||||
function rank_math_1_0_54_delete_unneeded_analytics_accounts() {
|
||||
if ( ! Helper::is_module_active( 'analytics' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sc_options = get_option( 'rank_math_google_analytic_profile', [] );
|
||||
if ( ! empty( $sc_options['profile'] ) ) {
|
||||
$all_accounts = get_option( 'rank_math_analytics_all_services', [] );
|
||||
|
||||
$all_accounts['sites'] = [ $sc_options['profile'] => $sc_options['profile'] ];
|
||||
update_option( 'rank_math_analytics_all_services', $all_accounts );
|
||||
}
|
||||
|
||||
$ga_options = get_option( 'rank_math_google_analytic_options' );
|
||||
if ( ! empty( $ga_options['account_id'] ) ) {
|
||||
$all_accounts = get_option( 'rank_math_analytics_all_services', [] );
|
||||
if ( isset( $all_accounts['accounts'][ $ga_options['account_id'] ] ) ) {
|
||||
foreach ( $all_accounts['accounts'] as $account_id => $account_data ) {
|
||||
if ( $account_id != $ga_options['account_id'] ) {
|
||||
unset( $all_accounts['accounts'][ $account_id ] );
|
||||
continue;
|
||||
}
|
||||
if ( isset( $account_data['properties'][ $ga_options['property_id'] ] ) ) {
|
||||
foreach ( $account_data['properties'] as $property_id => $property_data ) {
|
||||
if ( $property_id != $ga_options['property_id'] ) {
|
||||
unset( $all_accounts['accounts'][ $account_id ]['properties'][ $property_id ] );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
update_option( 'rank_math_analytics_all_services', $all_accounts );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rank_math_1_0_54_delete_unneeded_analytics_accounts();
|
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.55
|
||||
*
|
||||
* @since 1.0.55
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Reschedule analytics's daily tasks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rank_math_1_0_55_reschedule_analytics_daily_tasks() {
|
||||
|
||||
if ( ! Helper::is_module_active( 'analytics' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$daily_task_action = 'rank_math/analytics/daily_tasks';
|
||||
|
||||
as_unschedule_all_actions( $daily_task_action );
|
||||
|
||||
$fetch_gap = apply_filters( 'rank_math/analytics/fetch_gap', 7 );
|
||||
|
||||
if ( false === as_next_scheduled_action( $daily_task_action ) ) {
|
||||
$schedule_in_minute = rand( 3, defined( 'RANK_MATH_PRO_FILE' ) ? 1380 : 4320 );
|
||||
$time_to_schedule = ( strtotime( 'now' ) + ( $schedule_in_minute * MINUTE_IN_SECONDS ) );
|
||||
as_schedule_recurring_action(
|
||||
$time_to_schedule,
|
||||
DAY_IN_SECONDS * $fetch_gap,
|
||||
$daily_task_action,
|
||||
[],
|
||||
'rank-math'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
rank_math_1_0_55_reschedule_analytics_daily_tasks();
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.56
|
||||
*
|
||||
* @since 1.0.56
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
use RankMath\Google\Permissions;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Reschedule analytics's daily tasks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rank_math_1_0_56_analytics_changes() {
|
||||
if ( ! Helper::is_module_active( 'analytics' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get old task.
|
||||
$actions = as_get_scheduled_actions( [ 'hook' => 'rank_math/analytics/daily_tasks' ] );
|
||||
if ( ! empty( $actions ) ) {
|
||||
$action = current( $actions );
|
||||
$schedule = $action->get_schedule();
|
||||
$time_to_schedule = $schedule->get_date()->getTimestamp();
|
||||
} else {
|
||||
$schedule_in_minute = wp_rand( 3, defined( 'RANK_MATH_PRO_FILE' ) ? 1380 : 4320 );
|
||||
$time_to_schedule = ( strtotime( 'now' ) + ( $schedule_in_minute * MINUTE_IN_SECONDS ) );
|
||||
}
|
||||
|
||||
// Clear old task.
|
||||
as_unschedule_all_actions( 'rank_math/analytics/daily_tasks' );
|
||||
|
||||
// Add new action for scheduler.
|
||||
$task_name = 'rank_math/analytics/data_fetch';
|
||||
$fetch_gap = apply_filters( 'rank_math/analytics/fetch_gap', 7 );
|
||||
|
||||
if ( false === as_next_scheduled_action( $task_name ) ) {
|
||||
as_schedule_recurring_action(
|
||||
$time_to_schedule,
|
||||
DAY_IN_SECONDS * $fetch_gap,
|
||||
$task_name,
|
||||
[],
|
||||
'rank-math'
|
||||
);
|
||||
}
|
||||
|
||||
// Fetch permission data.
|
||||
Permissions::fetch();
|
||||
}
|
||||
|
||||
rank_math_1_0_56_analytics_changes();
|
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.62
|
||||
*
|
||||
* @since 1.0.62
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
/**
|
||||
* Remove duplicated data_fetch tasks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rank_math_1_0_62_remove_duplicated_data_fetch_tasks() {
|
||||
if ( ! Helper::is_module_active( 'analytics' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$task_name = 'rank_math/analytics/data_fetch';
|
||||
$actions = as_get_scheduled_actions(
|
||||
[
|
||||
'hook' => $task_name,
|
||||
'status' => 'pending',
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
],
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
// Run cleaner only when two or more actions are scheduled.
|
||||
if ( count( $actions ) <= 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$timestamp = as_next_scheduled_action( $task_name ); // Get first action timestamp.
|
||||
as_unschedule_all_actions( 'rank_math/analytics/data_fetch' );
|
||||
|
||||
if ( false !== $timestamp ) {
|
||||
$fetch_gap = apply_filters( 'rank_math/analytics/fetch_gap', 7 );
|
||||
as_schedule_recurring_action(
|
||||
$timestamp,
|
||||
DAY_IN_SECONDS * $fetch_gap,
|
||||
$task_name,
|
||||
[],
|
||||
'rank-math'
|
||||
);
|
||||
}
|
||||
}
|
||||
rank_math_1_0_62_remove_duplicated_data_fetch_tasks();
|
||||
|
||||
/**
|
||||
* Reindex all posts to apply new schemas title feature.
|
||||
*/
|
||||
function rank_math_1_0_62_reindex_all_posts() {
|
||||
apply_filters( 'rank_math/tools/analytics_reindex_posts', 'Something went wrong.' );
|
||||
}
|
||||
rank_math_1_0_62_reindex_all_posts();
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.63
|
||||
*
|
||||
* @since 1.0.63
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Delete rank_math_sc_analytics table.
|
||||
*/
|
||||
function rank_math_1_0_63_delete_old_analytics_table() {
|
||||
global $wpdb;
|
||||
if ( ! is_multisite() ) {
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_sc_analytics" );
|
||||
return;
|
||||
}
|
||||
|
||||
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE archived = '0' AND spam = '0' AND deleted = '0'" );
|
||||
if ( ! empty( $blog_ids ) ) {
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_sc_analytics" );
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
}
|
||||
rank_math_1_0_63_delete_old_analytics_table();
|
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.65.
|
||||
*
|
||||
* @since 1.0.65
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
use RankMath\Google\Console;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Set defaults for the new options added in this version.
|
||||
*/
|
||||
function rank_math_1_0_65_default_options() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
|
||||
// Turn this option off by default after updating.
|
||||
$general['console_email_reports'] = 'off';
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_65_default_options();
|
||||
|
||||
/**
|
||||
* Add admin notice to inform users about the new Email Reports feature.
|
||||
*/
|
||||
function rank_math_1_0_65_reports_notice() {
|
||||
$active_modules = get_option( 'rank_math_modules', [] );
|
||||
if ( ! is_array( $active_modules ) || ! in_array( 'analytics', $active_modules, true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Console::is_console_connected() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Helper::add_notification(
|
||||
sprintf(
|
||||
// Translators: placeholders are the opening and closing anchor tags.
|
||||
'<svg style="vertical-align: middle; margin-right: 5px" viewBox="0 0 462.03 462.03" xmlns="http://www.w3.org/2000/svg" width="20"><g><path d="m462 234.84-76.17 3.43 13.43 21-127 81.18-126-52.93-146.26 60.97 10.14 24.34 136.1-56.71 128.57 54 138.69-88.61 13.43 21z"></path><path d="m54.1 312.78 92.18-38.41 4.49 1.89v-54.58h-96.67zm210.9-223.57v235.05l7.26 3 89.43-57.05v-181zm-105.44 190.79 96.67 40.62v-165.19h-96.67z"></path></g></svg><strong>' . esc_html__( 'Rank Math: Introducing SEO Performance Reports via Email. %1$sClick here to enable it%2$s.', 'rank-math' ) . '</strong>',
|
||||
'<a href="###ENABLE_EMAIL_REPORTS###">',
|
||||
'</a>'
|
||||
),
|
||||
[
|
||||
'type' => 'warning',
|
||||
'id' => 'rank_math_analytics_new_email_reports',
|
||||
'capability' => 'rank_math_analytics',
|
||||
]
|
||||
);
|
||||
}
|
||||
rank_math_1_0_65_reports_notice();
|
||||
|
||||
/**
|
||||
* Clear scheduled event added in version 1.0.65-beta.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rank_math_1_0_65_clear_beta_scheduled_event() {
|
||||
$event = 'rank_math/analytics/email_report_event';
|
||||
$timestamp = wp_next_scheduled( $event );
|
||||
if ( $timestamp ) {
|
||||
wp_unschedule_event( $timestamp, $event );
|
||||
}
|
||||
}
|
||||
rank_math_1_0_65_clear_beta_scheduled_event();
|
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.67
|
||||
*
|
||||
* @since 1.0.67
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helpers\DB;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Delete the IP column in the 404 logs table.
|
||||
*/
|
||||
function rank_math_1_0_67_alter_404_logs_table() {
|
||||
global $wpdb;
|
||||
|
||||
$table_schema = "ALTER TABLE {$wpdb->prefix}rank_math_404_logs DROP COLUMN ip;";
|
||||
|
||||
if ( ! is_multisite() ) {
|
||||
if ( DB::check_table_exists( 'rank_math_404_logs' ) ) {
|
||||
$wpdb->query( $table_schema ); // phpcs:ignore
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE archived = '0' AND spam = '0' AND deleted = '0'" );
|
||||
if ( empty( $blog_ids ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
|
||||
if ( DB::check_table_exists( 'rank_math_404_logs' ) ) {
|
||||
$wpdb->query( $table_schema ); // phpcs:ignore
|
||||
}
|
||||
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
rank_math_1_0_67_alter_404_logs_table();
|
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.76
|
||||
*
|
||||
* @since 1.0.76
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Add content_ai capability.
|
||||
*/
|
||||
function rank_math_1_0_76_add_content_ai_capability() {
|
||||
wp_roles();
|
||||
|
||||
foreach ( Helper::get_roles() as $slug => $role ) {
|
||||
$role = get_role( $slug );
|
||||
if ( ! $role ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $role->has_cap( 'manage_options' ) ) {
|
||||
$role->add_cap( 'rank_math_content_ai' );
|
||||
}
|
||||
}
|
||||
|
||||
Helper::update_modules( [ 'content-ai' => 'on' ] );
|
||||
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
|
||||
// Post Types.
|
||||
$post_types = Helper::get_accessible_post_types();
|
||||
if ( isset( $post_types['attachment'] ) ) {
|
||||
unset( $post_types['attachment'] );
|
||||
}
|
||||
|
||||
$general['content_ai_post_types'] = array_keys( $post_types );
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
|
||||
rank_math_1_0_76_add_content_ai_capability();
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.79
|
||||
*
|
||||
* @since 1.0.79
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Set defaults for the new options added in this version.
|
||||
*/
|
||||
function rank_math_1_0_79_default_options() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$titles = $all_opts['titles'];
|
||||
|
||||
$titles['pt_post_slack_enhanced_sharing'] = 'on';
|
||||
$titles['pt_page_slack_enhanced_sharing'] = 'on';
|
||||
$titles['pt_product_slack_enhanced_sharing'] = 'on';
|
||||
$titles['author_slack_enhanced_sharing'] = 'on';
|
||||
foreach ( Helper::get_accessible_taxonomies() as $taxonomy => $object ) {
|
||||
$titles[ 'tax_' . $taxonomy . '_slack_enhanced_sharing' ] = 'on';
|
||||
}
|
||||
|
||||
Helper::update_all_settings( null, $titles, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
|
||||
rank_math_1_0_79_default_options();
|
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.84
|
||||
*
|
||||
* @since 1.0.84
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Start the scheduled URL Inspections if Analytics module is enabled.
|
||||
*/
|
||||
function rank_math_1_0_84_init_url_inspections() {
|
||||
$active_modules = get_option( 'rank_math_modules', [] );
|
||||
if ( ! is_array( $active_modules ) || ! in_array( 'analytics', $active_modules, true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Start first fetch in 15 minutes.
|
||||
$start = time() + ( 15 * MINUTE_IN_SECONDS );
|
||||
as_schedule_single_action( $start, 'rank_math/analytics/workflow', [ 'inspections', 0, null, null ], 'rank-math' );
|
||||
}
|
||||
|
||||
rank_math_1_0_84_init_url_inspections();
|
||||
|
||||
/**
|
||||
* Fix collations for the Analytics tables.
|
||||
*/
|
||||
function rank_math_1_0_84_check_analytics_collations() {
|
||||
$tables = [
|
||||
'rank_math_analytics_ga',
|
||||
'rank_math_analytics_gsc',
|
||||
'rank_math_analytics_keyword_manager',
|
||||
];
|
||||
|
||||
$objects_coll = \RankMath\Helpers\DB::get_table_collation( 'rank_math_analytics_objects' );
|
||||
foreach ( $tables as $table ) {
|
||||
\RankMath\Helpers\DB::check_collation( $table, 'all', $objects_coll );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run collation fixer on multisite or simple install.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rank_math_1_0_84_check_collations() {
|
||||
if ( is_multisite() ) {
|
||||
foreach ( get_sites() as $site ) {
|
||||
switch_to_blog( $site->blog_id );
|
||||
rank_math_1_0_84_check_analytics_collations();
|
||||
restore_current_blog();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
rank_math_1_0_84_check_analytics_collations();
|
||||
}
|
||||
|
||||
rank_math_1_0_84_check_collations();
|
||||
|
||||
/**
|
||||
* Enable the Index Status tab by default.
|
||||
*/
|
||||
function rank_math_1_0_84_update_analytics_options() {
|
||||
$active_modules = get_option( 'rank_math_modules', [] );
|
||||
if ( ! is_array( $active_modules ) || ! in_array( 'analytics', $active_modules, true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = get_option( 'rank_math_google_analytic_profile' );
|
||||
if ( ! is_array( $options ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options['enable_index_status'] = true;
|
||||
update_option( 'rank_math_google_analytic_profile', $options );
|
||||
}
|
||||
|
||||
rank_math_1_0_84_update_analytics_options();
|
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.86
|
||||
*
|
||||
* @since 1.0.86
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Update Analytics Stats on existing sites.
|
||||
*/
|
||||
function rank_math_1_0_86_update_analytics_stats() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
$general['analytics_stats'] = 'on';
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_1_0_86_update_analytics_stats();
|
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.89
|
||||
*
|
||||
* @since 1.0.89
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Convert keywords used in Content AI to lower case on existing sites.
|
||||
*/
|
||||
function rank_math_1_0_89_update_contentai_data() {
|
||||
$data = get_option( 'rank_math_ca_data' );
|
||||
if ( empty( $data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $data as $country => $keywords ) {
|
||||
if ( empty( $keywords ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ret = [];
|
||||
foreach ( $keywords as $key => $keyword ) {
|
||||
$ret[ mb_strtolower( $key ) ] = $keyword;
|
||||
}
|
||||
|
||||
if ( ! empty( $ret ) ) {
|
||||
$data[ $country ] = $ret;
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'rank_math_ca_data', $data );
|
||||
}
|
||||
|
||||
rank_math_1_0_89_update_contentai_data();
|
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 1.0.98
|
||||
*
|
||||
* @since 1.0.98
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Get a group's ID based on its name/slug.
|
||||
*
|
||||
* @param string $slug The string name of a group.
|
||||
*
|
||||
* @return int The group's ID, if it exists or is created, or 0 if it does not exist and is not created.
|
||||
*/
|
||||
function rank_math_1_0_98_as_get_group_id( $slug ) {
|
||||
if ( empty( $slug ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$table = $wpdb->prefix . 'actionscheduler_groups';
|
||||
$group_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT group_id FROM {$table} WHERE slug=%s", $slug ) );
|
||||
|
||||
return $group_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix Action Scheduler groups.
|
||||
*/
|
||||
function rank_math_1_0_98_fix_as_groups() {
|
||||
$workflow_group_id = rank_math_1_0_98_as_get_group_id( 'workflow' );
|
||||
$inspections_group_id = rank_math_1_0_98_as_get_group_id( 'rank_math/analytics/get_inspections_data' );
|
||||
$rank_math_group_id = rank_math_1_0_98_as_get_group_id( 'rank-math' );
|
||||
|
||||
if ( 0 === $rank_math_group_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In the actions table, update the group_id for all actions in the 'workflow' & 'rank_math/analytics/get_inspections_data' groups to the 'rank-math' group.
|
||||
global $wpdb;
|
||||
$actions_table = $wpdb->prefix . 'actionscheduler_actions';
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE {$actions_table} SET group_id=%d WHERE group_id=%d OR group_id=%d", $rank_math_group_id, $workflow_group_id, $inspections_group_id ) );
|
||||
|
||||
// Delete the 'workflow' & 'rank_math/analytics/get_inspections_data' groups.
|
||||
$groups_table = $wpdb->prefix . 'actionscheduler_groups';
|
||||
$wpdb->query( $wpdb->prepare( "DELETE FROM {$groups_table} WHERE group_id=%d OR group_id=%d", $workflow_group_id, $inspections_group_id ) );
|
||||
}
|
||||
|
||||
rank_math_1_0_98_fix_as_groups();
|
Reference in New Issue
Block a user