]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #1432: Version number is set during installation.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 10 Jan 2010 21:21:11 +0000 (21:21 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 10 Jan 2010 21:21:11 +0000 (21:21 +0000)
Refs #1424: The upgrade functions now detect if no version number is saved to the db and silences all upgrade warnings and errors.  This is required for all installations < this commit to upgrade correctly because of #1432.
More strict regex for finding upgrade files.
Upgrade mysql.sql schema with latest.

git-svn-id: http://code.elgg.org/elgg/trunk@3791 36083f99-b078-4883-b0ff-0f9b5a30f544

actions/systemsettings/install.php
engine/lib/database.php
engine/lib/version.php
engine/schema/mysql.sql

index c4f563beb5d72e532419cf6e3156373db3643b6c..3e401bb5cc032a3c69272c4543455523f5e9aa45 100644 (file)
@@ -52,11 +52,10 @@ if (get_input('settings') == 'go') {
                }
 
                datalist_set('installed',time());
-
                datalist_set('path', $path);
                datalist_set('dataroot', $dataroot);
-
-               datalist_set('default_site',$site->getGUID());
+               datalist_set('default_site', $site->getGUID());
+               datalist_set('version', get_version());
 
                set_config('view', get_input('view'), $site->getGUID());
                set_config('language', get_input('language'), $site->getGUID());
