Skip to content

Commit

Permalink
fix: correct the migration process
Browse files Browse the repository at this point in the history
  • Loading branch information
mihdan committed May 17, 2024
1 parent 731dfb8 commit e04b441
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.kobzarev.com/donate/
Tags: indexnow, yandex, bing, google, seo
Requires at least: 6.0
Tested up to: 6.5
Stable tag: 0.1.2
Stable tag: 0.1.2.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
4 changes: 2 additions & 2 deletions recrawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: ReCrawler
* Description: ReCrawler is a small WordPress Plugin for quickly notifying search engines whenever their website content is created, updated, or deleted.
* Version: 0.1.2
* Version: 0.1.2.1
* Author: Mikhail Kobzarev
* Author URI: https://www.kobzarev.com/
* Plugin URI: https://wordpress.org/plugins/recrawler/
Expand All @@ -22,7 +22,7 @@
exit;
}

define( 'RECRAWLER_VERSION', '0.1.2' );
define( 'RECRAWLER_VERSION', '0.1.2.1' );
define( 'RECRAWLER_SLUG', 'recrawler' );
define( 'RECRAWLER_PREFIX', 'recrawler' );
define( 'RECRAWLER_NAME', 'ReCrawler' );
Expand Down
21 changes: 2 additions & 19 deletions src/Migrations/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ public function setup_hooks() {
public function migrate() {
$migrated = (array) get_option( self::MIGRATED_VERSIONS_OPTION_NAME, [] );

//$this->check_plugin_update( $migrated );

$migrations = array_filter(
get_class_methods( $this ),
static function ( $migration ) {
Expand All @@ -70,8 +68,6 @@ static function ( $migration ) {
foreach ( $migrations as $migration ) {
$upgrade_version = $this->get_upgrade_version( $migration );



$upgrade_versions[] = $upgrade_version;

if (
Expand Down Expand Up @@ -127,19 +123,6 @@ public function is_allowed(): bool {
return wp_doing_cron() || is_admin() || ( defined( 'WP_CLI' ) && constant( 'WP_CLI' ) );
}

/**
* Check if the plugin was updated.
*
* @param array $migrated Migrated versions.
*
* @return void
*/
private function check_plugin_update( array $migrated ) {
if ( isset( $migrated[ self::PLUGIN_VERSION ] ) ) {
return;
}
}

/**
* Get an upgrade version from the method name.
*
Expand Down Expand Up @@ -252,11 +235,11 @@ protected function migrate_0_1_2() {

foreach ( $sites as $site_id ) {
switch_to_blog( $site_id );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}recrawler_log" ); // phpcs:ignore
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}mihdan_index_now_log" ); // phpcs:ignore
restore_current_blog();
}
} else {
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}recrawler_log" ); // phpcs:ignore
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}mihdan_index_now_log" ); // phpcs:ignore
}

return true;
Expand Down

0 comments on commit e04b441

Please sign in to comment.