| @@ -2,13 +2,13 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Taboola |
| 4 | 4 | * Plugin URI: https://developers.taboola.com/web-integrations/docs/wordpress-plugin |
| 5 | 5 | * Description: Taboola |
| 6 | - * Version: 2.1.1 | |
| 6 | + * Version: 2.1.0 | |
| 7 | 7 | * Author: Taboola |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -define ("TABOOLA_PLUGIN_VERSION","2.1.1"); // => UPDATE THIS FOR *EVERY* RELEASE (USED FOR TRACKING) | |
| 10 | +define ("TABOOLA_PLUGIN_VERSION","2.1.0"); // => UPDATE THIS FOR *EVERY* RELEASE (USED FOR TRACKING) | |
| 11 | 11 | define ("TABOOLA_MIN_VER","2.0.1"); // => UPDATE THIS *ONLY* IF THIS RELEASE HAS *DB CHANGES* |
| 12 | 12 | define ("TABOOLA_DEBUG_MODE", false); // => SET THIS TO 'FALSE' FOR *EVERY* RELEASE (USED TO SUPRESS DEBUGGING LOGS) |
| 13 | 13 | |
| 14 | 14 | define ("TABOOLA_OPTION_NAME","taboola_plugin_version"); // Note: if this release has DB changes, then the min version will be saved under 'taboola_plugin_version' in 'wp_options'. |
| @@ -626,28 +626,10 @@ | ||
| 626 | 626 | /** |
| 627 | 627 | * Checks if the DB was *previously* updated for the minimum version specified. |
| 628 | 628 | * $min_ver should be passed in a format like this: "2.1.0" |
| 629 | 629 | */ |
| 630 | - | |
| 631 | 630 | global $wpdb; |
| 632 | 631 | |
| 633 | - // PC - Temporary patch for v2.1.0 | |
| 634 | - | |
| 635 | - // START patch =============================================== | |
| 636 | - // Check if the `_taboola` table exists. | |
| 637 | - // If not, then return false. | |
| 638 | - | |
| 639 | - $table_name = $wpdb->prefix . "_taboola_settings"; | |
| 640 | - | |
| 641 | - if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { | |
| 642 | - tb_write_log("Table NOT FOUND"); | |
| 643 | - return false; | |
| 644 | - } | |
| 645 | - else { | |
| 646 | - tb_write_log("Table EXISTS"); | |
| 647 | - } | |
| 648 | - // END patch ================================================= | |
| 649 | - | |
| 650 | 632 | // Check the saved version in wp_options. Default to '1.0.0' if the option is not found. |
| 651 | 633 | $saved_version = get_option(TABOOLA_OPTION_NAME, '1.0.0'); |
| 652 | 634 | |
| 653 | 635 | $db_is_up_to_date = version_compare($saved_version, $min_ver, '>='); |
| @@ -657,9 +639,8 @@ | ||
| 657 | 639 | } |
| 658 | 640 | |
| 659 | 641 | function is_db_updated_for_current_ver() { |
| 660 | 642 | /** |
| 661 | - * DEPRECATED | |
| 662 | 643 | * Checks if the DB was *previously* updated for the version currently loaded. |
| 663 | 644 | */ |
| 664 | 645 | global $wpdb; |
| 665 | 646 | |
| @@ -665,9 +646,9 @@ | ||
| 665 | 646 | |
| 666 | 647 | // Check the saved version in wp_options. Default to '1.0.0' if the option is not found. |
| 667 | 648 | $saved_version = get_option(TABOOLA_OPTION_NAME, '1.0.0'); |
| 668 | 649 | |
| 669 | - // Get the currently loaded plugin version. | |
| 650 | + // Get the currently loaded plugin version from wp_options. | |
| 670 | 651 | $plugin_version = $this->get_loaded_plugin_version(); |
| 671 | 652 | |
| 672 | 653 | $db_is_up_to_date = version_compare($saved_version, $plugin_version, '>='); |
| 673 | 654 | //tb_write_log($db_is_up_to_date); |
| @@ -683,16 +664,14 @@ | ||
| 683 | 664 | |
| 684 | 665 | } |
| 685 | 666 | |
| 686 | 667 | function save_taboola_version($min_ver) { |
| 687 | - /** | |
| 688 | - * Checks for the saved version in wp_options. | |
| 689 | - * If not found - adds it. Else - updates it. | |
| 690 | - */ | |
| 691 | - | |
| 668 | + // Get the currently loaded plugin version | |
| 669 | + // $plugin_version = $this->get_loaded_plugin_version(); | |
| 692 | 670 | |
| 693 | 671 | tb_write_log("SAVING NEW MIN VERSION: " . $min_ver); // PC |
| 694 | 672 | |
| 673 | + // Check the saved version in wp_options. Default to '' if the option is not found. | |
| 695 | 674 | $saved_version = get_option(TABOOLA_OPTION_NAME, ''); |
| 696 | 675 | if ($saved_version == '') { |
| 697 | 676 | add_option(TABOOLA_OPTION_NAME, $min_ver); |
| 698 | 677 | } |
| @@ -714,10 +693,10 @@ | ||
| 714 | 693 | global $wpdb; |
| 715 | 694 | require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 716 | 695 | |
| 717 | 696 | |
| 718 | - // Handling for older MySQL versions | |
| 719 | - if (function_exists('mysql_get_server_info') && version_compare(mysql_get_server_info(), '4.1.0', '>=')) { | |
| 697 | + //check mysql version | |
| 698 | + if (function_exists('mysqli_get_server_info') && version_compare(mysqli_get_server_info(), '4.1.0', '>=')) { | |
| 720 | 699 | if (!empty($wpdb->charset)) |
| 721 | 700 | $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
| 722 | 701 | if (!empty($wpdb->collate)) |
| 723 | 702 | $charset_collate .= " COLLATE $wpdb->collate"; |