[datapress] r171 committed - migration code

0 views
Skip to first unread message

codesite...@google.com

unread,
May 11, 2011, 6:24:39 PM5/11/11
to datapres...@googlegroups.com
Revision: 171
Author: edward.benson
Date: Wed May 11 15:23:50 2011
Log: migration code
http://code.google.com/p/datapress/source/detail?r=171

Modified:
/trunk/plugin/wp-exhibit-activation-tools.php
/trunk/plugin/wp-exhibit-config.php
/trunk/plugin/wp-exhibit.php

=======================================
--- /trunk/plugin/wp-exhibit-activation-tools.php Wed Mar 30 12:10:58 2011
+++ /trunk/plugin/wp-exhibit-activation-tools.php Wed May 11 15:23:50 2011
@@ -1,5 +1,7 @@
<?php

+include_once("wp-exhibit-config.php");
+
class WpExhibitActivationTools {
static function activate_plugin() {
self::setup_exhibits_table();
@@ -18,6 +20,21 @@
// Participate in usage study by default
update_option( 'datapress_et_phone_home', "Y" );
}
+
+ static function migrate() {
+ $cur_ver = get_option(WpExhibitConfig::$WP_EXHIBIT_DB_VERSION_KEY);
+ if ($cur_ver) {
+ // 1.5 release
+ if ($cur_ver < 16) {
+ // The diff between previous versions and 1.5
+ self::setup_geocode_table();
+ }
+ // Future release here
+
+ update_option(WpExhibitConfig::$WP_EXHIBIT_DB_VERSION_KEY,
+ WpExhibitConfig::$DB_VERSION);
+ }
+ }

static function deactivate_plugin() {
// Make the DB schema version equal something different, so that
@@ -77,7 +94,6 @@
self::setup_table(WpExhibitConfig::$DATASCRAPS_ASSOC_TABLE_KEY,
$creation_sql);
}
-

static function setup_post_exhibits_table() {
$creation_sql = " (
@@ -105,7 +121,6 @@
WpExhibitConfig::$DB_VERSION) {
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
- echo "done building table $table_name";
}
}

=======================================
--- /trunk/plugin/wp-exhibit-config.php Wed Feb 16 13:05:42 2011
+++ /trunk/plugin/wp-exhibit-config.php Wed May 11 15:23:50 2011
@@ -2,7 +2,7 @@

class WpExhibitConfig {
// datapress schema version
- public static $DB_VERSION = "4";
+ public static $DB_VERSION = "16";

// table keys
public static $EXHIBITS_TABLE_KEY = "exhibits";
=======================================
--- /trunk/plugin/wp-exhibit.php Wed May 11 12:45:27 2011
+++ /trunk/plugin/wp-exhibit.php Wed May 11 15:23:50 2011
@@ -2,8 +2,8 @@
/*
Plugin Name: Datapress
Plugin URI: http://projects.csail.mit.edu/datapress
-Description: A Wordpress Plugin for the Exhibit Web Framework
-Version: 1.0
+Description: Show maps, timelines, and rich data visualizations in your
blog!
+Version: 1.5
Author: The Haystack Group @ MIT
Author URI: http://haystack.csail.mit.edu/
*/
@@ -99,6 +99,10 @@
function activate_plugin() {
WpExhibitActivationTools::activate_plugin();
}
+
+ function migrate_plugin() {
+ WpExhibitActivationTools::migrate();
+ }

function deactivate_plugin() {
delete_option('datapress_privacy_notice_shown');
@@ -169,6 +173,7 @@
}

$exhibit = new WpExhibit();
+$exhibit->migrate_plugin();

add_action('wp_head', array($exhibit, 'exhibit_include'));
add_action('admin_head', array($exhibit, 'exhibit_admin_include'));

Reply all
Reply to author
Forward
0 new messages