index 87b0025082e86ca0027c7659e5776bc45b68ba8c..262e651ee184d6ea9199ba16507eb0ecc00740d1 100644 (file)
@@ -518,9 +518,10 @@ function run_sql_script($scriptlocation) {
  *
  * @param int $version The version you are upgrading from (usually given in the Elgg version format of YYYYMMDDXX - see version.php for example)
  * @param string $fromdir Optional directory to load upgrades from (default: engine/schema/upgrades/)
+ * @param bool $quiet If true, will suppress all error messages.  Don't use this.
  * @return bool
  */
-function db_upgrade($version, $fromdir = "") {
+function db_upgrade($version, $fromdir = "", $quiet = FALSE) {
        global $CONFIG;
 
        // Elgg and its database must be installed to upgrade it!
@@ -539,7 +540,7 @@ function db_upgrade($version, $fromdir = "") {
 
                while ($sqlfile = readdir($handle)) {
                        if (!is_dir($fromdir . $sqlfile)) {
-                               if (preg_match('/([0-9]*)\.sql/',$sqlfile,$matches)) {
+                               if (preg_match('/^([0-9]{10})\.(sql)$/', $sqlfile, $matches)) {
                                        $sql_version = (int) $matches[1];
                                        if ($sql_version > $version) {
                                                $sqlupgrades[] = $sqlfile;
@@ -552,17 +553,22 @@ function db_upgrade($version, $fromdir = "") {
 
                if (sizeof($sqlupgrades) > 0) {
                        foreach($sqlupgrades as $sqlfile) {
-//                             let's not allow failing upgrade to pass.
-//                             try {
+
+                               // hide all errors.
+                               if ($quiet) {
+                                       try {
+                                               run_sql_script($fromdir . $sqlfile);
+                                       } catch (DatabaseException $e) {
+                                               error_log($e->getmessage());
+                                       }
+                               } else {
                                        run_sql_script($fromdir . $sqlfile);
-//                             } catch (DatabaseException $e) {
-//                                     error_log($e->getmessage());
-//                             }
+                               }
                        }
                }
        }
 
-       return true;
+       return TRUE;
 }
 
 /**
index 3728fb8ec9cb5306200b8a56fdff43b6956f89fc..3cf321a0fd7782fd4b7a5bc9914c75784cf4f5ec 100644 (file)
 /**
  * Run any php upgrade scripts which are required
  *
- * @param unknown_type $version
+ * @param int $version Version upgrading from.
+ * @param bool $quiet Suppress errors.  Don't use this.
  */
-function upgrade_code($version) {
+function upgrade_code($version, $quiet = FALSE) {
        global $CONFIG;
 
        // Elgg and its database must be installed to upgrade it!
        if (!is_db_installed() || !is_installed()) {
-               return false;
+               return FALSE;
        }
 
        $version = (int) $version;
@@ -29,7 +30,7 @@ function upgrade_code($version) {
                while ($updatefile = readdir($handle)) {
                        // Look for upgrades and add to upgrades list
                        if (!is_dir($CONFIG->path . 'engine/lib/upgrades/' . $updatefile)) {
-                               if (preg_match('/([0-9]*)\.php/',$updatefile,$matches)) {
+                               if (preg_match('/^([0-9]{10})\.(php)$/', $updatefile, $matches)) {
                                        $core_version = (int) $matches[1];
                                        if ($core_version > $version) {
                                                $upgrades[] = $updatefile;
@@ -40,20 +41,29 @@ function upgrade_code($version) {
 
                // Sort and execute
                asort($upgrades);
+
                if (sizeof($upgrades) > 0) {
                        foreach($upgrades as $upgrade) {
-                               try {
+                               // hide all errors.
+                               if ($quiet) {
+                                       // hide include errors as well as any exceptions that might happen
+                                       try {
+                                               if (!@include($CONFIG->path . 'engine/lib/upgrades/' . $upgrade)) {
+                                                       error_log($e->getmessage());
+                                               }
+                                       } catch (Exception $e) {
+                                               error_log($e->getmessage());
+                                       }
+                               } else {
                                        include($CONFIG->path . 'engine/lib/upgrades/' . $upgrade);
-                               } catch (Exception $e) {
-                                       error_log($e->getmessage());
                                }
                        }
                }
 
-               return true;
+               return TRUE;
        }
 
-       return false;
+       return FALSE;
 }
 
 /**
@@ -66,11 +76,10 @@ function get_version($humanreadable = false) {
        global $CONFIG;
 
        if (include($CONFIG->path . "version.php")) {
-               if (!$humanreadable) return $version;
-               return $release;
+               return (!$humanreadable) ? $version : $release;
        }
 
-       return false;
+       return FALSE;
 }
 
 /**
@@ -83,10 +92,10 @@ function version_upgrade_check() {
        $version = get_version();
 
        if ($version > $dbversion) {
-               return true;
+               return TRUE;
        }
 
-       return false;
+       return FALSE;
 }
 
 /**
@@ -96,12 +105,18 @@ function version_upgrade_check() {
 function version_upgrade() {
        $dbversion = (int) datalist_get('version');
 
+       // No version number? Oh snap...this is an upgrade from a clean installation < 1.7.
+       // Run all upgrades without error reporting and hope for the best.
+       // See http://trac.elgg.org/elgg/ticket/1432 for more.
+       $quiet = !$dbversion;
+
        // Upgrade database
-       db_upgrade($dbversion);
-       system_message(elgg_echo('upgrade:db'));
+       if (db_upgrade($dbversion, '', $quiet)) {
+               system_message(elgg_echo('upgrade:db'));
+       }
 
        // Upgrade core
-       if (upgrade_code($dbversion)) {
+       if (upgrade_code($dbversion, $quiet)) {
                system_message(elgg_echo('upgrade:core'));
        }
 
index dd5d43592023de1d32296100bfc9e4b13d9eba3d..988e70d89c6478520d9dc409c559edacad81bfa0 100644 (file)
---\r
--- Main Elgg database\r
--- \r
--- @link http://elgg.org/\r
---\r
-\r
--- --------------------------------------------------------\r
-\r
---\r
--- *** The main tables ***\r
---\r
-\r
--- Site configuration.\r
-CREATE TABLE `prefix_config` (\r
-  `name` varchar(32) NOT NULL,\r
-  `value` text NOT NULL,\r
-  `site_guid` int(11) NOT NULL,\r
-  PRIMARY KEY  (`name`,`site_guid`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Define entities. \r
-CREATE TABLE `prefix_entities` (\r
-       `guid` bigint(20) unsigned  NOT NULL auto_increment,\r
-       \r
-       `type` enum ('object', 'user', 'group', 'site') NOT NULL,\r
-       `subtype` int(11) NULL,\r
-       \r
-       `owner_guid` bigint(20) unsigned NOT NULL,\r
-    `site_guid` bigint(20) unsigned NOT NULL,\r
-    `container_guid` bigint(20) unsigned NOT NULL,\r
-       `access_id` int(11) NOT NULL,\r
-       \r
-       `time_created` int(11) NOT NULL,\r
-       `time_updated` int(11) NOT NULL,
-
-       `enabled` enum ('yes', 'no') NOT NULL default 'yes',\r
-       \r
-       primary key (`guid`),\r
-       KEY `type` (`type`),\r
-       KEY `subtype` (`subtype`),\r
-       KEY `owner_guid` (`owner_guid`),\r
-       KEY `site_guid` (`site_guid`),\r
-       KEY `container_guid` (`container_guid`),\r
-       KEY `access_id` (`access_id`),\r
-       KEY `time_created` (`time_created`),\r
-       KEY `time_updated` (`time_updated`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Entity subtypes - lets you subtype one of the main objects (sites/objects/etc)\r
-CREATE TABLE `prefix_entity_subtypes` (\r
-       `id` int(11) NOT NULL auto_increment,\r
-       \r
-       `type` enum ('object', 'user', 'group', 'site') NOT NULL,\r
-       `subtype` varchar(50) NOT NULL,\r
-       \r
-       class varchar(50) NOT NULL default '',\r
-       \r
-       PRIMARY KEY (`id`),\r
-       UNIQUE KEY (`type`, `subtype`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Describe relationships between entities, can describe friendships but also site membership, depending on context\r
-CREATE TABLE `prefix_entity_relationships` (\r
-  `id` int(11) NOT NULL auto_increment,\r
-  \r
-  `guid_one` bigint(20) unsigned  NOT NULL,\r
-  `relationship` varchar(50) NOT NULL,\r
-  `guid_two` bigint(20) unsigned  NOT NULL,\r
-  PRIMARY KEY  (`id`),\r
-  UNIQUE KEY (`guid_one`,`relationship`,`guid_two`),\r
-  KEY `relationship` (`relationship`),\r
-  KEY `guid_two` (`guid_two`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
---\r
--- *** Access controls ***\r
---\r
-\r
--- Table structure for table `access_collections`\r
-CREATE TABLE `prefix_access_collections` (\r
-  `id` int(11) NOT NULL auto_increment,\r
-  `name` text NOT NULL,\r
-  `owner_guid` bigint(20) unsigned NOT NULL,\r
-  `site_guid` bigint(20) unsigned NOT NULL default '0',\r
-\r
-  PRIMARY KEY  (`id`),\r
-  KEY `owner_guid` (`owner_guid`),\r
-  KEY `site_guid` (`site_guid`)\r
-) AUTO_INCREMENT=3  ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Access containers \r
-CREATE TABLE `prefix_access_collection_membership` (\r
-  `user_guid` int(11) NOT NULL,\r
-  `access_collection_id` int(11) NOT NULL,\r
-  PRIMARY KEY  (`user_guid`,`access_collection_id`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-\r
---\r
--- *** Entity superclass details ***\r
--- NB: Aside from GUID, these should now have any field names in common with the entities table.\r
---\r
-\r
--- Extra information relating to "objects"\r
-CREATE TABLE `prefix_objects_entity` (\r
-  `guid` bigint(20) unsigned  NOT NULL,\r
-  \r
-  `title` text NOT NULL,\r
-  `description` text NOT NULL,\r
-\r
+--
+-- Main Elgg database
+-- 
+-- @link http://elgg.org/
+--
+
+-- --------------------------------------------------------
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `prefix_access_collection_membership`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_access_collection_membership` (
+  `user_guid` int(11) NOT NULL,
+  `access_collection_id` int(11) NOT NULL,
+  PRIMARY KEY  (`user_guid`,`access_collection_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_access_collections`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_access_collections` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` text NOT NULL,
+  `owner_guid` bigint(20) unsigned NOT NULL,
+  `site_guid` bigint(20) unsigned NOT NULL default '0',
+  PRIMARY KEY  (`id`),
+  KEY `owner_guid` (`owner_guid`),
+  KEY `site_guid` (`site_guid`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_annotations`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_annotations` (
+  `id` int(11) NOT NULL auto_increment,
+  `entity_guid` bigint(20) unsigned NOT NULL,
+  `name_id` int(11) NOT NULL,
+  `value_id` int(11) NOT NULL,
+  `value_type` enum('integer','text') NOT NULL,
+  `owner_guid` bigint(20) unsigned NOT NULL,
+  `access_id` int(11) NOT NULL,
+  `time_created` int(11) NOT NULL,
+  `enabled` enum('yes','no') NOT NULL default 'yes',
+  PRIMARY KEY  (`id`),
+  KEY `entity_guid` (`entity_guid`),
+  KEY `name_id` (`name_id`),
+  KEY `value_id` (`value_id`),
+  KEY `owner_guid` (`owner_guid`),
+  KEY `access_id` (`access_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_api_users`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_api_users` (
+  `id` int(11) NOT NULL auto_increment,
+  `site_guid` bigint(20) unsigned default NULL,
+  `api_key` varchar(40) default NULL,
+  `secret` varchar(40) NOT NULL,
+  `active` int(1) default '1',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `api_key` (`api_key`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_config`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_config` (
+  `name` varchar(32) NOT NULL,
+  `value` text NOT NULL,
+  `site_guid` int(11) NOT NULL,
+  PRIMARY KEY  (`name`,`site_guid`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_datalists`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_datalists` (
+  `name` varchar(32) NOT NULL,
+  `value` text NOT NULL,
+  PRIMARY KEY  (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_entities`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_entities` (
+  `guid` bigint(20) unsigned NOT NULL auto_increment,
+  `type` enum('object','user','group','site') NOT NULL,
+  `subtype` int(11) default NULL,
+  `owner_guid` bigint(20) unsigned NOT NULL,
+  `site_guid` bigint(20) unsigned NOT NULL,
+  `container_guid` bigint(20) unsigned NOT NULL,
+  `access_id` int(11) NOT NULL,
+  `time_created` int(11) NOT NULL,
+  `time_updated` int(11) NOT NULL,
+  `enabled` enum('yes','no') NOT NULL default 'yes',
   PRIMARY KEY  (`guid`),
-  FULLTEXT KEY (`title`,`description`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Extra information relating to "sites"\r
-CREATE TABLE `prefix_sites_entity` (\r
-  `guid` bigint(20) unsigned  NOT NULL,\r
-  \r
-  `name` text NOT NULL,\r
-  `description` text NOT NULL,\r
-  `url` varchar(255) NOT NULL, \r
-   \r
-  PRIMARY KEY  (`guid`),\r
-  UNIQUE KEY (`url`),
-  FULLTEXT KEY (`name`,`description`, `url`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Extra information relating to "users"\r
-CREATE TABLE `prefix_users_entity` (\r
-  `guid` bigint(20) unsigned  NOT NULL,\r
-  \r
-  `name` text NOT NULL,\r
-  `username` varchar(128) NOT NULL default '',\r
-  `password` varchar(32) NOT NULL default '',\r
-  `salt`     varchar(8)  NOT NULL default '',\r
-  `email` text NOT NULL,\r
-  `language` varchar(6)  NOT NULL default '',\r
-  `code` varchar(32) NOT NULL default '',\r
-  `banned` enum ('yes', 'no') NOT NULL default 'no',\r
-  \r
-  `last_action` int(11) NOT NULL default '0',\r
-  `prev_last_action` int(11) NOT NULL default '0',\r
-  `last_login` int(11) NOT NULL default '0',\r
-  `prev_last_login` int(11) NOT NULL default '0',\r
-  \r
-  PRIMARY KEY  (`guid`),\r
-  UNIQUE KEY (`username`),\r
-  KEY `password` (`password`),\r
-  KEY `email` (`email`(50)),\r
-  KEY `code` (`code`),\r
-  KEY `last_action` (`last_action`),\r
-  KEY `last_login` (`last_login`),\r
-  FULLTEXT KEY `name` (`name`),
-  FULLTEXT KEY (`name`,`username`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
+  KEY `type` (`type`),
+  KEY `subtype` (`subtype`),
+  KEY `owner_guid` (`owner_guid`),
+  KEY `site_guid` (`site_guid`),
+  KEY `container_guid` (`container_guid`),
+  KEY `access_id` (`access_id`),
+  KEY `time_created` (`time_created`),
+  KEY `time_updated` (`time_updated`)
+) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_entity_relationships`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_entity_relationships` (
+  `id` int(11) NOT NULL auto_increment,
+  `guid_one` bigint(20) unsigned NOT NULL,
+  `relationship` varchar(50) NOT NULL,
+  `guid_two` bigint(20) unsigned NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `guid_one` (`guid_one`,`relationship`,`guid_two`),
+  KEY `relationship` (`relationship`),
+  KEY `guid_two` (`guid_two`)
+) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_entity_subtypes`
+--
 
--- Extra information relating to "groups"
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_entity_subtypes` (
+  `id` int(11) NOT NULL auto_increment,
+  `type` enum('object','user','group','site') NOT NULL,
+  `subtype` varchar(50) NOT NULL,
+  `class` varchar(50) NOT NULL default '',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `type` (`type`,`subtype`)
+) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_geocode_cache`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_geocode_cache` (
+  `id` int(11) NOT NULL auto_increment,
+  `location` varchar(128) default NULL,
+  `lat` varchar(20) default NULL,
+  `long` varchar(20) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `location` (`location`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_groups_entity`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
 CREATE TABLE `prefix_groups_entity` (
-  `guid` bigint(20) unsigned  NOT NULL,\r
-  \r
-  `name` text NOT NULL,\r
-  `description` text NOT NULL,\r
-   \r
-  PRIMARY KEY  (`guid`),\r
-  KEY `name` (`name`(50)),\r
+  `guid` bigint(20) unsigned NOT NULL,
+  `name` text NOT NULL,
+  `description` text NOT NULL,
+  PRIMARY KEY  (`guid`),
+  KEY `name` (`name`(50)),
   KEY `description` (`description`(50)),
-  FULLTEXT KEY (`name`,`description`)
+  FULLTEXT KEY `name_2` (`name`,`description`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-\r
---\r
--- *** Annotations and tags ***\r
---\r
-\r
--- Table structure for annotations\r
-CREATE TABLE `prefix_annotations` (\r
-       `id` int(11) NOT NULL auto_increment,\r
-       \r
-       `entity_guid` bigint(20) unsigned  NOT NULL,\r
-       \r
-       `name_id` int(11) NOT NULL,\r
-       `value_id` int(11) NOT NULL,\r
-       `value_type` enum ('integer','text') NOT NULL,\r
-       \r
-       `owner_guid` bigint(20) unsigned NOT NULL,\r
-       `access_id` int(11) NOT NULL,\r
-       \r
-       `time_created` int(11) NOT NULL,\r
-\r
-       `enabled` enum ('yes', 'no') NOT NULL default 'yes',\r
-       \r
-       PRIMARY KEY (`id`),\r
-       KEY `entity_guid` (`entity_guid`),\r
-       KEY `name_id` (`name_id`),\r
-       KEY `value_id` (`value_id`),\r
-       KEY `owner_guid` (`owner_guid`),\r
-       KEY `access_id` (`access_id`)\r
-\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Table structure for metadata\r
-CREATE TABLE `prefix_metadata` (\r
-       `id` int(11) NOT NULL auto_increment,\r
-       \r
-       `entity_guid` bigint(20) unsigned  NOT NULL,\r
-       \r
-       `name_id` int(11) NOT NULL,\r
-       `value_id` int(11) NOT NULL,\r
-       `value_type` enum ('integer','text') NOT NULL,\r
-\r
-       `owner_guid` bigint(20) unsigned NOT NULL,\r
-       `access_id` int(11) NOT NULL,\r
-       \r
-       `time_created` int(11) NOT NULL,
-
-       `enabled` enum ('yes', 'no') NOT NULL default 'yes',\r
-       \r
-       PRIMARY KEY (`id`),\r
-       KEY `entity_guid` (`entity_guid`),\r
-       KEY `name_id` (`name_id`),\r
-       KEY `value_id` (`value_id`),\r
-       KEY `owner_guid` (`owner_guid`),\r
-       KEY `access_id` (`access_id`)\r
-\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Meta strings table (avoids storing text strings more than once)\r
-CREATE TABLE `prefix_metastrings` (\r
-       `id` int(11) NOT NULL auto_increment,\r
-       `string` TEXT NOT NULL,\r
-       \r
-       PRIMARY KEY (`id`),
-       KEY `string` (`string`(50))\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
---\r
--- *** Misc ***\r
---\r
-\r
--- API Users\r
-CREATE TABLE `prefix_api_users` (\r
-       id     int(11)     auto_increment,\r
-       \r
-       site_guid bigint(20) unsigned,\r
-       \r
-       api_key   varchar(40),\r
-       secret    varchar(40) NOT NULL,\r
-       active    int(1) default 1,\r
-       \r
-       unique key (api_key),\r
-       primary key (id)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- API Sessions\r
-CREATE TABLE `prefix_users_apisessions` (\r
-       `id` int(11) NOT NULL auto_increment,\r
-       `user_guid` bigint(20) unsigned NOT NULL,\r
-       `site_guid` bigint(20) unsigned NOT NULL,\r
-       \r
-       `token` varchar(40),\r
-       \r
-       `expires` int(11) NOT NULL,\r
-       \r
-       PRIMARY KEY  (`id`),\r
-       UNIQUE KEY (`user_guid`,`site_guid`),\r
-       KEY `token` (`token`)\r
-) ENGINE=MEMORY;\r
-\r
--- HMAC Cache protecting against Replay attacks\r
-CREATE TABLE `prefix_hmac_cache` (\r
-       `hmac` varchar(255) NOT NULL,\r
-       `ts` int(11) NOT NULL,\r
-\r
-       PRIMARY KEY  (`hmac`),\r
-       KEY `ts` (`ts`)\r
-) ENGINE=MEMORY;\r
-\r
--- Geocode engine cache\r
-CREATE TABLE `prefix_geocode_cache` (\r
-       id     int(11)     auto_increment,\r
-       location varchar(128),\r
-       `lat`    varchar(20),\r
-       `long`   varchar(20),\r
-       \r
-       PRIMARY KEY (`id`),\r
-    UNIQUE KEY `location` (`location`)\r
-       \r
-) ENGINE=MEMORY;\r
-\r
--- PHP Session storage\r
-CREATE TABLE `prefix_users_sessions` (\r
-       `session` varchar(255) NOT NULL,\r
-       `ts` int(11) unsigned NOT NULL default '0',\r
-       `data` mediumblob,\r
-       \r
-       PRIMARY KEY `session` (`session`),\r
-       KEY `ts` (`ts`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Datalists for things like db version\r
-CREATE TABLE `prefix_datalists` (\r
-  `name` varchar(32) NOT NULL,\r
-  `value` text NOT NULL,\r
-  PRIMARY KEY `name` (`name`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- Ultra-private system settings for entities\r
-CREATE TABLE `prefix_private_settings` (\r
-       `id` INT NOT NULL auto_increment,\r
-       `entity_guid` INT NOT NULL ,\r
-       `name` varchar(128) NOT NULL ,\r
-       `value` TEXT NOT NULL ,\r
-       PRIMARY KEY ( `id` ) ,\r
-       UNIQUE KEY ( `entity_guid` , `name` ),\r
-       KEY `name` (`name`),\r
-       KEY `value` (`value` (50))\r
-) ENGINE = MYISAM  DEFAULT CHARSET=utf8;\r
-\r
--- System log\r
-CREATE TABLE `prefix_system_log` (\r
-       `id` int(11) NOT NULL auto_increment,\r
-       \r
-       `object_id` int(11) NOT NULL,\r
-\r
-       `object_class` varchar(50) NOT NULL,\r
-       `object_type` varchar(50) NOT NULL,\r
-       `object_subtype` varchar(50) NOT NULL,\r
-       \r
-       `event` varchar(50) NOT NULL,\r
-       `performed_by_guid` int(11) NOT NULL,\r
-\r
-       `owner_guid` int(11) NOT NULL,\r
-       `access_id` int(11) NOT NULL,\r
-       \r
-       `enabled` enum ('yes', 'no') NOT NULL default 'yes',\r
-\r
-       `time_created` int(11) NOT NULL,\r
-       \r
-       PRIMARY KEY  (`id`),\r
-       KEY `object_id` (`object_id`),\r
-       KEY `object_class` (`object_class`),\r
-       KEY `object_type` (`object_type`),\r
-       KEY `object_subtype` (`object_subtype`),\r
-       KEY `event` (`event`),\r
-       KEY `performed_by_guid` (`performed_by_guid`),\r
-       KEY `access_id` (`access_id`),\r
-       KEY `time_created` (`time_created`),\r
-       KEY `river_key` (`object_type`, `object_subtype`, `event`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- River\r
- CREATE TABLE `prefix_river` (\r
-       `id` INT NOT NULL AUTO_INCREMENT ,\r
-       `type` VARCHAR( 8 ) NOT NULL ,\r
-       `subtype` VARCHAR( 32 ) NOT NULL ,\r
-       `action_type` VARCHAR( 32 ) NOT NULL ,\r
-       `access_id` INT NOT NULL ,\r
-       `view` TEXT NOT NULL ,\r
-       `subject_guid` INT NOT NULL ,\r
-       `object_guid` INT NOT NULL ,\r
-       `annotation_id` int(11) NOT NULL,\r
-       `posted` INT NOT NULL ,\r
-       PRIMARY KEY ( `id` ) ,\r
-       KEY `type` (`type`),\r
-       KEY `action_type` (`action_type`),\r
-       KEY `access_id` (`access_id`),\r
-       KEY `subject_guid` (`subject_guid`),\r
-       KEY `object_guid` (`object_guid`),\r
-       KEY `annotation_id` (`annotation_id`),\r
-       KEY `posted` (`posted`)\r
-) ENGINE = MYISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_hmac_cache`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_hmac_cache` (
+  `hmac` varchar(255) NOT NULL,
+  `ts` int(11) NOT NULL,
+  PRIMARY KEY  (`hmac`),
+  KEY `ts` (`ts`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_metadata`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_metadata` (
+  `id` int(11) NOT NULL auto_increment,
+  `entity_guid` bigint(20) unsigned NOT NULL,
+  `name_id` int(11) NOT NULL,
+  `value_id` int(11) NOT NULL,
+  `value_type` enum('integer','text') NOT NULL,
+  `owner_guid` bigint(20) unsigned NOT NULL,
+  `access_id` int(11) NOT NULL,
+  `time_created` int(11) NOT NULL,
+  `enabled` enum('yes','no') NOT NULL default 'yes',
+  PRIMARY KEY  (`id`),
+  KEY `entity_guid` (`entity_guid`),
+  KEY `name_id` (`name_id`),
+  KEY `value_id` (`value_id`),
+  KEY `owner_guid` (`owner_guid`),
+  KEY `access_id` (`access_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=92 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_metastrings`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_metastrings` (
+  `id` int(11) NOT NULL auto_increment,
+  `string` text NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `string` (`string`(50))
+) ENGINE=MyISAM AUTO_INCREMENT=67 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_objects_entity`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_objects_entity` (
+  `guid` bigint(20) unsigned NOT NULL,
+  `title` text NOT NULL,
+  `description` text NOT NULL,
+  PRIMARY KEY  (`guid`),
+  FULLTEXT KEY `title` (`title`,`description`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_private_settings`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_private_settings` (
+  `id` int(11) NOT NULL auto_increment,
+  `entity_guid` int(11) NOT NULL,
+  `name` varchar(128) NOT NULL,
+  `value` text NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `entity_guid` (`entity_guid`,`name`),
+  KEY `name` (`name`),
+  KEY `value` (`value`(50))
+) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_river`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_river` (
+  `id` int(11) NOT NULL auto_increment,
+  `type` varchar(8) NOT NULL,
+  `subtype` varchar(32) NOT NULL,
+  `action_type` varchar(32) NOT NULL,
+  `access_id` int(11) NOT NULL,
+  `view` text NOT NULL,
+  `subject_guid` int(11) NOT NULL,
+  `object_guid` int(11) NOT NULL,
+  `annotation_id` int(11) NOT NULL,
+  `posted` int(11) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `type` (`type`),
+  KEY `action_type` (`action_type`),
+  KEY `access_id` (`access_id`),
+  KEY `subject_guid` (`subject_guid`),
+  KEY `object_guid` (`object_guid`),
+  KEY `annotation_id` (`annotation_id`),
+  KEY `posted` (`posted`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_sites_entity`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_sites_entity` (
+  `guid` bigint(20) unsigned NOT NULL,
+  `name` text NOT NULL,
+  `description` text NOT NULL,
+  `url` varchar(255) NOT NULL,
+  PRIMARY KEY  (`guid`),
+  UNIQUE KEY `url` (`url`),
+  FULLTEXT KEY `name` (`name`,`description`,`url`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_system_log`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_system_log` (
+  `id` int(11) NOT NULL auto_increment,
+  `object_id` int(11) NOT NULL,
+  `object_class` varchar(50) NOT NULL,
+  `object_type` varchar(50) NOT NULL,
+  `object_subtype` varchar(50) NOT NULL,
+  `event` varchar(50) NOT NULL,
+  `performed_by_guid` int(11) NOT NULL,
+  `owner_guid` int(11) NOT NULL,
+  `access_id` int(11) NOT NULL,
+  `enabled` enum('yes','no') NOT NULL default 'yes',
+  `time_created` int(11) NOT NULL,
+  PRIMARY KEY  (`id`),
+  KEY `object_id` (`object_id`),
+  KEY `object_class` (`object_class`),
+  KEY `object_type` (`object_type`),
+  KEY `object_subtype` (`object_subtype`),
+  KEY `event` (`event`),
+  KEY `performed_by_guid` (`performed_by_guid`),
+  KEY `access_id` (`access_id`),
+  KEY `time_created` (`time_created`),
+  KEY `river_key` (`object_type`,`object_subtype`,`event`)
+) ENGINE=MyISAM AUTO_INCREMENT=194 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_users_apisessions`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_users_apisessions` (
+  `id` int(11) NOT NULL auto_increment,
+  `user_guid` bigint(20) unsigned NOT NULL,
+  `site_guid` bigint(20) unsigned NOT NULL,
+  `token` varchar(40) default NULL,
+  `expires` int(11) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `user_guid` (`user_guid`,`site_guid`),
+  KEY `token` (`token`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_users_entity`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_users_entity` (
+  `guid` bigint(20) unsigned NOT NULL,
+  `name` text NOT NULL,
+  `username` varchar(128) NOT NULL default '',
+  `password` varchar(32) NOT NULL default '',
+  `salt` varchar(8) NOT NULL default '',
+  `email` text NOT NULL,
+  `language` varchar(6) NOT NULL default '',
+  `code` varchar(32) NOT NULL default '',
+  `banned` enum('yes','no') NOT NULL default 'no',
+  `last_action` int(11) NOT NULL default '0',
+  `prev_last_action` int(11) NOT NULL default '0',
+  `last_login` int(11) NOT NULL default '0',
+  `prev_last_login` int(11) NOT NULL default '0',
+  PRIMARY KEY  (`guid`),
+  UNIQUE KEY `username` (`username`),
+  KEY `password` (`password`),
+  KEY `email` (`email`(50)),
+  KEY `code` (`code`),
+  KEY `last_action` (`last_action`),
+  KEY `last_login` (`last_login`),
+  FULLTEXT KEY `name` (`name`),
+  FULLTEXT KEY `name_2` (`name`,`username`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `prefix_users_sessions`
+--
+
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `prefix_users_sessions` (
+  `session` varchar(255) NOT NULL,
+  `ts` int(11) unsigned NOT NULL default '0',
+  `data` mediumblob,
+  PRIMARY KEY  (`session`),
+  KEY `ts` (`ts`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2010-01-08 20:13:45