<?php /* Config */ ob_start(); include 'inc/config.php'; ob_end_clean(); /* Includes */ include 'inc/class/class.mysql.php'; $db = new mySqlCon(); $db->output_error = 1; $db->query("\n CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "search_queue` (\n `id` INT NOT NULL AUTO_INCREMENT,\n `related_user_id` varchar(48) NOT NULL,\n `search_key` varchar(255) NOT NULL,\n `last_search_date` DATETIME DEFAULT NULL,\n `last_search_cursor` varchar(48) DEFAULT -1,\n PRIMARY KEY (`id`)\n );\n"); $db->query("\n CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "extracted_user_data` (\n `user_id` varchar(48) NOT NULL,\n `screen_name` varchar(255) DEFAULT NULL,\n `related_user_id` varchar(48) NOT NULL,\n `followers_count` INT,\n `following_count` INT,\n `follow_ratio` FLOAT,\n `location` varchar(255) DEFAULT NULL,\n `tw_account_age_days` INT,\n `last_tweet_date` DATETIME DEFAULT NULL,\n `datetime_created` DATETIME DEFAULT NULL,\n `datetime_updated` DATETIME DEFAULT NULL,\n `datetime_robot_follow` DATETIME DEFAULT NULL,\n `used_search_key` VARCHAR(255) DEFAULT NULL,\n PRIMARY KEY (`user_id`),\n INDEX (used_search_key),\n INDEX (screen_name)\n );\n"); $db->query("\n INSERT INTO " . DB_PREFIX . "cron_status\n (cron_name) VALUES ('search');\n"); $db->query("\n INSERT INTO " . DB_PREFIX . "cron_status\n (cron_name) VALUES ('upd_info');\n"); $db->query("\n INSERT INTO " . DB_PREFIX . "cron_status\n (cron_name) VALUES ('robot_fw');\n"); $db->query("\n INSERT INTO " . DB_PREFIX . "cron_status\n (cron_name) VALUES ('gen_tweets');\n"); $db->query("\n INSERT INTO " . DB_PREFIX . "cron_status\n (cron_name) VALUES ('bot_tweets');\n"); //create and fill table for user config $db->query("\n CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "users_config` (\n `user_id` varchar(48) NOT NULL,\n `follow_bot_status` BOOLEAN DEFAULT FALSE,\n `follow_rate` INT DEFAULT 5,\n `follow_rule` TEXT DEFAULT NULL,\n `tweet_bot_status` BOOLEAN DEFAULT FALSE,\n `tweet_template` TEXT DEFAULT NULL,\n `tweet_query` TEXT DEFAULT NULL,\n `tweeting_rate` INT DEFAULT 5,\n `tweet_generation_rate` INT DEFAULT 5,\n `tweet_generation_offset` INT DEFAULT 0,\n PRIMARY KEY (user_id)\n );\n"); $existingAccounts = $db->query("\n SELECT id\n FROM " . DB_PREFIX . "authed_users;\n"); while ($twando_account = mysql_fetch_array($existingAccounts, MYSQL_ASSOC)) { $db->query("\n INSERT INTO " . DB_PREFIX . "users_config\n (user_id) VALUES ('{$twando_account['id']}');\n "); $db->query("\n ALTER TABLE " . DB_PREFIX . "extracted_user_data\n ADD `datetime_robot_follow_{$twando_account['id']}` DATETIME DEFAULT NULL;\n "); } $db->query("\n CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "tweets_queue` (\n `id` INT NOT NULL AUTO_INCREMENT,\n `user_id` varchar(48) NOT NULL,\n `tweet_content` TEXT DEFAULT NULL,\n `datetime_created` DATETIME DEFAULT NULL,\n `datetime_tweeted` DATETIME DEFAULT NULL,\n PRIMARY KEY (id),\n INDEX (user_id)\n );\n");
<?php /* Config */ ob_start(); include 'inc/config.php'; ob_end_clean(); /* Includes */ include 'inc/class/class.mysql.php'; $db = new mySqlCon(); $db->output_error = 1; //Add search key to extracted data $db->query("\n ALTER TABLE " . DB_PREFIX . "extracted_user_data\n ADD used_search_key VARCHAR(255) DEFAULT NULL;\n"); //create and fill table for user config $db->query("\n CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "users_config` (\n `user_id` varchar(48) NOT NULL,\n `follow_bot_status` BOOLEAN DEFAULT FALSE,\n `follow_rate` INT DEFAULT 5,\n `follow_rule` TEXT DEFAULT NULL,\n `tweet_bot_status` BOOLEAN DEFAULT FALSE,\n `tweet_template` TEXT DEFAULT NULL,\n `tweet_query` TEXT DEFAULT NULL,\n `tweeting_rate` INT DEFAULT 5,\n `tweet_generation_rate` INT DEFAULT 5,\n `tweet_generation_offset` INT DEFAULT 0,\n PRIMARY KEY (user_id)\n );\n"); $existingAccounts = $db->query("\n SELECT id\n FROM " . DB_PREFIX . "authed_users;\n"); while ($twando_account = mysql_fetch_array($existingAccounts, MYSQL_ASSOC)) { $db->query("\n INSERT INTO " . DB_PREFIX . "users_config\n (user_id) VALUES ('{$twando_account['id']}');\n "); $db->query("\n ALTER TABLE " . DB_PREFIX . "extracted_user_data\n ADD `datetime_robot_follow_{$twando_account['id']}` DATETIME DEFAULT NULL;\n "); } //rebuild table search_queue - type column is not nessecary $existingKeys = $db->query("\n SELECT *\n FROM " . DB_PREFIX . "search_queue;\n"); while ($key = mysql_fetch_array($existingKeys, MYSQL_ASSOC)) { $SEARCH_TYPE_BY_HANDLE = 1; $SEARCH_TYPE_BY_KEYWORD = 2; if ($key['search_type'] == $SEARCH_TYPE_BY_HANDLE) { $db->query("\n UPDATE " . DB_PREFIX . "search_queue\n SET search_key='@{$key['search_key']}'\n WHERE id={$key['id']};\n "); } else {