function do_updates() { // ALL DATABASE UPDATES GO IN HERE! // FOR EACH SQL STATEMENT YOU WANT TO EXECUTE, GIVE IT A 'KEY', THEN CALL: // $this->qup("key", "sql statement"); // eg. $this->qup("new foobar table", "create table foobar (id int not null, primary key(id))"); // YOU SHOULD NORMALLY PUT YOUR UPDATES AT THE *END* OF THIS FUNCTION. /** NOTE: KEY must be unique for each update query */ /** EXAMPLE ADD NEW TABLE */ /* $this->qup("new mc_feeds table", "CREATE TABLE mc_feeds ( user_id int not null, id int not null auto_increment, primary key(user_id,id), feed_url text not null, feed_name varchar(255) )"); */ /** EXAMPLE ALTER TABLE */ // $this->qup("add feed_description to mc_feeds", "ALTER TABLE mc_feeds ADD COLUMN feed_description TEXT"); /** EXAMPLE INSERT INTO TABLE */ // $this->qup("insert default data 1 for relation classifications", "INSERT INTO `relation_classifications` (`relation_type`, `relation_type_id`) VALUES ('acquaintance', '1');"); /** EXAMPLE UPDATE TABLE */ // $this->qup("changed id field in review-type movie", "UPDATE review_type SET review_id = 1 WHERE review_name = 'Movie'"); // finally, run the 'safe' updates in net_extra.php. $child_role = array('id' => 9, 'name' => 'Child', 'description' => 'Role for family members with Child status', 'read_only' => 1, 'type' => 'group', 'tasks' => array(12, 13, 15, 16, 22, 30)); $this->qup_all_networks("2009-09-28, by: Zoran Hron - adding Child role, ID: " . $child_role['id'], "INSERT INTO {roles} (id, name, description, created, changed, read_only, type)\n VALUES (" . $child_role['id'] . ", '" . $child_role['name'] . "', '" . $child_role['description'] . "', " . time() . ", " . time() . ", " . $child_role['read_only'] . ", '" . $child_role['type'] . "')\n ON DUPLICATE KEY UPDATE name = '" . $child_role['name'] . "', description = '" . $child_role['description'] . "', read_only = " . $child_role['read_only'] . ", type = '" . $child_role['type'] . "'"); foreach ($child_role['tasks'] as $task_id) { $this->qup_all_networks("2009-09-28, by: Zoran Hron - adding tasks/permissions for Child role. ID=" . $child_role['id'] . ", task ID=" . $task_id, "INSERT IGNORE INTO {tasks_roles} (`task_id`, `role_id`) VALUES (" . $task_id . ", " . $child_role['id'] . ");"); } $this->run_xml_updates(); run_net_extra(); }
function do_updates() { // ALL DATABASE UPDATES GO IN HERE! // FOR EACH SQL STATEMENT YOU WANT TO EXECUTE, GIVE IT A 'KEY', THEN CALL: // $this->qup("key", "sql statement"); // eg. $this->qup("new foobar table", "create table foobar (id int not null, primary key(id))"); // YOU SHOULD NORMALLY PUT YOUR UPDATES AT THE *END* OF THIS FUNCTION. /** NOTE: KEY must be unique for each update query */ /** EXAMPLE ADD NEW TABLE */ /*$this->qup("new mc_feeds table", "CREATE TABLE mc_feeds ( user_id int not null, id int not null auto_increment, primary key(user_id,id), feed_url text not null, feed_name varchar(255) )"); */ /** EXAMPLE ALTER TABLE */ // $this->qup("add feed_description to mc_feeds", "ALTER TABLE mc_feeds ADD COLUMN feed_description TEXT"); /** EXAMPLE INSERT INTO TABLE */ // $this->qup("insert default data 1 for relation classifications", "INSERT INTO `relation_classifications` (`relation_type`, `relation_type_id`) VALUES ('acquaintance', '1');"); /** EXAMPLE UPDATE TABLE */ // $this->qup("changed id field in review-type movie", "UPDATE review_type SET review_id = 1 WHERE review_name = 'Movie'"); if (!$this->column_exists('users','zipcode')) { $this->qup("add zipcode column to users", "ALTER TABLE `users` ADD `zipcode` INT( 11 ) AFTER `last_login`"); } $this->qup("changed forgot_password_id type", "ALTER TABLE `forgot_password` CHANGE `forgot_password_id` `forgot_password_id` VARCHAR( 255 ) NOT NULL DEFAULT '0'"); if (!$this->column_exists('contents','display_on')) { $this->qup("display_on added to contents table", "ALTER TABLE `contents` ADD `display_on` TINYINT( 1 ) DEFAULT '0' NOT NULL"); } if (!$this->table_exists('tags_networks')) { $this->qup("tags_networks table", "CREATE TABLE `tags_networks` ( `tag_id` int(11) NOT NULL default '0', `network_id` int(11) NOT NULL default '0' )"); } if (!$this->table_exists('networks')) { $this->qup("networks table", "CREATE TABLE `networks` ( `network_id` int(11) NOT NULL auto_increment, `name` varchar(50) default NULL, `address` varchar(50) default NULL, `tagline` varchar(255) default NULL, `type` int(1) default '0', `maximum_members` int(11) default '0', `category_id` int(11) default '0', `description` text, `header_image` varchar(255) default NULL, `inner_logo_image` varchar(255) default NULL, `network_alt_text` varchar(255) default NULL, `is_active` int(1) default '0', `created` int(11) default '0', `changed` int(11) default '0', `stop_after_limit` int(1) default '0', `extra` text, PRIMARY KEY (`network_id`) )"); } if (!$this->table_exists('networks_users')) { $this->qup("networks_users table", "CREATE TABLE `networks_users` ( `network_id` int(11) NOT NULL default '0', `user_id` int(11) NOT NULL default '0', `user_type` varchar(50) NOT NULL default '' )"); } if (!$this->table_exists('linkcategories')) { $this->qup("linkcategories table", "CREATE TABLE `linkcategories` ( `category_id` int(11) NOT NULL auto_increment, `category_name` varchar(255) default NULL, `user_id` int(11) default NULL, `created` int(11) default NULL, `changed` int(11) default NULL, `is_active` tinyint(1) default NULL, PRIMARY KEY (`category_id`) )"); } if (!$this->table_exists('links')) { $this->qup("links table", "CREATE TABLE `links` ( `link_id` int(11) NOT NULL auto_increment, `title` varchar(255) default NULL, `url` varchar(255) default NULL, `category_id` int(11) default NULL, `created` int(11) default NULL, `changed` int(11) default NULL, `is_active` tinyint(1) default NULL, PRIMARY KEY (`link_id`) )"); } // $this->qup_all_networks("announcements table", // "CREATE TABLE IF NOT EXISTS {announcements} ( // `content_id` int(11) NOT NULL default 0, // `announcement_time` int(11) NOT NULL default 0, // `position` tinyint(1) NOT NULL default 0, // `status` tinyint(1) NOT NULL default 0, // `is_active` tinyint(1) NOT NULL default 0 // // )"); if (!$this->table_exists('external_feed')) { $this->qup("creating table external_feed", "CREATE TABLE `external_feed` ( `feed_id` int(11) NOT NULL auto_increment, `import_url` varchar(255) NOT NULL default '', `max_posts` smallint(4) default '5', `is_active` int(2) default NULL, `feed_type` varchar(100) NOT NULL default 'user', `last_build_date` int(11) default NULL, PRIMARY KEY (`feed_id`) )"); } if (!$this->table_exists('feed_data')) { $this->qup("creating table feed_data", "CREATE TABLE `feed_data` ( `feed_data_id` int(11) NOT NULL auto_increment, `feed_id` int(11) NOT NULL default '0', `title` varchar(255) default NULL, `description` text, `original_url` varchar(255) default NULL, PRIMARY KEY (`feed_data_id`) )"); } if (!$this->table_exists('user_feed')) { $this->qup("creating table user_feed", "CREATE TABLE `user_feed` ( `user_id` int(11) NOT NULL default '0', `feed_id` int(11) NOT NULL default '0' )"); } if (!$this->table_exists('users_online')) { $this->qup("create users_online table", "CREATE TABLE `users_online` (`user_id` INT(11) NOT NULL, `timestamp` INT(11) NOT NULL)"); } //TO DO::: ALTER TABLE `forgot_password` CHANGE `forgot_password_id` `forgot_password_id` VARCHAR( 255 ) NOT NULL DEFAULT '0' if (!$this->column_exists('networks','inner_logo_image')) { $this->qup("added one column named inner_logo_image in networks table", "ALTER TABLE `networks` ADD `inner_logo_image` VARCHAR( 255 ) AFTER `header_image`"); } if (!$this->column_exists('networks','network_alt_text')) { $this->qup("added one column named network_alt_text in networks table", "ALTER TABLE `networks` ADD `network_alt_text` VARCHAR( 255 ) AFTER `description`"); } if (!$this->column_exists('images','image_perm')) { $this->qup("added one more column in images table", "ALTER TABLE `images` ADD `image_perm` INT( 2 ) DEFAULT '0' NOT NULL AFTER `image_file`"); } if (!$this->column_exists('audios','audio_perm')) { $this->qup("added one more column in audios table", "ALTER TABLE `audios` ADD `audio_perm` INT( 2 ) DEFAULT '0' NOT NULL AFTER `audio_file`"); } if (!$this->column_exists('videos','video_perm')) { $this->qup("added one more column in videos table", "ALTER TABLE `videos` ADD `video_perm` INT( 2 ) DEFAULT '0' NOT NULL AFTER `video_file`"); } if ($this->column_exists('users','zipcode')) { $this->qup("delete zipcode field from users table", "ALTER TABLE `users` DROP `zipcode`"); } if (!$this->table_exists('configurable_text')) { $this->qup("configurable text table", "CREATE TABLE `configurable_text` ( `id` int(11) NOT NULL auto_increment, `caption` varchar(255) default NULL, `caption_value` varchar(255) default NULL, PRIMARY KEY (`id`) )"); $this->qup("record1", "INSERT INTO `configurable_text` VALUES (1, 'News', 'News')"); $this->qup("record2", "INSERT INTO `configurable_text` VALUES (2, 'NewsHeading3', 'Google Buys Quebec')"); $this->qup("record3", "INSERT INTO `configurable_text` VALUES (3, 'NewsHeading2', 'AOL Releases Virginia')"); $this->qup("record4", "INSERT INTO `configurable_text` VALUES (4, 'NewsHeading1', 'EMI Launches')"); $this->qup("record5", "INSERT INTO `configurable_text` VALUES (5, 'Standards', ' Standards')"); $this->qup("record6", "INSERT INTO `configurable_text` VALUES (6, 'Standard1', 'iTags v3.0 Ships')"); $this->qup("record7", "INSERT INTO `configurable_text` VALUES (7, 'Standard2', 'AOL supports SB.org')"); $this->qup("record8", "INSERT INTO `configurable_text` VALUES (8, 'Standard3', 'Apple Adheres to mRSS')"); $this->qup("record9", "INSERT INTO `configurable_text` VALUES (9, 'Scene1', 'Marc Canter speaking at current conferences and The Scene...')"); } // 2006-06: auto-update $this->qup("create svn_objects table", "CREATE TABLE svn_objects (path VARCHAR(255) NOT NULL, kind VARCHAR(32) NOT NULL, hash VARCHAR(32), revision INT NOT NULL, is_active BOOL NOT NULL DEFAULT 1, PRIMARY KEY(is_active, path, revision), UNIQUE(revision, path))"); $this->qup("create svn_meta table", "CREATE TABLE svn_meta (revision INT NOT NULL)"); $this->qup("add repos_root to svn_meta", "ALTER TABLE svn_meta ADD COLUMN repos_root TEXT NOT NULL"); $this->qup("add repos_path to svn_meta", "ALTER TABLE svn_meta ADD COLUMN repos_path TEXT NOT NULL"); $this->qup("add held_revision to svn_objecs", "ALTER TABLE svn_objects ADD COLUMN held_revision INT"); // 2006-09-05: blog badge $this->qup_all_networks("create blog_badges table", "CREATE TABLE {blog_badges} (user_id INT NOT NULL, badge_tag VARCHAR(32) NOT NULL, PRIMARY KEY(user_id, badge_tag), badge_config TEXT NOT NULL)"); // 2007-01-15: friendly name and the ability to delete badges $this->qup_all_networks("add blog_badges.title, blog_badges.is_active and blog_badges.badge_id", "ALTER TABLE {blog_badges} DROP PRIMARY KEY, ADD COLUMN badge_id INT NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY(badge_id), ADD COLUMN title VARCHAR(255) NOT NULL DEFAULT '', ADD COLUMN is_active INT NOT NULL DEFAULT 1, ADD KEY user_badges (is_active, user_id, badge_tag)"); // 2006-11-13: run net_extra so $this->qup_all_networks will properly update the home network. $this->qup("run net_extra to put the home network into the database - try 2", "run_net_extra_once_only"); // 2006-11-10: network_links $this->qup_all_networks("create network_links table - try 2", "CREATE TABLE IF NOT EXISTS {network_links} ( link_id int(11) NOT NULL auto_increment, title varchar(255) default NULL, url varchar(255) default NULL, category_id int(11) default NULL, created int(11) default NULL, changed int(11) default NULL, is_active tinyint(1) default NULL, PRIMARY KEY (link_id) )"); // 2006-11-10: network_linkcategories $this->qup_all_networks("create network_linkcategories table - try 2", "CREATE TABLE IF NOT EXISTS {network_linkcategories} ( category_id int(11) NOT NULL auto_increment, category_name varchar(255) default NULL, user_id int(11) default NULL, created int(11) default NULL, changed int(11) default NULL, is_active tinyint(1) default NULL, PRIMARY KEY (category_id) ) "); // 2006-09-07: comment spam tracking $this->qup_all_networks("comments.ip_addr column", "ALTER TABLE {comments} ADD COLUMN ip_addr VARCHAR(32) NOT NULL"); $this->qup_all_networks("comments.referrer column", "ALTER TABLE {comments} ADD COLUMN referrer TEXT NOT NULL"); $this->qup_all_networks("comments.user_agent column", "ALTER TABLE {comments} ADD COLUMN user_agent VARCHAR(255) NOT NULL"); $this->qup("create spam_terms table", "CREATE TABLE spam_terms (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), term VARCHAR(255) NOT NULL)"); // spam_state; 0: not spam; 1: manually deleted; 2: bulk-deleted by spam terms; 3: flagged by akismet; 4: deleted by domain blacklist $this->qup_all_networks("comments.spam_state column 2", "ALTER TABLE {comments} ADD COLUMN spam_state INT NOT NULL DEFAULT 0"); // 1 if akismet has said this is spam, 0 if not spam, null if we haven't asked akismet $this->qup_all_networks("comments.akismet_spam column", "ALTER TABLE {comments} ADD COLUMN akismet_spam BOOL DEFAULT NULL"); // index of domain names present in links in comments (for spam detection) (domain = top part of domain, e.g. "bmw07.com" for "phentermine-online.bmw07.com"; count = total number of times this domain name has been seen in comments, ever; blacklisted = {0: unknown, 1: blacklisted manually, 2: on a dns blacklist}; whitelisted = {0: unknown, 1: whitelisted manually}) $this->qup("create spam_domains table", "CREATE TABLE spam_domains (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), domain VARCHAR(255) NOT NULL, UNIQUE(domain), count INT NOT NULL, blacklisted INT NOT NULL DEFAULT 0, whitelisted INT NOT NULL DEFAULT 0)"); $this->qup("index blacklist flags on spam_domains", "ALTER TABLE spam_domains ADD KEY blacklisted (blacklisted)"); $this->qup("spam_domains.active_count", "ALTER TABLE spam_domains ADD COLUMN active_count INT NOT NULL"); // active_count counts how many times the domain appears in *active* comments. // linking domain names to comments - so we can go back later on and delete spammy comments *after* a domain gets blacklisted. $this->qup("create domains_in_comments table", "CREATE TABLE domains_in_comments (domain_id INT NOT NULL, comment_id INT NOT NULL, PRIMARY KEY(comment_id, domain_id), KEY(domain_id), occurrences INT NOT NULL)"); // 2005-10-28 Martin $this->qup("alter relation table for external relations", "ALTER TABLE relations ADD `network` VARCHAR( 255 ) NULL, ADD `network_uid` VARCHAR( 255 ) NULL, ADD `display_name` VARCHAR( 255 ) NULL, ADD `thumbnail_url` TINYTEXT NULL, ADD `profile_url` TINYTEXT NULL"); // 2006-11-20 Phil $this->qup("change length of mc_db_status.network to 50", "ALTER TABLE mc_db_status CHANGE COLUMN network network VARCHAR(50) NOT NULL DEFAULT '', DROP PRIMARY KEY, ADD PRIMARY KEY(stmt_key, network)"); // 2006-11-27 Martin $this->qup("move profile data: blog_url ", "UPDATE `user_profile_data` SET `field_name` = 'blog_url', `field_type` = 'blogs_rss' WHERE `field_name` = 'blog_url'" ); // 2006-11-27 Martin $this->qup("move profile data: blog_title ", "UPDATE `user_profile_data` SET `field_name` = 'blog_title', `field_type` = 'blogs_rss' WHERE `field_name` = 'blog_title'"); // 2006-11-27 Martin $this->qup("move profile data: flickr id", "UPDATE `user_profile_data` SET `field_name` = 'flickr_email', `field_type` = 'external' WHERE `field_name` = 'flickr'"); // 2006-11-27 Martin $this->qup("move profile data: delicious id", "UPDATE `user_profile_data` SET `field_name` = 'delicious', `field_type` = 'external' WHERE `field_name` = 'delicious'"); //2006-11-28 Gurpreet if ($this->column_exists("external_feed", "user_id")) { $this->qup("deleting user_id column from external_feed", "ALTER TABLE `external_feed` DROP `user_id`"); } // 2006-11-28 Martin $this->qup("add sequence field to profile: multiple values of one name", "ALTER TABLE `user_profile_data` ADD `seq` INT( 3 ) UNSIGNED ZEROFILL NULL"); // 2006-11-30 Martin $this->qup("ensure sequence is set for blog_url fields", "UPDATE `user_profile_data` SET `seq` = 1 WHERE `field_name` = 'blog_url' AND seq = NULL"); // 2006-11-30 Martin $this->qup("ensure sequence is set for blog_title fields", "UPDATE `user_profile_data` SET `seq` = 1 WHERE `field_name` = 'blog_title' AND seq = NULL"); // 2006-11-30 Martin $this->qup("ensure sequence is set for blog_feed fields", "UPDATE `user_profile_data` SET `seq` = 1 WHERE `field_name` = 'blog_feed' AND seq = NULL"); // 2006-12-08 Gurpreet if (!$this->column_exists("relations", "in_family")) { $this->qup("adding in_family field to relations table", "ALTER TABLE `relations` ADD `in_family` INT( 2 ) "); } // 2007-01-03 Ekta if (!$this->column_exists('relations','status')) { $this->qup("status added to relations table", "ALTER TABLE `relations` ADD `status` ENUM('denied', 'pending', 'approved') DEFAULT 'approved' NOT NULL"); } // 2007-01-04 Kuldeep - creating table moduledata // This table is used to hold the values for various modules e.g. // Personalised video, emblem modules if (!$this->table_exists("moduledata")) { $this->qup("creating table moduledata", "CREATE TABLE IF NOT EXISTS `moduledata` ( `id` int(11) NOT NULL auto_increment, `modulename` varchar(255) default NULL, `caption` varchar(255) default NULL, `data` text, `created` int(11) default NULL, `changed` int(11) default NULL, PRIMARY KEY (`id`), UNIQUE KEY `modulename` (`modulename`) ) "); $this->qup("inserting for LogoModule", 'INSERT INTO `moduledata` (`id`, `modulename`, `caption`, `data`, `created`, `changed`) VALUES (1, \'LogoModule\', NULL, NULL, NULL, 1167849000)'); $this->qup("inserting for TakeATourModule", 'INSERT INTO `moduledata` (`id`, `modulename`, `caption`, `data`, `created`, `changed`) VALUES (2, \'TakeTour\', NULL, NULL, NULL, 1167849000)'); } // 2007-04-17 Ekta - creating table advertisements // This table will be used for manage ad-center at PA $this->qup_all_networks("creating table advertisements", "CREATE TABLE IF NOT EXISTS {advertisements} ( `ad_id` int(11) NOT NULL auto_increment, `user_id` int(11) NOT NULL, `ad_image` varchar(255) default NULL, `url` varchar(255) default NULL, `ad_script` text default NULL, `title` varchar(255) default NULL, `description` text default NULL, `page_id` int(11) default NULL, `orientation` int(11) default NULL, `is_active` tinyint(1) default NULL, `created` int(11) default NULL, `changed` int(11) default NULL, `display_count` int(11) default 0, `hit_count` int(11) default 0, PRIMARY KEY (`ad_id`) ) "); // Added by Saurabh for the Testimonial if (!$this->table_exists('testimonials')) { $this->qup("Creating table Testimonials ","CREATE TABLE `testimonials` ( `testimonial_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `sender_id` INT( 11 ) NOT NULL , `recipient_id` INT( 11 ) NOT NULL , `body` TEXT NOT NULL , `status` VARCHAR( 50 ) NULL , `is_active` TINYINT( 1 ) NULL , `created` INT( 11 ) NOT NULL , `changed` INT( 11 ) NOT NULL )"); } // added by saurabh for the Report Abuse $this->qup_all_networks("Creating table Report abuse ","CREATE TABLE IF NOT EXISTS {report_abuse} ( `report_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY , `parent_type` VARCHAR(100) NULL , `parent_id` INT(11) NOT NULL , `reporter_id` INT(11) NULL , `body` TEXT NULL , `created` INT(11) NOT NULL )"); // added by saurabh for the comment on everything $this->qup_all_networks("adding parent_type and parent_id into comments table", "ALTER TABLE {comments} ADD `parent_id` INT( 11 ) NULL , ADD `parent_type` VARCHAR( 100 ) NULL ;"); // Added by saurabh on 11th may $this->qup_all_networks("adding created into groups users table", "ALTER TABLE {groups_users} ADD `created` INT( 11 ) NULL; "); if (!$this->column_exists('feed_data','publish_date')) { $this->qup("add publish_date column to feed_data", "ALTER TABLE `feed_data` ADD `publish_date` INT( 11 ) "); } $this->qup_all_networks("header_image column in groups", "ALTER TABLE {groups} ADD COLUMN header_image TEXT NULL"); $this->qup_all_networks("header_image_action column in groups", "ALTER TABLE {groups} ADD COLUMN header_image_action INT(2) NULL"); $this->qup_all_networks("display_header_image column in groups", "ALTER TABLE {groups} ADD COLUMN display_header_image varchar(40) DEFAULT 1"); // 2007-04-11 Saurabh $this->qup_all_networks("extra column in groups", "ALTER TABLE {groups} ADD COLUMN extra TEXT NULL"); // 2007-01-26 Phil - adding lots of indices // First, indices that don't require any extra columns to be added: $this->qup("2007-01-25 indices for homepage.php queries (home only)", array( 'ALTER TABLE relations ADD KEY user_rel (user_id, relation_id)', 'ALTER TABLE users_online ADD KEY login_order (timestamp), ADD UNIQUE user_id (user_id), ADD KEY timestamp (timestamp)', 'ALTER TABLE users ADD KEY count_active (is_active)', )); $this->qup_all_networks("2007-01-26 indices for homepage.php queries (all nets)", array( 'ALTER TABLE {users_roles} ADD KEY user_id (user_id)', 'ALTER TABLE {page_settings} ADD KEY user_page (user_id, page_id)', 'ALTER TABLE {contents} ADD KEY homepage_content (is_active, display_on, collection_id, created), ADD KEY homepage_typed_content (is_active, display_on, collection_id, type, created), ADD KEY user_content (is_active, collection_id, author_id, created), ADD KEY user_typed_content (is_active, collection_id, author_id, type, created)', )); // 2007-01-29 Phil - more scaling // Copying created column from users to networks_users to remove a join $this->qup("2007-01-29 add created to networks_users; copy from users table", array( "ALTER TABLE networks_users ADD COLUMN created INT NOT NULL, ADD KEY recent_users (network_id, created)", "UPDATE networks_users NU LEFT JOIN users U ON NU.user_id=U.user_id SET NU.created=U.created", )); $this->qup("2007-01-30 add (network_id,user_id) key to networks_users", "ALTER TABLE networks_users ADD KEY network_user_id (network_id, user_id)"); $this->qup("2007-01-30 add (network_id,user_type) key to networks_users", "ALTER TABLE networks_users ADD KEY network_user_type (network_id, user_type)"); $this->qup("2007-01-30 copy member count and owner id into networks table from networks_users", array( "ALTER TABLE networks ADD COLUMN member_count INT NOT NULL, ADD COLUMN owner_id INT NOT NULL", "UPDATE networks N SET N.member_count=(SELECT COUNT(NU.user_id) FROM networks_users NU where NU.network_id=N.network_id)", "UPDATE networks N SET N.owner_id=(SELECT NU.user_id FROM networks_users NU where NU.network_id=N.network_id AND NU.user_type='owner') WHERE N.member_count > 0", "UPDATE networks set owner_id = ".SUPER_USER_ID." WHERE network_id = ".MOTHER_NETWORK_TYPE )); //update network query added on 26-10-2007 to set the owner_id as SUPER_USER_ID for mother network. $this->qup("2007-01-30 add indices on count, name and created to networks table", "ALTER TABLE networks ADD KEY network_member_counts (is_active, type, member_count), ADD KEY network_name_alpha (is_active, type, name), ADD KEY network_created (is_active, type, created)"); $this->qup("2007-01-30 add address index on networks", "ALTER TABLE networks ADD KEY network_address (address, is_active)"); $this->qup_all_networks("2007-01-30 add (user_id, group_id) index on groups", "ALTER TABLE {groups_users} ADD KEY users_groups (user_id, group_id)"); // 2007-02-13 Phil - line break conversion option for content, now that we have an html editor for blog posts $this->qup_all_networks("2007-02-13 add contents.is_html", array( "ALTER TABLE {contents} ADD COLUMN is_html BOOLEAN DEFAULT 1", "UPDATE {contents} SET is_html=0 WHERE type < 7", )); // 2007-02-13 Phil - updated persona table defs $this->qup("remove old persona tables and add new ones", array( "DROP TABLE IF EXISTS {personas}, {persona_properties}, {persona_services}, {persona_service_paths}", "CREATE TABLE {personas} ( `persona_id` int(10) unsigned NOT NULL auto_increment, `user_id` int(10) unsigned NOT NULL default '0', `persona_service_id` int(10) unsigned NOT NULL default '0', `sequence` int(10) unsigned NOT NULL default '0', `name` varchar(255) NOT NULL default '', `configuration` text NOT NULL, PRIMARY KEY (`persona_id`) ) DEFAULT CHARSET=UTF8", "CREATE TABLE {persona_properties} ( `persona_property_id` int(10) unsigned NOT NULL auto_increment, `parent_id` int(10) unsigned NOT NULL default '0', `persona_id` int(10) unsigned NOT NULL default '0', `name` varchar(255) NOT NULL default '', `content` text NOT NULL, `content_type` varchar(255) NOT NULL default '', `content_hash` varchar(255) NOT NULL default '', `serial_number` int(10) unsigned NOT NULL default '0', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', `category` varchar(255) NOT NULL default '', `viewer` varchar(255) NOT NULL default '', PRIMARY KEY (`persona_property_id`), KEY `key_index` USING BTREE (`name`) ) DEFAULT CHARSET=UTF8", "CREATE TABLE {persona_services} ( `persona_service_id` int(10) unsigned NOT NULL auto_increment, `sequence` int(10) unsigned NOT NULL default '0', `name` varchar(255) NOT NULL default '', `symbol` varchar(255) NOT NULL default '', `description` text NOT NULL, `category` varchar(255) NOT NULL default '', `logo` varchar(255) NOT NULL default '', `configuration` text NOT NULL, `enabled` tinyint(1) NOT NULL default '0', PRIMARY KEY (`persona_service_id`) ) DEFAULT CHARSET=UTF8", "INSERT INTO {persona_services} VALUES (1,1,'MySpace','MySpace','This is the MySpace service.','default','','{\"category\": \"default\", \"name\": \"MySpace\", \"sequence\": 1, \"enabled\": 1, \"persona_service_id\": 1, \"logo\": \"\"}',1), (2,2,'Facebook','Facebook','This is the Facebook service.','default','','{\"category\": \"default\", \"name\": \"Facebook\", \"sequence\": 2, \"enabled\": 1, \"persona_service_id\": 2, \"logo\": \"\"}',1), (3,3,'Google','Google','This is the Google service.','default','','{\"category\": \"default\", \"name\": \"Google\", \"sequence\": 3, \"enabled\": 1, \"persona_service_id\": 3, \"logo\": \"\"}',1), (4,4,'YouTube','YouTube','This is the YouTube service.','default','','{\"category\": \"default\", \"name\": \"YouTube\", \"sequence\": 4, \"enabled\": 1, \"persona_service_id\": 4, \"logo\": \"\"}',1), (5,5,'AIM','AIM','This is the AIM service.','default','','{\"category\": \"default\", \"name\": \"AIM\", \"sequence\": 5, \"enabled\": 1, \"persona_service_id\": 5, \"logo\": \"\"}',1), (6,6,'Yahoo','Yahoo','This is the Yahoo service.','default','','{\"category\": \"default\", \"name\": \"Yahoo\", \"sequence\": 6, \"enabled\": 1, \"persona_service_id\": 6, \"logo\": \"\"}',0), (7,7,'Flickr','Flickr','This is the Flickr service.','default','','{\"category\": \"default\", \"name\": \"Flickr\", \"sequence\": 7, \"enabled\": 1, \"persona_service_id\": 7, \"logo\": \"\"}',1), (8,8,'Blip TV','BlipTV','This is the Blip TV service.','default','','{\"category\": \"default\", \"name\": \"Blip TV\", \"sequence\": 8, \"enabled\": 1, \"persona_service_id\": 8, \"logo\": \"\"}',0), (9,9,'LiveJournal','LiveJournal','This is the LiveJournal service.','default','','{\"category\": \"default\", \"name\": \"LiveJournal\", \"sequence\": 9, \"enabled\": 1, \"persona_service_id\": 9, \"logo\": \"\"}',0), (10,10,'VOX','VOX','This is the VOX service.','default','','{\"category\": \"default\", \"name\": \"VOX\", \"sequence\": 10, \"enabled\": 1, \"persona_service_id\": 10, \"logo\": \"\"}',0), (11,11,'Multiply','Multiply','This is the Multiply service.','default','','{\"category\": \"default\", \"name\": \"Multiply\", \"sequence\": 11, \"enabled\": 1, \"persona_service_id\": 11, \"logo\": \"\"}',0), (12,12,'Dabble','Dabble','This is the Dabble service.','default','','{\"category\": \"default\", \"name\": \"Dabble\", \"sequence\": 12, \"enabled\": 1, \"persona_service_id\": 12, \"logo\": \"\"}',0), (13,13,'Del.icio.us','Delicious','This is the Del.icio.us service.','default','','{\"category\": \"default\", \"name\": \"Del.icio.us\", \"sequence\": 13, \"enabled\": 1, \"persona_service_id\": 13, \"logo\": \"\"}',0), (14,14,'Amazon','Amazon','This is the Amazon service.','default','','{\"category\": \"default\", \"name\": \"Amazon\", \"sequence\": 14, \"enabled\": 1, \"persona_service_id\": 14, \"logo\": \"\"}',0), (15,15,'eBay','eBay','This is the eBay service.','default','','{\"category\": \"default\", \"name\": \"eBay\", \"sequence\": 15, \"enabled\": 1, \"persona_service_id\": 15, \"logo\": \"\"}',0), (16,16,'RSS','RSS','This is the RSS service.','default','','{\"category\": \"default\", \"name\": \"RSS\", \"sequence\": 16, \"enabled\": 1, \"persona_service_id\": 16, \"logo\": \"\"}',0), (17,17,'OPML','OPML','This is the OPML service.','default','','{\"category\": \"default\", \"name\": \"OPML\", \"sequence\": 17, \"enabled\": 1, \"persona_service_id\": 17, \"logo\": \"\"}',0), (18,18,'Blogger','Blogger','This is the Blogger service.','default','','{\"category\": \"default\", \"name\": \"Blogger\", \"sequence\": 18, \"enabled\": 1, \"persona_service_id\": 18, \"logo\": \"\"}',0), (19,19,'Meta-Weblog','MetaWeblog','This is the Meta-Weblog service.','default','','{\"category\": \"default\", \"name\": \"Meta-Weblog\", \"sequence\": 19, \"enabled\": 1, \"persona_service_id\": 19, \"logo\": \"\"}',0), (20,20,'Atom','Atom','This is the Atom service.','default','','{\"category\": \"default\", \"name\": \"Atom\", \"sequence\": 20, \"enabled\": 1, \"persona_service_id\": 20, \"logo\": \"\"}',0), (21,21,'XML','XML','This is the XML service.','default','','{\"category\": \"default\", \"name\": \"XML\", \"sequence\": 21, \"enabled\": 1, \"persona_service_id\": 21, \"logo\": \"\"}',0), (22,22,'JSON','JSON','This is the JSON service.','default','','{\"category\": \"default\", \"name\": \"JSON\", \"sequence\": 22, \"enabled\": 1, \"persona_service_id\": 22, \"logo\": \"\"}',0), (23,23,'Text','Text','This is the Text service.','default','','{\"category\": \"default\", \"name\": \"Text\", \"sequence\": 23, \"enabled\": 1, \"persona_service_id\": 23, \"logo\": \"\"}',0)", "CREATE TABLE {persona_service_paths} ( `persona_service_path_id` int(10) unsigned NOT NULL auto_increment, `persona_service_id` int(10) unsigned NOT NULL default '0', `name` varchar(255) NOT NULL default '', `title` varchar(255) NOT NULL default '', `category` varchar(255) NOT NULL default '', `configuration` text NOT NULL, `sequence` int(10) unsigned NOT NULL default '0', `enabled` tinyint(1) NOT NULL default '0', PRIMARY KEY (`persona_service_path_id`) ) DEFAULT CHARSET=UTF8", "INSERT INTO {persona_service_paths} VALUES (1,1,'MyUploadedVideos','My Uploaded Videos','video','{\"category\": \"video\", \"name\": \"MyUploadedVideos\", \"title\": \"My Uploaded Videos\", \"url\": \"http:\\/\\/www.MySpace.com\\/index.cfm?fuseaction=vids.myvideos\", \"gui\": \"button\", \"sequence\": 1, \"viewer\": \"VideoList\", \"persona_service_id\": 1, \"persona_service_path_id\": 1, \"content_type\": \"json\", \"path\": \"Video_MyUploadedVideos\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',1,1), (2,1,'MyFavoriteVideos','My Favorite Videos','video','{\"category\": \"video\", \"name\": \"MyFavoriteVideos\", \"title\": \"My Favorite Videos\", \"url\": \"http:\\/\\/www.MySpace.com\\/index.cfm?fuseaction=vids.myfavorites\", \"gui\": \"button\", \"sequence\": 2, \"viewer\": \"VideoList\", \"persona_service_id\": 1, \"persona_service_path_id\": 2, \"content_type\": \"json\", \"path\": \"Video_MyFavoriteVideos\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',2,1), (3,1,'MyFriends','My Friends','user','{\"category\": \"user\", \"name\": \"MyFriends\", \"title\": \"My Friends\", \"url\": null, \"gui\": \"button\", \"sequence\": 3, \"viewer\": \"FriendList\", \"persona_service_id\": 1, \"persona_service_path_id\": 3, \"content_type\": \"json\", \"path\": \"User_MyFriends\", \"login\": true, \"type\": \"user\", \"method\": \"FetchFriendList\"}',3,1), (4,1,'SearchVideos','Search MySpace Videos','video','{\"category\": \"video\", \"name\": \"SearchVideos\", \"sequence\": 4, \"url\": \"http:\\/\\/vidsearch.myspace.com\\/index.cfm?fuseaction=vids.fullsearch&fullSearch=Search+Video&t=\", \"gui\": \"search\", \"title\": \"Search MySpace Videos\", \"viewer\": \"VideoList\", \"persona_service_id\": 1, \"persona_service_path_id\": 4, \"content_type\": \"json\", \"path\": \"Video_Search\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',4,1), (5,1,'InboxMessages','Inbox','message','{\"category\": \"message\", \"name\": \"InboxMessages\", \"title\": \"Inbox\", \"url\": null, \"gui\": \"button\", \"sequence\": 5, \"viewer\": \"MessageList\", \"persona_service_id\": 1, \"persona_service_path_id\": 5, \"content_type\": \"json\", \"path\": \"User_Inbox\", \"login\": true, \"type\": \"user\", \"method\": \"FetchInbox\"}',5,1), (6,1,'FriendMessages','Friend Requests','message','{\"category\": \"message\", \"name\": \"FriendMessages\", \"title\": \"Friend Requests\", \"url\": null, \"gui\": \"button\", \"sequence\": 6, \"viewer\": \"MessageList\", \"persona_service_id\": 1, \"persona_service_path_id\": 6, \"content_type\": \"json\", \"path\": \"User_FriendRequests\", \"login\": true, \"type\": \"user\", \"method\": \"FetchFriendRequests\"}',6,1), (7,1,'BlogMessages','Blog Comments','message','{\"category\": \"message\", \"name\": \"BlogMessages\", \"title\": \"Blog Comments\", \"url\": null, \"gui\": \"button\", \"sequence\": 7, \"viewer\": \"MessageList\", \"persona_service_id\": 1, \"persona_service_path_id\": 7, \"content_type\": \"json\", \"path\": \"User_BlogComments\", \"login\": true, \"type\": \"user\", \"method\": \"FetchBlogComments\"}',7,1), (8,1,'PictureMessages','Picture Comments','message','{\"category\": \"message\", \"name\": \"PictureMessages\", \"title\": \"Picture Comments\", \"url\": null, \"gui\": \"button\", \"sequence\": 8, \"viewer\": \"MessageList\", \"persona_service_id\": 1, \"persona_service_path_id\": 8, \"content_type\": \"json\", \"path\": \"User_PictureComments\", \"login\": true, \"type\": \"user\", \"method\": \"FetchPictureComments\"}',8,1), (9,1,'VideoMessages','Video Comments','message','{\"category\": \"message\", \"name\": \"VideoMessages\", \"title\": \"Video Comments\", \"url\": null, \"gui\": \"button\", \"sequence\": 9, \"viewer\": \"MessageList\", \"persona_service_id\": 1, \"persona_service_path_id\": 9, \"content_type\": \"json\", \"path\": \"User_VideoComments\", \"login\": true, \"type\": \"user\", \"method\": \"FetchVideoComments\"}',9,1), (10,3,'MyLiveVideos','My Live Videos','video','{\"category\": \"video\", \"name\": \"MyLiveVideos\", \"title\": \"My Live Videos\", \"url\": \"https:\\/\\/upload.video.google.com\\/Status?f=l&hl=en\", \"gui\": \"button\", \"sequence\": 1, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 10, \"content_type\": \"json\", \"path\": \"Video_Live\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',1,1), (11,3,'Top100Videos','Top 100','video','{\"category\": \"video\", \"name\": \"Top100Videos\", \"title\": \"Top 100\", \"url\": \"http:\\/\\/video.google.com\\/videoranking\", \"gui\": \"button\", \"sequence\": 2, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 11, \"content_type\": \"json\", \"path\": \"Video_Top\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',2,1), (12,3,'ComedyVideos','Comedy','video','{\"category\": \"video\", \"name\": \"ComedyVideos\", \"title\": \"Comedy\", \"url\": \"http:\\/\\/video.google.com\\/videosearch?q=genre:comedy\", \"gui\": \"button\", \"sequence\": 3, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 12, \"content_type\": \"json\", \"path\": \"Video_Comedy\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',3,1), (13,3,'MusicVideos','Music Videos','video','{\"category\": \"video\", \"name\": \"MusicVideos\", \"title\": \"Music Videos\", \"url\": \"http:\\/\\/video.google.com\\/videosearch?q=type:music_video\", \"gui\": \"button\", \"sequence\": 4, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 13, \"content_type\": \"json\", \"path\": \"Video_Music\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',4,1), (14,3,'MovieVidoes','Movies','video','{\"category\": \"video\", \"name\": \"MovieVidoes\", \"title\": \"Movies\", \"url\": \"http:\\/\\/video.google.com\\/movietrailers.html\", \"gui\": \"button\", \"sequence\": 5, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 14, \"content_type\": \"json\", \"path\": \"Video_Movies\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',5,1), (15,3,'SportsVideos','Sports','video','{\"category\": \"video\", \"name\": \"SportsVideos\", \"title\": \"Sports\", \"url\": \"http:\\/\\/video.google.com\\/videosearch?q=type%3Asports%20OR%20genre%3Asports\", \"gui\": \"button\", \"sequence\": 6, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 15, \"content_type\": \"json\", \"path\": \"Video_Sports\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',6,1), (16,3,'AnimationVideos','Animation','video','{\"category\": \"video\", \"name\": \"AnimationVideos\", \"title\": \"Animation\", \"url\": \"http:\\/\\/video.google.com\\/videosearch?q=genre:animation\", \"gui\": \"button\", \"sequence\": 7, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 16, \"content_type\": \"json\", \"path\": \"Video_Animation\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',7,1), (17,3,'TVVideos','TV Shows','video','{\"category\": \"video\", \"name\": \"TVVideos\", \"title\": \"TV Shows\", \"url\": \"http:\\/\\/video.google.com\\/videosearch?q=type%3Atvshow\", \"gui\": \"button\", \"sequence\": 8, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 17, \"content_type\": \"json\", \"path\": \"Video_TV\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',8,1), (18,3,'PicksVideos','Google Picks','video','{\"category\": \"video\", \"name\": \"PicksVideos\", \"title\": \"Google Picks\", \"url\": \"http:\\/\\/video.google.com\\/videosearch?q=type%3Agpick&so=1\", \"gui\": \"button\", \"sequence\": 9, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 18, \"content_type\": \"json\", \"path\": \"Video_Picks\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',9,1), (19,3,'SearchVideos','Search Google Videos','video','{\"category\": \"video\", \"name\": \"SearchVideos\", \"title\": \"Search Google Videos\", \"url\": \"http:\\/\\/video.google.com\\/videosearch?q=\", \"gui\": \"search\", \"sequence\": 10, \"viewer\": \"VideoList\", \"persona_service_id\": 3, \"persona_service_path_id\": 19, \"content_type\": \"json\", \"path\": \"Video_Search\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',10,1), (20,4,'MyVideos','My Videos','video','{\"category\": \"video\", \"name\": \"MyVideos\", \"title\": \"My Videos\", \"url\": \"http:\\/\\/www.youtube.com\\/my_videos\", \"gui\": \"button\", \"sequence\": 1, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 20, \"content_type\": \"json\", \"path\": \"Video_MyVideos\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',1,1), (21,4,'FavoriteVideos','My Favorites','video','{\"category\": \"video\", \"name\": \"FavoriteVideos\", \"title\": \"My Favorites\", \"url\": \"http:\\/\\/www.youtube.com\\/my_favorites\", \"gui\": \"button\", \"sequence\": 2, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 21, \"content_type\": \"json\", \"path\": \"Video_Favorites\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',2,1), (22,4,'SubscriptionVideos','My Subscriptions','video','{\"category\": \"video\", \"name\": \"SubscriptionVideos\", \"title\": \"My Subscriptions\", \"url\": \"http:\\/\\/www.youtube.com\\/subscription_center\", \"gui\": \"button\", \"sequence\": 3, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 22, \"content_type\": \"json\", \"path\": \"Video_Subscriptions\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',3,1), (23,4,'MostRecentVideos','Most Recent','video','{\"category\": \"video\", \"name\": \"MostRecentVideos\", \"title\": \"Most Recent\", \"url\": \"http:\\/\\/www.youtube.com\\/browse?s=mr\", \"gui\": \"button\", \"sequence\": 4, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 23, \"content_type\": \"json\", \"path\": \"Video_MostRecent\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',4,1), (24,4,'MostViewedVideos','Most Viewed','video','{\"category\": \"video\", \"name\": \"MostViewedVideos\", \"title\": \"Most Viewed\", \"url\": \"http:\\/\\/www.youtube.com\\/browse?s=mp\", \"gui\": \"button\", \"sequence\": 5, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 24, \"content_type\": \"json\", \"path\": \"Video_MostViewed\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',5,1), (25,4,'TopRatedVideos','Top Rated','video','{\"category\": \"video\", \"name\": \"TopRatedVideos\", \"title\": \"Top Rated\", \"url\": \"http:\\/\\/www.youtube.com\\/browse?s=tr\", \"gui\": \"button\", \"sequence\": 6, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 25, \"content_type\": \"json\", \"path\": \"Video_TopRated\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',6,1), (26,4,'MostDiscussedVideos','Most Discussed','video','{\"category\": \"video\", \"name\": \"MostDiscussedVideos\", \"title\": \"Most Discussed\", \"url\": \"http:\\/\\/www.youtube.com\\/browse?s=md\", \"gui\": \"button\", \"sequence\": 7, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 26, \"content_type\": \"json\", \"path\": \"Video_MostDiscussed\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',7,1), (27,4,'TopFavoriteVideos','Top Favorites','video','{\"category\": \"video\", \"name\": \"TopFavoriteVideos\", \"title\": \"Top Favorites\", \"url\": \"http:\\/\\/www.youtube.com\\/browse?s=mf\", \"gui\": \"button\", \"sequence\": 8, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 27, \"content_type\": \"json\", \"path\": \"Video_TopFavorites\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',8,1), (28,4,'MostLinkedVideos','Most Linked','video','{\"category\": \"video\", \"name\": \"MostLinkedVideos\", \"title\": \"Most Linked\", \"url\": \"http:\\/\\/www.youtube.com\\/browse?s=mrd\", \"gui\": \"button\", \"sequence\": 9, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 28, \"content_type\": \"json\", \"path\": \"Video_MostLinked\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',9,1), (29,4,'RecentlyFeaturedVideos','Recently Featured','video','{\"category\": \"video\", \"name\": \"RecentlyFeaturedVideos\", \"title\": \"Recently Featured\", \"url\": \"http:\\/\\/www.youtube.com\\/browse?s=rf\", \"gui\": \"button\", \"sequence\": 10, \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 29, \"content_type\": \"json\", \"path\": \"Video_RecentlyFeatured\", \"login\": false, \"type\": \"video\", \"method\": \"FetchVideoList\"}',10,1), (30,4,'SearchVideos','Search YouTube Videos','video','{\"category\": \"video\", \"name\": \"SearchVideos\", \"sequence\": 11, \"url\": \"http:\\/\\/www.youtube.com\\/results?search=Search&search_query=\", \"gui\": \"search\", \"title\": \"Search YouTube Videos\", \"viewer\": \"VideoList\", \"persona_service_id\": 4, \"persona_service_path_id\": 30, \"content_type\": \"json\", \"path\": \"Video_Search\", \"login\": true, \"type\": \"video\", \"method\": \"FetchVideoList\"}',11,1), (31,2,'Profile','My Profile','user','{\"category\": \"user\", \"name\": \"Profile\", \"sequence\": 1, \"url\": \"\", \"gui\": \"button\", \"title\": \"My Profile\", \"viewer\": \"Profile\", \"persona_service_id\": 2, \"persona_service_path_id\": 31, \"content_type\": \"json\", \"path\": \"User_Profile\", \"login\": true, \"type\": \"profile\", \"method\": \"FetchUserProfile\"}',1,1), (32,2,'Friends','My Friends','friends','{\"category\": \"user\", \"name\": \"Friends\", \"sequence\": 2, \"url\": \"\", \"gui\": \"button\", \"title\": \"My Friends\", \"viewer\": \"Friends\", \"persona_service_id\": 2, \"persona_service_path_id\": 32, \"content_type\": \"json\", \"path\": \"User_Friends\", \"login\": true, \"type\": \"friends\", \"method\": \"FetchFriends\"}',2,1), (33,2,'Messages','My Messages','messages','{\"category\": \"messages\", \"name\": \"Messages\", \"sequence\": 3, \"url\": \"\", \"gui\": \"button\", \"title\": \"My Messages\", \"viewer\": \"Messages\", \"persona_service_id\": 2, \"persona_service_path_id\": 33, \"content_type\": \"json\", \"path\": \"User_Messages\", \"login\": true, \"type\": \"messages\", \"method\": \"FetchMessages\"}',3,1)", )); $this->qup_all_networks("recent_media_track table added to handle recent media on homepage", "CREATE TABLE {recent_media_track} (`id` INT( 11 ) NOT NULL AUTO_INCREMENT , `cid` INT( 11 ) , `type` INT( 1 ) , `created` INT( 11 ) , PRIMARY KEY ( `id` ) )"); $this->qup("adding Flickr Friends to persona_service_paths", "INSERT INTO {persona_service_paths} VALUES (36,7,'Friends','My Friends','friends','{\"category\": \"user\", \"name\": \"Friends\", \"sequence\": 2, \"url\": \"\", \"gui\": \"button\", \"title\": \"My Friends\", \"viewer\": \"Friends\", \"persona_service_id\": 7, \"persona_service_path_id\": 36, \"content_type\": \"json\", \"path\": \"User_Friends\", \"login\": true, \"type\": \"friends\", \"method\": \"FetchFriends\"}',3,1)" ); //2007-02-17, david disabling services that aren't complete $this->qup("disabling incomplete Flickr for pre1 release", "UPDATE persona_services SET enabled = 0 WHERE name = 'Flickr'"); $this->qup("disabling MySpace features not now supported in scraper, e.g. reflecting MySpace site changes", "UPDATE persona_service_paths SET enabled = 0 WHERE persona_service_id = 1"); //2007-02-17, david enabling updated MySpace My Friends $this->qup("enable newly re-supported MySpace My Friends feature", "UPDATE persona_service_paths SET enabled = 1 WHERE persona_service_path_id = 3"); // 2007-02-20 Phil - create cache for things like recently fetched delicious and flickr data. // This sort of thing could go in the profile space, as with everything from the scraper, but // for the moment let's just throw it in here. $this->qup("create ext_cache table 2", "CREATE TABLE ext_cache ( id VARCHAR(255) NOT NULL, PRIMARY KEY (id), created DATETIME NOT NULL, KEY (created), user_id INT NOT NULL, KEY (user_id, id, created), data TEXT NOT NULL)"); // 2007-02-22 Phil - moved from Ekta's web/refine_group_access.php $this->qup_all_networks("get rid of group moderation", array( // remove access type and is_moderated entry from existing groups "UPDATE {groups} SET access_type = 0, is_moderated = 0", // to remove contents, waiting for moderation create_function("", ' $res = Dal::query("SELECT content_id FROM {contents} WHERE is_active = 2"); global $network_prefix; while($row = Dal::row_object($res)) { Content::delete_by_id($row->content_id); } '))); // 2007-02-22, martin re enabling Flickr $this->qup("re enabling Flickr Service", "UPDATE persona_services SET enabled = 1 WHERE name = 'Flickr'"); // 2007-02-26 Phil - speeding things up // queries seen on badge_create.php $this->qup("2007-02-26 optimization", array( // replace (user_id) key with (user_id, field_type, field_name) "ALTER TABLE {user_profile_data} DROP KEY user_id, ADD KEY profile_fields (user_id, field_type(32), field_name(32))", // Phil: modified 2007-05-30 to avoid crash on UTF-8 MySQL // remove duplicate (user_id) key on relations "ALTER TABLE {relations} DROP KEY user_id", // message folder lookup "ALTER TABLE {message_folder} ADD KEY name_to_fid (uid, name)", // fid index on user_message_folder "ALTER TABLE {user_message_folder} ADD KEY fid (fid)", )); // 2007-02-27 Phil - speeding up ContentCommentsTest $this->qup_all_networks("2007-02-27 content and comments", array( // fetch all comments for a content item "ALTER TABLE {comments} ADD KEY comments_for_content (is_active, content_id, created)", // fetch all trackbacks for a content item "ALTER TABLE {trackback_contents} ADD KEY trackbacks_for_content (content_id)", // fetch tags for a content item, or content tagged with a tag "ALTER TABLE {tags_contents} ADD KEY tag_to_content (tag_id, content_id), ADD KEY content_to_tags (content_id, tag_id)", )); //2007-03-09, david enabling updated Flickr My Pictures and My Profile /* NOTE: this couldn't work, as those entries were never in the DB to begin with * adding them below (Martin) $this->qup("enable Flickr My Friends and User Profile features", "UPDATE persona_service_paths SET enabled = 1 WHERE persona_service_path_id = 35 OR persona_service_path_id = 34"); */ $this->qup("2007-03-12 Martin: adding Flickr Profile and Photos", "INSERT INTO {persona_service_paths} VALUES (34,7,'UserProfile','My Profile','user','{\"category\": \"user\", \"name\": \"MyProfile\", \"sequence\": 1, \"url\": \"\", \"gui\": \"button\", \"title\": \"My Profile\", \"viewer\": \"Profile\", \"persona_service_id\": 2, \"persona_service_path_id\": 34, \"content_type\": \"json\", \"path\": \"User_Profile\", \"login\": true, \"type\": \"profile\", \"method\": \"FetchUserProfile\"}',1,1), (35,7,'MyPictures','My Pictures','pictures','{\"category\": \"pictures\", \"name\": \"MyPictures\", \"sequence\": 1, \"url\": \"\", \"gui\": \"button\", \"title\": \"My Pictures\", \"viewer\": \"Pictures\", \"persona_service_id\": 2, \"persona_service_path_id\": 35, \"content_type\": \"json\", \"path\": \"MyPictures\", \"login\": true, \"type\": \"pictures\", \"method\": \"FetchUserPictures\"}',2,1)"); $this->qup("replace profile_fields key with profile_fields_seq", "ALTER TABLE {user_profile_data} DROP KEY profile_fields, ADD KEY profile_fields_seq (user_id, field_type(32), field_name(32), seq)"); // Phil: modified 2007-05-30 to avoid crash on UTF-8 MySQL $this->qup("add expires column to ext_cache table", array( "TRUNCATE TABLE {ext_cache}", "ALTER TABLE {ext_cache} ADD COLUMN expires DATETIME NOT NULL, DROP KEY created, DROP KEY user_id, ADD KEY item (user_id, id, expires)", )); // so we can completely index comment content in spam_terms $this->qup("add blacklist+frequency columns to spam_terms table", "ALTER TABLE {spam_terms} ADD COLUMN frequency INT NOT NULL DEFAULT 0, ADD KEY by_word (term), ADD KEY by_freq (blacklist, frequency, term), ADD COLUMN blacklist BOOLEAN DEFAULT 1, ADD KEY bad_words (blacklist, term)"); // {{{ 2007-03-19 Marek + Phil - Adding indexes all over the place $this->qup("2007-03-19 database optimization - global tables", array( // default_announcements no longer used "ALTER TABLE {default_announcements} ADD INDEX content_id ( `content_id` ), ADD INDEX is_active ( `is_active` )", "ALTER TABLE {external_feed} ADD INDEX is_active ( `is_active` )", "ALTER TABLE {feed_data} ADD INDEX feed_content ( `feed_id`, `publish_date` )", "ALTER TABLE {forgot_password} ADD PRIMARY KEY (forgot_password_id), ADD INDEX user_status_id ( `user_id` , `status` , `forgot_password_id` )", "ALTER TABLE {linkcategories} ADD INDEX user_categories ( `user_id` , `is_active` , `created`)", "ALTER TABLE {links} ADD INDEX cat_active_created ( `category_id`, `is_active`, `created` )", "ALTER TABLE {moduledata} ADD INDEX created ( `created` )", "ALTER TABLE {networks_users} DROP KEY network_user_id, ADD INDEX network_user_id_type ( `network_id`, `user_id`, `user_type` )", "ALTER TABLE {persona_properties} ADD INDEX parent_id ( `parent_id` ), ADD INDEX persona_id ( `persona_id` )", "ALTER TABLE {persona_service_paths} ADD INDEX persona_service_id ( `persona_service_id` )", "ALTER TABLE {personas} ADD INDEX persona_service_id ( `persona_service_id` ), ADD INDEX user_id ( `user_id` )", "ALTER TABLE {private_messages} ADD INDEX sender_when ( `sender_id`, `sent_time` )", "ALTER TABLE {relation_classifications} ADD INDEX relation_type_id ( `relation_type_id` ), ADD INDEX relation_type ( `relation_type` )", "ALTER TABLE {relations} ADD INDEX network_uid ( `network_uid` )", "ALTER TABLE {roles} ADD PRIMARY KEY ( `role_id` )", "ALTER TABLE {spam_terms} ADD INDEX term ( `term` )", "ALTER TABLE {svn_meta} ADD INDEX revision ( `revision` )", "ALTER TABLE {tags_networks} ADD INDEX `network_to_tag` ( `network_id`, `tag_id` ), ADD INDEX `tag_to_network` ( `tag_id`, `network_id` )", "ALTER TABLE {tags_users} ADD INDEX `tag_to_user` ( `tag_id`, `user_id` ), ADD INDEX `user_to_tag` ( `user_id`, `tag_id` )", "ALTER TABLE {user_feed} ADD INDEX `feed_to_user` ( `feed_id`, `user_id` ), ADD INDEX `user_to_feed` ( `user_id`, `feed_id` )", "ALTER TABLE {user_message_folder} ADD INDEX mid ( `mid` )", "ALTER TABLE {user_profile_data} ADD INDEX user_id ( `user_id` )", "ALTER TABLE {users} ADD INDEX email ( `email` )", )); $this->qup_all_networks("2007-03-19 database optimization", array( "ALTER TABLE {audios} ADD PRIMARY KEY ( `content_id` )", "ALTER TABLE {boardmessages} ADD INDEX parent_id ( `parent_id` ), ADD INDEX parent_type ( `parent_type` ), ADD INDEX user_id ( `user_id` )", "ALTER TABLE {categories_boardmessages} ADD INDEX `boardmessage_to_category` ( `boardmessage_id` , `category_id` ), ADD INDEX `category_to_boardmessage` ( `category_id`, `boardmessage_id` )", "ALTER TABLE {categories} ADD INDEX active_position ( `is_active`, `position` )", "ALTER TABLE {comments} ADD INDEX comments_by_user ( `is_active`, `user_id`, `created` )", "ALTER TABLE {content_routing_destinations} ADD INDEX user_id ( `user_id` )", "ALTER TABLE {content_types} ADD INDEX name ( `name` )", "ALTER TABLE {contentcollections_albumtype} ADD INDEX `album_type_to_contentcollection` ( `album_type_id`, `contentcollection_id` ), ADD INDEX `contentcollections_to_album_type` ( `contentcollection_id`, `album_type_id` )", "ALTER TABLE {contentcollections} ADD INDEX is_active ( `is_active` )", "ALTER TABLE {contents_sbmicrocontents} ADD INDEX `content_to_microcontent` ( `content_id`, `microcontent_id` ), ADD INDEX `microcontent_to_content` ( `microcontent_id`, `content_id` )", "ALTER TABLE {groups} ADD INDEX category_id ( `category_id` )", "ALTER TABLE {images} ADD PRIMARY KEY ( `content_id` )", "ALTER TABLE {invitations} ADD INDEX inv_collection_id ( `inv_collection_id` ), ADD INDEX inv_status ( `inv_status` ), ADD INDEX user_id ( `user_id` )", "ALTER TABLE {moderation_queue} ADD INDEX collection_id ( `collection_id` )", // modules_settings not used any more? "ALTER TABLE {modules_settings} ADD INDEX is_active ( `is_active` ), ADD INDEX module_id ( `module_id` )", "ALTER TABLE {network_linkcategories} ADD INDEX user_cat ( `user_id`, `category_name`, `category_id` ), ADD INDEX user_active ( `user_id` , `is_active` )", "ALTER TABLE {network_links} ADD INDEX cat_title ( `category_id`, `title` ), ADD INDEX is_active ( `is_active` )", "ALTER TABLE {recent_media_track} ADD INDEX cid ( `cid` )", "ALTER TABLE {tags_contentcollections} ADD INDEX `contentcollection_to_tag` ( `collection_id`, `tag_id` ), ADD INDEX `tag_to_contentcollection` ( `tag_id`, `collection_id` )", "ALTER TABLE {users_roles} ADD INDEX `role_to_user` ( `role_id`, `user_id` ), ADD INDEX `user_to_role` ( `user_id`, `role_id` )", "ALTER TABLE {videos} ADD PRIMARY KEY ( `content_id` )", )); // }}} $this->qup("2007-03-31 Martin adding event table for class Event", "CREATE TABLE `events` ( eid INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (eid), cid TEXT NOT NULL, uid INT NOT NULL, KEY (uid), title TEXT NOT NULL, start_time DATETIME NOT NULL, KEY (start_time), end_time DATETIME NOT NULL, KEY (end_time), event_data TEXT NULL, KEY delta (start_time, end_time) ) DEFAULT CHARSET=UTF8"); $this->qup("2007-04-02 Martin renaming fields to be inline with PA naming conventions", "ALTER TABLE `events` CHANGE eid event_id INT( 11 ) NOT NULL AUTO_INCREMENT, CHANGE cid content_id TEXT NOT NULL, CHANGE uid user_id INT( 11 ) NOT NULL, CHANGE title event_title TEXT NOT NULL"); $this->qup("2007-04-03 Martin adding event_assosciations table for class EventAssociations", "CREATE TABLE `events_associations` ( assoc_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (assoc_id), event_id INT NOT NULL, KEY (event_id), user_id INT NOT NULL, KEY (user_id), assoc_target_type VARCHAR(30) NOT NULL, KEY (assoc_target_type), assoc_target_id INT NOT NULL, KEY (assoc_target_id), assoc_target_name TEXT NOT NULL, event_title TEXT NOT NULL, start_time DATETIME NOT NULL, KEY (start_time), end_time DATETIME NOT NULL, KEY (end_time), event_data TEXT NULL, KEY target (assoc_target_type, assoc_target_id) ) DEFAULT CHARSET=UTF8"); $this->qup("2007-04-07 Martin correcting name for assoc_data", "ALTER TABLE `events_associations` CHANGE event_data assoc_data TEXT NULL"); $this->qup("2007-04-23 Arvind added a table for admin_roles", "CREATE TABLE `admin_roles` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `name` VARCHAR( 100 ) , `description` TINYTEXT, `created` INT( 11 ) , `changed` INT( 11 ) , PRIMARY KEY ( `id` ) ) TYPE = MYISAM "); $this->qup("2007-04-17 Phil fixing ext_cache", "ALTER TABLE ext_cache DROP PRIMARY KEY, CHANGE COLUMN id cache_key VARCHAR(255) NOT NULL"); $this->qup("2007-04-23 Arvind added a table for tasks_roles", "CREATE TABLE `tasks_roles` ( `task_id` INT( 11 ) NOT NULL , `role_id` INT( 11 ) NOT NULL ) TYPE = MYISAM "); $this->qup("2007-04-23 Arvind added a table for tasks", "CREATE TABLE `tasks` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `name` VARCHAR( 255 ) NOT NULL, `description` TINYTEXT, PRIMARY KEY (`id`) ) TYPE = MYISAM "); //adding a column task_value. We will put the checks according to this value //as it is more readable $this->qup("2007-05-02 Arvind altered table for tasks to have task_value", " ALTER TABLE `tasks` ADD `task_value` VARCHAR( 255 ) NOT NULL ;"); $this->qup("2007-04-26 Arvind added a task - Manage settings in tasks", " INSERT INTO `tasks` (id, name, description) VALUES (1, 'Manage Settings', 'Manage settings of your network.'); "); $this->qup("2007-04-26 Arvind added a task - meta network in tasks", "INSERT INTO `tasks` (id, name, description) VALUES (2, 'Meta network', 'Manage meta network controls here.'); "); $this->qup("2007-04-26 Arvind added a task - manage ads in tasks", "INSERT INTO `tasks` (id, name, description) VALUES (3, 'Manage Ads', 'Manage Ads which will appear on the pages of networks.'); "); $this->qup("2007-04-26 Arvind added a task - notifications in tasks", "INSERT INTO `tasks` (id, name, description) VALUES (4, 'Notifications', 'Email and personal message box notifications.'); "); $this->qup("2007-04-26 Arvind added a task - links of network in tasks", "INSERT INTO `tasks` (id, name, description) VALUES (5, 'Manage Links', 'Manage the links of the network the user will get at the time of registration.');"); $this->qup("2007-04-26 Arvind added a task - manage content in tasks", "INSERT INTO `tasks` (id, name, description) VALUES (6, 'Manage content', 'Manage you content, comments, forums.');"); $this->qup("2007-04-26 Arvind added a task - default settings in task", "INSERT INTO `tasks` (id, name, description) VALUES (7, 'User defaults', 'Manage the default settings that user wil get.'); "); $this->qup("2007-04-26 Arvind added a task - manage themes", "INSERT INTO `tasks` (id, name, description) VALUES (8, 'Themes', 'Manage themes and customize them.');"); //updating the table entries to contain the task values $tasks = array(1=>'manage_settings', 2=>'meta_networks', 3=>'manage_ads',4=>'notifications', 5=>'manage_links', 6=>'manage_content', 7=>'user_defaults', 8=>'manage_themes'); foreach($tasks as $key=>$val){ $this->qup("2007-05-02 Arvind updated the row of task table having id = $key", "UPDATE tasks SET task_value = '$val' WHERE id = $key"); } // db entry for configurable email : Ekta 30/07/2007 $this->qup_all_networks("create email_messages table email_messages", "CREATE TABLE IF NOT EXISTS {email_messages} ( id INT( 11 ) NOT NULL , type VARCHAR( 255 ) NOT NULL , description VARCHAR( 255 ) NOT NULL , subject VARCHAR( 255 ) NOT NULL , message TEXT NOT NULL , configurable_variables TEXT NOT NULL , PRIMARY KEY ( id , type ) )"); global $email_messages, $path_prefix; $this->qup_all_networks("2007-08-07 truncate the rows of email_messages having", "TRUNCATE TABLE {email_messages}"); foreach ($email_messages as $type_id=>$data) { $type = $data['type'];// need to insert description $description = mysql_escape_string($data['description']); $subject = mysql_escape_string($data['subject']); $message_file = $data['message']; $EmailMessageFile = "$path_prefix/web/includes/email_msg_text/$message_file"; $fh = fopen($EmailMessageFile, 'r'); if (filesize($EmailMessageFile)) { $theData = fread($fh, filesize($EmailMessageFile)); $theData = mysql_escape_string($theData); fclose($fh); } $configurable_data = mysql_escape_string(serialize($data['configurable_variables'])); $this->qup_all_networks("2007-07-30 Ekta Inserted the rows of email_messages having type = $type", "INSERT INTO {email_messages} (id, type, description, subject, message, configurable_variables) VALUES ($type_id, '$type', '$description', '$subject', '$theData', '$configurable_data')"); } $this->qup("2007-04-23 Arvind added a table for users_adminroles", "CREATE TABLE `users_adminroles` ( `user_id` INT( 11 ) NOT NULL , `role_id` INT( 11 ) NOT NULL ) TYPE = MYISAM "); //Fixed a bug in ad center for all the networks $this->qup_all_networks("2007-06-21 Arvind altered table for advertisements on all networks", "ALTER TABLE {advertisements} CHANGE `orientation` `orientation` VARCHAR( 255 ) NULL DEFAULT NULL "); if (!$this->table_exists('site_ranking_parameters')) { $this->qup("site_ranking_parameters table", "CREATE TABLE `site_ranking_parameters` ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL, `description` text NOT NULL, `point` int(11) NOT NULL, PRIMARY KEY (`id`) ) "); } if ($this->table_exists('site_ranking_parameters')) { $this->qup("insert default data for site_ranking_parameters1", "INSERT INTO `site_ranking_parameters` (`id`, `name`, `description`, `point`) VALUES (1, 'Uploading a Picture', 'Points will be give to user who has uploaded his picture. ', 1)"); $this->qup("insert default data for site_ranking_parameters2", "INSERT INTO `site_ranking_parameters` (`id`, `name`, `description`, `point`) VALUES (2, 'Profile Views', 'Whenever user provile is viewed by anyone he get points.', 1)"); $this->qup("insert default data for site_ranking_parameters3", "INSERT INTO `site_ranking_parameters` (`id`, `name`, `description`, `point`) VALUES (3, 'Number of friends in buddy list', 'More number of friends a user have, more points he get.', 1)"); $this->qup("insert default data for site_ranking_parameters4", "INSERT INTO `site_ranking_parameters` (`id`, `name`, `description`, `point`) VALUES (4, 'Albums Uploaded', 'More images a user upload, more points he get.', 1)"); $this->qup("insert default data for site_ranking_parameters5", "INSERT INTO `site_ranking_parameters` (`id`, `name`, `description`, `point`) VALUES (5, 'Number of group created by user', 'More group a user create, more points he get.', 1)"); $this->qup("insert default data for site_ranking_parameters6", "INSERT INTO `site_ranking_parameters` (`id`, `name`, `description`, `point`) VALUES (6, 'Number of hour spent by user on the site', 'More time a user spent on the site, more points he get.', 1)"); } if (!$this->table_exists('config_variables')) { $this->qup("config_variables table", "CREATE TABLE `config_variables` ( `variable` varchar(100) NOT NULL, `value` tinytext NOT NULL, PRIMARY KEY (`variable`) ) "); } // adding manage_events $this->qup("2007-05-27 Martin added a task - manage events", "INSERT INTO `tasks` (task_value, name, description) VALUES ('manage_events', 'Events', 'Create events and manage them.');"); // 2007-05-30 Phil: preparing for utf-8 $this->qup("2007-05-30 Phil utf-8 preparation", array( // Key 'user_id' reappeared accidentally in the 2007-03-19 // change, and key 'profile_fields_seq' needs shortening to work // with UTF-8. "ALTER TABLE user_profile_data DROP KEY user_id, DROP KEY profile_fields_seq, ADD KEY profile_fields_seq (user_id, field_type(32), field_name(32), seq)", )); // 2007-06-12 Phil: last minute bugfix for 1.2pre5: clear out old custom settings so all users get new modules and the external feed selector $this->qup_all_networks("2007-06-12 blow away page_settings", "DELETE FROM {page_settings}"); // 2007-06-15 Phil: proper persistent logins $this->qup("2007-06-15 login_cookies table 2", "CREATE TABLE login_cookies ( user_id INT NOT NULL, series VARCHAR(32) NOT NULL, token VARCHAR(32) NOT NULL, PRIMARY KEY(user_id, series), expires DATETIME NOT NULL, KEY expires (expires), user_agent VARCHAR(255) NOT NULL, ip_addr VARCHAR(16) NOT NULL )"); // 2007-07-04 Gurpreet: is_configurable field to page_default_settings $this->qup_all_networks("adding is_configurable field to page_default_settings", "ALTER TABLE {page_default_settings} ADD `is_configurable` BINARY( 1 ) DEFAULT '0' "); // 2007-07-10 Arvind: long network names $this->qup("2007-07-10 Altering network table for long title and subtitle", "ALTER TABLE `networks` CHANGE `name` `name` VARCHAR( 255 ) DEFAULT NULL"); // 2007-07-04 Ekta - creating table footer_links // This table will be used for managing footer links at PA $this->qup_all_networks("creating table footer_links", "CREATE TABLE IF NOT EXISTS {footer_links} ( `id` int(11) NOT NULL auto_increment, `caption` varchar(255) default NULL, `url` varchar(255) default NULL, `is_active` tinyint(1) default NULL, `extra` text, PRIMARY KEY (`id`) ) "); // This table will be used for managing static pages at PA $this->qup_all_networks("create static_pages table", "CREATE TABLE IF NOT EXISTS {static_pages} (`id` int(11) NOT NULL auto_increment, `caption` varchar(255), `url` varchar(255), `page_text` text, PRIMARY KEY (`id`) )"); $this->qup("create files table", "CREATE TABLE files ( file_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(file_id), filename VARCHAR(255) NOT NULL, file_class VARCHAR(32) NOT NULL, mime_type VARCHAR(255) NOT NULL, incomplete BOOL NOT NULL DEFAULT 1, KEY(incomplete), created DATETIME NOT NULL, link_count INT NOT NULL DEFAULT 0, KEY(link_count), storage_backend VARCHAR(32), local_id VARCHAR(255) )"); $this->qup("modify files and add file_links table", array( "ALTER TABLE files ADD COLUMN last_linked DATETIME, ADD COLUMN last_unlinked DATETIME", "CREATE TABLE file_links ( link_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(link_id), file_id INT NOT NULL, KEY(file_id), role VARCHAR(32) NOT NULL, user_id INT, network_id INT, group_id INT, ad_id INT, content_id INT, parent_file_id INT, dim VARCHAR(32), KEY thumbnail_lookup (role, parent_file_id, dim), KEY user_files (user_id, role) )", )); $this->qup("add index for cleanupFiles reaping query", "ALTER TABLE files DROP KEY link_count, ADD KEY cleanup_search (link_count, last_unlinked, created)"); $this->qup("changing index on file_links to include file_id", "ALTER TABLE file_links DROP KEY file_id, DROP PRIMARY KEY, ADD PRIMARY KEY (file_id, link_id)"); // 2007-08-03 Saurabh - creating table for Rating $this->qup_all_networks("creating rating table for rating various entities in the system", "CREATE TABLE {rating} ( `index_id` int(11) NOT NULL auto_increment, `rating_type` enum('user','content','collection','tag','comment','network') NOT NULL default 'content', `type_id` int(11) NOT NULL default '0', `attribute_id` smallint(3) NOT NULL default '-1', `rating` mediumint(5) NOT NULL default '0', `max_rating` mediumint(5) NOT NULL default '0', `user_id` int(11) NOT NULL default '0', PRIMARY KEY (`index_id`) )"); // This line is added for new content $this->qup("adding new content type question on 3-aug", "INSERT INTO {content_types} VALUES (8, 'Question', 'Question')"); // 2007-08-03 Himanshu - Creating table for Activity Log and User Popularity $this->qup("creating activity_log table for storing list of all the activities performed by all the users on the system", "CREATE TABLE {activity_log} ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY , `type` VARCHAR( 255 ) NOT NULL, `subject` VARCHAR( 255 ) NOT NULL, `object` VARCHAR( 255 ) NOT NULL, `extra` TEXT NULL, `time` INT( 11 ) NOT NULL, `status` VARCHAR( 10 ) NOT NULL)"); $this->qup("Inserting index as pair of subject and time ", "ALTER TABLE `activity_log` ADD INDEX `chrono_user_activity` ( `subject` , `time` )"); $this->qup("creating table user_popularity for having popularity of each user according to the point alloted to each activity performed by user", "CREATE TABLE {user_popularity} ( `user_id` INT NOT NULL , `popularity` INT NOT NULL , `time` INT( 11 ) NOT NULL, PRIMARY KEY ( `user_id` ) ) "); $this->qup/*_all_networks*/("adding reviews table", "CREATE TABLE {reviews} ( review_id INT NOT NULL AUTO_INCREMENT, -- id of this review PRIMARY KEY (review_id), is_active BOOL NOT NULL DEFAULT 1, -- set to 0 to delete this review subject_type VARCHAR(32) NOT NULL, -- class being reviewed ('content', 'ext_movie', 'ext_tvshow', etc). subject_id INT NOT NULL, -- actual id of thing being reviews (item id, content id, external movie id, etc) author_id INT NOT NULL, -- user_id of the reviewer KEY by_subject (is_active, subject_type, subject_id), title VARCHAR(255), -- title of review body TEXT NOT NULL, -- review content created DATETIME NOT NULL, -- when written updated DATETIME NOT NULL, -- when edited KEY by_freshness (is_active, subject_type, created) )"); $this->qup("2007-10-23 Martin adding 'in_reply_to' field to keep track of threads", "ALTER TABLE `private_messages` ADD `in_reply_to` INT(11) NOT NULL DEFAULT '0'"); $this->qup("Inserting index for threading", "ALTER TABLE `private_messages` ADD INDEX `threading` ( `message_id`, `in_reply_to` )"); $this->qup("2007-10-24 Martin adding 'conversation_id' field to keep track of conversations", "ALTER TABLE `private_messages` ADD `conversation_id` INT(11) NOT NULL DEFAULT '0'"); $this->qup("Inserting index for conversations", "ALTER TABLE `private_messages` ADD INDEX `conversations` ( `conversation_id` )"); $this->qup/*_all_networks*/("adding comments2 table", "CREATE TABLE {comments2} ( comment_id INT NOT NULL AUTO_INCREMENT, -- id of this comment PRIMARY KEY (comment_id), is_active BOOL NOT NULL DEFAULT 1, -- set to 0 to delete this comment subject_type VARCHAR(32) NOT NULL, -- class being commented ('content', 'ext_movie', 'ext_tvshow', etc). subject_id VARCHAR(64) NOT NULL, -- actual id of thing being commented (item id, content id, external movie id, etc. This ia a varchar as we can't assume everyone will use integer keys for their items) author_id INT NOT NULL, -- user_id of the commenter KEY by_subject (is_active, subject_type, subject_id), title VARCHAR(255), -- title of comment body TEXT NOT NULL, -- comment content created DATETIME NOT NULL, -- when written updated DATETIME NOT NULL, -- when edited KEY by_freshness (is_active, subject_type, created) )"); $this->qup/*_all_networks*/("adding movie, actor and tv_show as valid Rating targets", "ALTER TABLE {rating} CHANGE rating_type rating_type ENUM( 'user', 'content', 'collection', 'tag', 'comment', 'network', 'movie', 'actor', 'tv_show')" ); // "items" - shadow records for external rateable/reviewable/commentable things like movies, tv shows. $this->qup("adding items table", "CREATE TABLE {items} ( item_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (item_id), subject_type VARCHAR(32) NOT NULL, subject_id VARCHAR(64) NOT NULL, UNIQUE (subject_type, subject_id), title VARCHAR(255) NOT NULL, -- name of item (movie title etc) thumbnail VARCHAR(255) NOT NULL, -- url of thumbnail thumbnail_width INT NOT NULL, thumbnail_height INT NOT NULL, genres VARCHAR(255) NOT NULL )"); // PP 2007-09-19 - without this index we end up doing a full table scan on users and user_profile_data to locate a shadow user - ouch! $this->qup("indexing user_profile_data for shadow users", "ALTER TABLE {user_profile_data} ADD KEY field_without_user (field_type(32), field_name(32), field_value(64))"); $this->qup_all_networks("indexing rating for summary/fetch", array("ALTER TABLE {rating} ADD KEY summary_idx (rating_type, type_id, attribute_id)", "ALTER TABLE {rating} ADD KEY user_rating (user_id, rating_type, type_id, attribute_id)")); // martin 2007-09-19 One-liners for Ratings (mini reviews) $this->qup/*_all_networks*/("adding oneliners table", "CREATE TABLE {oneliners} ( oneliner_id INT NOT NULL AUTO_INCREMENT, -- id of this oneliner^ PRIMARY KEY (oneliner_id), is_active BOOL NOT NULL DEFAULT 1, -- set to 0 to delete genre VARCHAR(32) NOT NULL, -- what Genre does this apply to rating INT NOT NULL, -- the rating level author_id INT NOT NULL, -- user_id of the person submittingnthe oneliner KEY by_genre (is_active, genre, rating), body VARCHAR(255) NOT NULL, -- the actual oneliner created DATETIME NOT NULL, -- when written KEY by_freshness (is_active, genre, created) )"); // martin 2007-09-19 One-liners for Ratings (mini reviews) $mycnt = 0; $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"action\", 1, \"There's more action in a lawn bowling.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"action\", 2, \"A garden gnome is more high-octance.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"action\", 3, \"Raising pulses in retirement communities across Canada!\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"action\", 4, \"Solid.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"action\", 5, \"Made Chuck Norris Cry.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"romance\", 1, \"I cried, but not because the story was sad.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"romance\", 2, \"You had me at 'The End'.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"romance\", 3, \"Brangelina would adopt this. But they adopt anything.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"romance\", 4, \"Great, but one hug away from phenomenal.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"romance\", 5, \"Scientology has nothing on this movie.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"comedy\", 1, \"Watching grass grow is a better time.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"comedy\", 2, \"Maybe I had to be there.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"comedy\", 3, \"A bit of 'funny ha-ha' with a touch of 'funny-strange.'\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"comedy\", 4, \"A guilty pleasure.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"comedy\", 5, \"You'll laugh your a** off!\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"documentary\", 1, \"Larry King wants to find out where it all went wrong.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"documentary\", 2, \"Huh, what? Sorry - I was dozing.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"documentary\", 3, \"Only got up to scope the fridge twice.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"documentary\", 4, \"It's no 'mating habits of the eastern ant', but well done.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"documentary\", 5, \"This movie should run for office.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"horror\", 1, \"The only thing that made me jump was the end of this film.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"horror\", 2, \"I wouldn't break a mild jog if this movie was chasing me.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"horror\", 3, \"Bring a lantern if your going camping (but just one).\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"horror\", 4, \"I would see it again, with a friend holding my hand.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"horror\", 5, \"Scarier than finding a corpse in your closet.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"sf/fantasy\", 1, \"Cryogenically freeze this and smash it on a floor.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"sf/fantasy\", 2, \"If this were launched into orbit, it would get sent back.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"sf/fantasy\", 3, \"A hobbit or two wouldn't hurt, wait maybe it would.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"sf/fantasy\", 4, \"The Best Film of 2123.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"sf/fantasy\", 5, \"Peter Jackson needs to make three of these.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"family\", 1, \"Like a substitute teacher: different but boring.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"family\", 2, \"How do I spell 'skip it'\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"family\", 3, \"Watch it once shame on me, watch it twice...well I won't.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"family\", 4, \"Better than any movie you'd see in Health Class.\")"); $this->qup/*_all_networks*/("populating oneliners table INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, genre, rating, body) VALUES (0, 1, \"family\", 5, \"Even my parents like this one!\")"); $this->qup("add items.url", "ALTER TABLE {items} ADD COLUMN url VARCHAR(255) NOT NULL"); $this->qup("add comment/review counts", array( "ALTER TABLE {items} ADD COLUMN is_active INT NOT NULL DEFAULT 1, -- not used yet, but might be in future ADD COLUMN comment_count INT NOT NULL, ADD COLUMN review_count INT NOT NULL, ADD COLUMN rating_count INT NOT NULL, -- indices for 'most commented' etc. ADD KEY by_comment_count (is_active, comment_count), ADD KEY by_review_count (is_active, review_count), ADD KEY by_rating_count (is_active, rating_count)", "ALTER TABLE {users} ADD COLUMN comment_count INT NOT NULL, ADD COLUMN review_count INT NOT NULL, ADD COLUMN rating_count INT NOT NULL, -- indices for 'top review' etc. ADD KEY by_comment_count (is_active, comment_count), ADD KEY by_review_count (is_active, review_count), ADD KEY by_rating_count (is_active, rating_count)", )); $this->qup("more comments2 indices", array( "ALTER TABLE {comments2} ADD KEY by_author (is_active, author_id, created)", "ALTER TABLE {reviews} ADD KEY by_author (is_active, author_id, created)", )); $this->qup("ratings on items", array( "ALTER TABLE {items} ADD COLUMN average_rating FLOAT NOT NULL, ADD KEY by_rating (is_active, average_rating)", )); // 2007-11-21 martin adding language column to oneliners $this->qup("martin adding language column to oneliners", array( "ALTER TABLE {oneliners} ADD COLUMN language VARCHAR(32) NOT NULL DEFAULT 'english', ADD KEY by_genre_lang (genre, language)" )); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"action\", 1, \"À côté, une partie de curling est un feu roulant d'action\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"action\", 2, \"Bouge moins qu'un nain de jardin\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"action\", 3, \"La tension grimpe dans les villages de retraités\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"action\", 4, \"Du solide\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"action\", 5, \"De quoi essouffler Chuck Norris\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"romance\", 1, \"J'ai pleuré, mais pas à cause de l'histoire\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"romance\", 2, \"Vous avez réussi à m'avoir à la fin\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"romance\", 3, \"Brangelina l'adopterait. Mais ce n'est pas une référence...\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"romance\", 4, \"Tout sucre tout miel, mais manque un peu de guimauve\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"romance\", 5, \"Même l'Église de Scientologie n'aurait rien à reprocher à ce film\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"comedy\", 1, \"Moins divertissant que de regarder l'herbe pousser\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"comedy\", 2, \"Peut-être fallait-il être là pour trouver ça drôle...\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"comedy\", 3, \"Un peu d'humour noir... qui fait rire jaune\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"comedy\", 4, \"Un plaisir coupable\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"comedy\", 5, \"À piss** de rire\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"documentary\", 1, \"Paul Arcand veut connaître le fond de l'affaire\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"documentary\", 2, \"Hein, quoi ? Non, non, je ne dormais pas\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"documentary\", 3, \"Je n'ai investigué le frigo que deux fois pendant le film\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"documentary\", 4, \"Intéressant, même s'il n'est pas question de l'accouplement de la mante religieuse\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"documentary\", 5, \"Le réalisateur devrait se porter candidat aux élections\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"horror\", 1, \"La seule chose qui m'a fait sursauter, c'est le générique de la fin\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"horror\", 2, \"À hurler... de rire !\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"horror\", 3, \"Assurez-vous d'avoir une lampe de poche (pas plus !) si vous allez camper\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"horror\", 4, \"Je ne reverrai ce film que si quelqu'un me tient la main\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"horror\", 5, \"Plus terrifiant qu'un squelette dans votre placard\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"sf/fantasy\", 1, \"À cryogéniser pour pouvoir mieux le fracasser contre le sol\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"sf/fantasy\", 2, \"Si l'on envoyait ce film dans l'espace, on nous le renverrait à coup sûr\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"sf/fantasy\", 3, \"Il ne ferait pas de tort d'y ajouter un Hobbit ou deux... Ou peut-être que si ?\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"sf/fantasy\", 4, \"Meilleur film de l'année 2123\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"sf/fantasy\", 5, \"Peter Jackson en tirera sûrement une trilogie\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"family\", 1, \"À l'image d'un suppléant : différent mais embêtant\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"family\", 2, \"Comment s'épelle le mot « moche »?\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"family\", 3, \"L'avoir vu une première fois : quelle honte ! Le voir une deuxième fois : JAMAIS !\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"family\", 4, \"Meilleur que n'importe quel film visionné dans mon cours de sexo\")"); $this->qup("adding french oneliners INSERT " . $mycnt++, "INSERT INTO {oneliners} (author_id, is_active, language, genre, rating, body) VALUES (0, 1, \"french\", \"family\", 5, \"Même mes parents ont adoré !\")"); // change ratings enum into varchar, to match reviews and comments2 $this->qup("2007-12-06 changing rating.rating_type into a varchar", "ALTER TABLE {rating} CHANGE rating_type rating_type VARCHAR(32)"); // change ratings rating_id into varchar, to match Items $this->qup("2007-12-07 changing rating.type_id into a varchar", "ALTER TABLE {rating} CHANGE type_id type_id VARCHAR(64)"); // change reviews subject_id into varchar, to match Items $this->qup("2007-12-07 changing reviews.subject_id into a varchar", "ALTER TABLE {reviews} CHANGE subject_id subject_id VARCHAR(64)"); $this->qup/*_all_networks*/("2008-03-19 adding fans table", "CREATE TABLE {fans} ( fan_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (fan_id), is_active BOOL NOT NULL DEFAULT 1, subject_type VARCHAR(32) NOT NULL, subject_id VARCHAR(64) NOT NULL, user_id INT NOT NULL, KEY by_subject (is_active, subject_type, subject_id), user_displayname VARCHAR(255), user_fullname VARCHAR(255), created DATETIME NOT NULL, updated DATETIME NOT NULL, KEY by_freshness (is_active, subject_type, created) )"); $this->qup/*_all_networks*/("2008-05-10 adding itemtags table", "CREATE TABLE {itemtags} ( tag_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (tag_id), subject_type VARCHAR(32) NOT NULL, subject_id VARCHAR(64) NOT NULL, user_id INT NOT NULL, KEY by_subject (subject_type, subject_id), KEY by_subject_and_user (subject_type, subject_id, user_id), tag_string VARCHAR(64) NOT NULL, KEY tg_search (tag_string) )"); $this->qup/*_all_networks*/("2008-06-4 adding created to itemtags", "ALTER TABLE {itemtags} ADD created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD KEY recent_tg (created, tag_string)" ); // finally, run the 'safe' updates in net_extra.php. run_net_extra(); }//__endof__ do_updates
if (!isset($extra['notify_owner'][$key])) { $extra['notify_owner'][$key] = $value; } } // save array to the data base Dal::query("update {networks} set extra = ? where network_id = ? ", array(serialize($extra), $net->network_id)); // echo $net->name . ' has been updated with extra notifications'; } } // End if old network exist } } // End of class // This is called from db_update.php, ONCE, i.e. during installation. function run_net_extra_once_only() { $ne = new net_extra(); $ne->once_only_updates(); $ne->safe_updates(); } // This is called at the end of every db_update.php run, and if you // run net_extra.php at the command line. function run_net_extra() { $ne = new net_extra(); $ne->safe_updates(); } // if we're browsing to this script directly, run everything now. if (count(@$_SERVER['argv']) && basename($_SERVER['argv'][0]) == basename(__FILE__)) { run_net_extra(); }