Plugin Directory

Changeset 945433


Ignore:
Timestamp:
07/09/2014 08:16:30 AM (11 years ago)
Author:
mindnl
Message:

bugfix DBupgrade

Location:
ad-buttons/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ad-buttons/trunk/adbuttons.php

    r945406 r945433  
    55Description: Plugin to add ad buttons to your blog
    66Author: Nico
    7 Version: 2.2
     7Version: 2.2.1
    88Author URI: http://www.blogio.net/blog/
    99Questions, sugestions, problems? Let me know at [email protected]
     
    7171    dbDelta($structure);
    7272   
    73     $ad_buttons_version = "2.2";
     73    $ad_buttons_version = "2.2.1";
    7474    update_option("ad_buttons_version", $ad_buttons_version);
    7575
    76     $ad_buttons_db_version = "2.2";
     76    $ad_buttons_db_version = "2.2.1";
    7777    update_option("ad_buttons_db_version", $ad_buttons_db_version);
    7878   
     
    8282
    8383register_activation_hook(__FILE__,'ad_buttons_install');
     84
     85$ad_buttons_db_version = get_option("ad_buttons_db_version");
     86
     87if($ad_buttons_db_version <> "2.2.1"){
     88    // update database
     89   
     90    //set the options
     91    $newoptions = get_option('widget_adbuttons_cfg');
     92    $newoptions['ab_dspcnt'] = '1';
     93    $newoptions['ab_target'] = 'bnk';
     94    $newoptions['ab_powered'] = '1';
     95    $newoptions['ab_count'] = '1';
     96    add_option('widget_adbuttons_cfg', $newoptions);
     97   
     98    // create table
     99    global $wpdb;
     100    $table = $wpdb->prefix."ad_buttons";
     101    $structure = "CREATE TABLE $table (
     102        id INT(9) NOT NULL AUTO_INCREMENT,
     103        ad_picture VARCHAR(100) NOT NULL,
     104        ad_link VARCHAR(500) NOT NULL,
     105        ad_text VARCHAR(80) NOT NULL,
     106        ad_strdat DATE NOT NULL,
     107        ad_enddat DATE NOT NULL,
     108        ad_views INT(9) DEFAULT 0,
     109        ad_clicks INT(9) DEFAULT 0,
     110        ad_active TINYINT(1) NOT NULL DEFAULT 0,
     111        adg_count VARCHAR(500) NOT NULL,
     112        adg_show tinytext NOT NULL,
     113        ad_pos INT(9) DEFAULT 0,
     114       
     115    UNIQUE KEY id (id)
     116    );";
     117   
     118    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     119    dbDelta($structure);
     120   
     121    $ab_plugindir = get_option('siteurl').'/'.PLUGINDIR.'/'.dirname(plugin_basename(__FILE__));
     122   
     123    $wpdb->query("INSERT INTO $table(id, ad_picture, ad_link, ad_text, ad_views, ad_clicks, ad_active)
     124        VALUES(1, '".$ab_plugindir."/ab125.jpg', 'http://wordpress.org/plugins/ad-buttons/', 'ads powered by Ad Buttons', 1, 0, 1)");
     125
     126    $table = $wpdb->prefix."ad_buttons_stats";
     127    $structure = "CREATE TABLE $table (
     128    abs_dat date NOT NULL,
     129    abs_ip int(10) NOT NULL,
     130    abs_view tinyint(4) NOT NULL,
     131    abs_click tinyint(4) NOT NULL,
     132    KEY abs_dat (abs_dat)
     133    );";
     134   
     135    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     136    dbDelta($structure);
     137
     138    $table = $wpdb->prefix."ad_buttons_stats_hst";
     139    $structure = "CREATE TABLE $table (
     140    abs_dat date NOT NULL,
     141    abs_view int(11) NOT NULL,
     142    abs_click int(11) NOT NULL
     143    );";
     144   
     145    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     146    dbDelta($structure);
     147   
     148    $ad_buttons_version = "2.2.1";
     149    update_option("ad_buttons_version", $ad_buttons_version);
     150
     151    $ad_buttons_db_version = "2.2.1";
     152    update_option("ad_buttons_db_version", $ad_buttons_db_version);
     153   
     154    $ip2nation_db_version = "2.2";
     155    update_option("ip2nation_db_available", $ip2nation_db_version);
     156}
    84157
    85158   //check if user is a bot of some sort
  • ad-buttons/trunk/readme.txt

    r944869 r945433  
    55Requires at least: 2.0.2
    66Tested up to: 3.9
    7 Stable tag: 2.2
     7Stable tag: 2.2.1
    88
    99The Ad Buttons plugin displays a number of graphical ads in a sidebar widget.
     
    3939
    4040== Changelog ==
     41
     42= 2.2.1 =
     43* 09-07-2014
     44* bugfix to the database upgrade process
    4145
    4246= 2.2 =
Note: See TracChangeset for help on using the changeset viewer.