Plugin Directory

Changeset 2398824


Ignore:
Timestamp:
10/13/2020 04:29:59 PM (5 years ago)
Author:
rupamhazra
Message:

Version: 5.5.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mapping-multiple-urls-redirect-same-page/trunk/mapping-multiple-urls-redirect-same-page.php

    r2398815 r2398824  
    33* Plugin Name: Mapping multiple URLs redirect same page
    44* Description: Mapping multiple URLs redirect same page,post,category,tags,custom post types.
    5 * Version: 5.5
     5* Version: 5.5.1
    66* Author: Rupam Hazra
    77* Author URI: http://rstar.dx.am
     
    134134{
    135135    global $wpdb;   
    136     require_once(ABSPATH . '/wp-admin/includes/upgrade.php');   
    137      $charset_collate = '';
    138      if ( ! empty( $wpdb->charset ) )
    139         $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     136    $installed_ver = get_option( "jal_db_version" );
     137    if ( $installed_ver != $jal_db_version ) {
     138        require_once(ABSPATH . '/wp-admin/includes/upgrade.php');   
     139         $charset_collate = '';
     140         if ( ! empty( $wpdb->charset ) )
     141            $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
    140142
    141     if ( ! empty( $wpdb->collate ) )
    142         $charset_collate .= " COLLATE {$wpdb->collate}";
    143     $table_name=$wpdb->prefix.'mmursp_settings';
    144     $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " (
    145                   `id` int(11) NOT NULL AUTO_INCREMENT,
    146                   `category` varchar(50) NOT NULL,
    147                   `page_or_post_id` int(11) DEFAULT NULL,
    148                   `page_or_post_title` varchar(200) DEFAULT NULL,
    149                   `page_or_post_slug` varchar(50) DEFAULT NULL,
    150                   `post_of_custom_post_type` varchar(50) DEFAULT NULL,
    151                   `regular_expression` text DEFAULT NULL,
    152                   `is_seo` int(10) DEFAULT NULL,
    153                   `meta_title` text DEFAULT NULL,
    154                   `meta_keywords` text DEFAULT NULL,
    155                   `meta_description` text DEFAULT NULL,
    156                   `created_by` varchar(30) DEFAULT NULL,
    157                   `created_date` datetime DEFAULT NULL,
    158                   PRIMARY KEY (`id`)
    159             ) $charset_collate;";
    160     require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    161     dbDelta($sql);
     143        if ( ! empty( $wpdb->collate ) )
     144            $charset_collate .= " COLLATE {$wpdb->collate}";
     145        $table_name=$wpdb->prefix.'mmursp_settings';
     146        $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " (
     147                      `id` int(11) NOT NULL AUTO_INCREMENT,
     148                      `category` varchar(50) NOT NULL,
     149                      `page_or_post_id` int(11) DEFAULT NULL,
     150                      `page_or_post_title` varchar(200) DEFAULT NULL,
     151                      `page_or_post_slug` varchar(50) DEFAULT NULL,
     152                      `post_of_custom_post_type` varchar(50) DEFAULT NULL,
     153                      `regular_expression` text DEFAULT NULL,
     154                      `is_seo` int(10) DEFAULT NULL,
     155                      `meta_title` text DEFAULT NULL,
     156                      `meta_keywords` text DEFAULT NULL,
     157                      `meta_description` text DEFAULT NULL,
     158                      `created_by` varchar(30) DEFAULT NULL,
     159                      `created_date` datetime DEFAULT NULL,
     160                      PRIMARY KEY (`id`)
     161                ) $charset_collate;";
     162        dbDelta($sql);
     163        update_option( "jal_db_version", $jal_db_version );
     164    }
     165   
    162166}
     167function myplugin_update_db_check() {
     168    global $jal_db_version;
     169    if ( get_site_option( 'jal_db_version' ) != $jal_db_version ) {
     170        jal_install();
     171    }
     172}
     173add_action( 'plugins_loaded', 'myplugin_update_db_check' );
    163174function mmursp_remove_table()
    164175{
Note: See TracChangeset for help on using the changeset viewer.