Example #1
0
    public function step1()
    {
        $tables = XenForo_Install_Data_MySql::getTables();
        $this->executeUpgradeQuery('
			DROP TABLE IF EXISTS xf_permission_cache_content_type
		');
        $this->executeUpgradeQuery('
			DROP TABLE IF EXISTS xf_permission_cache_global_group
		');
        $this->executeUpgradeQuery($tables['xf_deferred']);
        $this->executeUpgradeQuery($tables['xf_draft']);
        $this->executeUpgradeQuery($tables['xf_edit_history']);
        $this->executeUpgradeQuery($tables['xf_forum_watch']);
        $this->executeUpgradeQuery($tables['xf_registration_spam_cache']);
        $this->executeUpgradeQuery($tables['xf_content_spam_cache']);
        $this->executeUpgradeQuery($tables['xf_bb_code_parse_cache']);
        $this->executeUpgradeQuery($tables['xf_route_filter']);
        $this->executeUpgradeQuery($tables['xf_mail_queue']);
        $this->executeUpgradeQuery($tables['xf_template_history']);
        $this->executeUpgradeQuery($tables['xf_template_modification']);
        $this->executeUpgradeQuery($tables['xf_template_modification_log']);
        $this->executeUpgradeQuery($tables['xf_admin_template_modification']);
        $this->executeUpgradeQuery($tables['xf_admin_template_modification_log']);
        $this->executeUpgradeQuery($tables['xf_email_template_modification']);
        $this->executeUpgradeQuery($tables['xf_email_template_modification_log']);
        return true;
    }
Example #2
0
 public function step1()
 {
     $tables = XenForo_Install_Data_MySql::getTables();
     $this->executeUpgradeQuery($tables['xf_image_proxy']);
     $this->executeUpgradeQuery($tables['xf_link_proxy']);
     $this->executeUpgradeQuery($tables['xf_smilie_category']);
     $this->executeUpgradeQuery($tables['xf_bb_code']);
     $this->executeUpgradeQuery($tables['xf_user_change_log']);
     $this->executeUpgradeQuery($tables['xf_user_change_temp']);
     $this->executeUpgradeQuery($tables['xf_spam_trigger_log']);
     // the table storage is different - just replace it
     $this->executeUpgradeQuery("DROP TABLE xf_registration_spam_cache");
     $this->executeUpgradeQuery($tables['xf_registration_spam_cache']);
     $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_user\n\t\t\t\tCHANGE user_state user_state ENUM('valid', 'email_confirm', 'email_confirm_edit', 'moderated', 'email_bounce') NOT NULL DEFAULT 'valid'\n\t\t");
     $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_user_field ADD moderator_editable TINYINT UNSIGNED NOT NULL DEFAULT '0'\n\t\t");
     $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_phrase CHANGE title title VARBINARY(100) NOT NULL\n\t\t");
     $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_session_activity\n\t\t\t\tDROP INDEX view_date,\n\t\t\t\tADD INDEX view_date (view_date) USING BTREE\n\t\t");
     // smilie table enhancements
     $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_smilie\n\t\t\t  ADD smilie_category_id INT UNSIGNED NOT NULL DEFAULT 0,\n\t\t\t  ADD display_order INT UNSIGNED NOT NULL DEFAULT 1,\n\t\t\t  ADD display_in_editor TINYINT UNSIGNED NOT NULL DEFAULT 1,\n\t\t\t  ADD INDEX display_order (display_order)\n\t\t");
     $this->executeUpgradeQuery("UPDATE xf_smilie SET display_order = smilie_id");
     $this->applyGlobalPermission('profilePost', 'comment', 'profilePost', 'post', false);
     $this->applyGlobalPermission('conversation', 'receive', 'conversation', 'start', false);
     $this->executeUpgradeQuery("\n\t\t\tINSERT IGNORE INTO xf_permission_entry\n\t\t\t\t(user_group_id, user_id, permission_group_id, permission_id, permission_value, permission_value_int)\n\t\t\tVALUES\n\t\t\t\t(2, 0, 'conversation', 'receive', 'allow', 0)\n\t\t");
     $this->executeUpgradeQuery("\n\t\t\tINSERT IGNORE INTO xf_content_type_field\n\t\t\t\t(content_type, field_name, field_value)\n\t\t\tVALUES\n\t\t\t\t('user', 'report_handler_class', 'XenForo_ReportHandler_User')\n\t\t");
     return true;
 }
 public function step2()
 {
     $db = $this->_getDb();
     $tables = XenForo_Install_Data_MySql::getTables();
     // thread prefixes, find new threads
     $this->executeUpgradeQuery($tables['xf_forum_prefix']);
     $this->executeUpgradeQuery($tables['xf_thread_prefix']);
     $this->executeUpgradeQuery($tables['xf_thread_prefix_group']);
     $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_forum\n  \t\t\t\tADD count_messages TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'If not set, messages posted (directly) within this forum will not contribute to user message totals.',\n\t\t\t\tADD find_new TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Include posts from this forum when running /find-new/threads',\n\t\t\t\tADD prefix_cache MEDIUMBLOB NOT NULL COMMENT 'Serialized data from xf_forum_prefix, [group_id][prefix_id] => prefix_id',\n\t\t\t\tADD default_prefix_id INT UNSIGNED NOT NULL DEFAULT 0\n\t\t");
     $this->executeUpgradeQuery("ALTER TABLE xf_thread ADD prefix_id INT UNSIGNED NOT NULL DEFAULT 0");
     return true;
 }
Example #4
0
 public function step1()
 {
     $tables = XenForo_Install_Data_MySql::getTables();
     $this->executeUpgradeQuery($tables['xf_email_bounce_log']);
     $this->executeUpgradeQuery($tables['xf_email_bounce_soft']);
     $this->executeUpgradeQuery($tables['xf_help_page']);
     $this->executeUpgradeQuery($tables['xf_sitemap']);
     $this->executeUpgradeQuery($tables['xf_thread_reply_ban']);
     $this->applyGlobalPermission('general', 'viewMemberList', 'general', 'view', false);
     $this->applyGlobalPermission('forum', 'threadReplyBan', 'forum', 'deleteAnyPost', true);
     $this->applyContentPermission('forum', 'threadReplyBan', 'forum', 'deleteAnyPost', true);
     $this->executeUpgradeQuery("\n\t\t\tINSERT IGNORE INTO xf_admin_permission_entry\n\t\t\t\t(user_id, admin_permission_id)\n\t\t\tSELECT user_id, 'help'\n\t\t\tFROM xf_admin_permission_entry\n\t\t\tWHERE admin_permission_id = 'notice'\n\t\t");
     $this->executeUpgradeQuery("\n\t\t\tINSERT IGNORE INTO xf_content_type_field\n\t\t\t\t(content_type, field_name, field_value)\n\t\t\tVALUES\n\t\t\t\t('node', 'sitemap_handler_class', 'XenForo_SitemapHandler_Node'),\n\t\t\t\t('thread', 'sitemap_handler_class', 'XenForo_SitemapHandler_Thread'),\n\t\t\t\t('user', 'sitemap_handler_class', 'XenForo_SitemapHandler_User'),\n\n\t\t\t\t('thread', 'alert_handler_class', 'XenForo_AlertHandler_Thread')\n\t\t");
     $regDefault = @unserialize($this->_getDb()->fetchOne("\n\t\t\tSELECT option_value\n\t\t\tFROM xf_option\n\t\t\tWHERE option_id = 'registrationDefaults'\n\t\t"));
     if ($regDefault) {
         $regDefault['activity_visible'] = !empty($regDefault['visible']) ? '1' : '0';
         $this->_getDb()->update('xf_option', array('option_value' => serialize($regDefault)), "option_id = 'registrationDefaults'");
     }
 }
Example #5
0
 /**
  * Renames the import log table before creating a new empty version.
  *
  * @param string Archive table name
  * @param mixed Error phrase reference
  *
  * @return boolean
  */
 public function archiveImportLog($archiveTableName, &$error)
 {
     $db = $this->_getDb();
     if (preg_match('/[^a-z0-9_]/i', $archiveTableName)) {
         $error = new XenForo_Phrase('error_table_name_illegal');
         return false;
     }
     try {
         $db->query("ALTER TABLE xf_import_log RENAME {$archiveTableName}");
         $tables = XenForo_Install_Data_MySql::getTables();
         $db->query($tables['xf_import_log']);
     } catch (Zend_Db_Exception $e) {
         $error = new XenForo_Phrase('error_unable_to_create_table_due_to_error', array('table' => $archiveTableName, 'error' => $e->getMessage()));
         return false;
     }
     return true;
 }
Example #6
0
 public function insertDefaultData()
 {
     $db = $this->_getDb();
     $insertData = XenForo_Install_Data_MySql::getData();
     foreach ($insertData as $data) {
         $db->query($data);
     }
     return count($data);
 }
 /**
  * Uninstaller
  *
  * Will unconditionally reinstall the default media sites
  *
  * @return void
  */
 public static function uninstall()
 {
     try {
         $defaultData = XenForo_Install_Data_MySql::getData();
         $query = preg_replace('(^(\\s*)INSERT)', '$1REPLACE', $defaultData['xf_bb_code_media_site']);
         XenForo_Application::getDb()->query($query);
     } catch (Exception $e) {
         // Nothing to do here
     }
 }
Example #8
0
 public function rebuildForum()
 {
     $db = $this->_getDb();
     $tables = XenForo_Install_Data_MySql::getTables();
     $data = XenForo_Install_Data_Mysql::getData();
     $db->query("\r\n            INSERT IGNORE INTO xf_admin_search_type\r\n                (search_type, handler_class, display_order)\r\n            VALUES\r\n                ('feed', 'XenForo_AdminSearchHandler_Feed', 310)\r\n        ");
     $db->query("\r\n            INSERT IGNORE INTO xf_content_type\r\n                (content_type, addon_id, fields)\r\n            VALUES\r\n                ('post', 'XenForo', ''),\r\n                ('thread', 'XenForo', '')\r\n        ");
     $db->query("\r\n            INSERT IGNORE INTO xf_content_type_field\r\n                (content_type, field_name, field_value)\r\n            VALUES\r\n                ('post', 'news_feed_handler_class', 'XenForo_NewsFeedHandler_DiscussionMessage_Post'),\r\n                ('post', 'alert_handler_class', 'XenForo_AlertHandler_DiscussionMessage_Post'),\r\n                ('post', 'search_handler_class', 'XenForo_Search_DataHandler_Post'),\r\n                ('post', 'attachment_handler_class', 'XenForo_AttachmentHandler_Post'),\r\n                ('post', 'like_handler_class', 'XenForo_LikeHandler_Post'),\r\n                ('post', 'report_handler_class', 'XenForo_ReportHandler_Post'),\r\n                ('post', 'moderation_queue_handler_class', 'XenForo_ModerationQueueHandler_Post'),\r\n                ('post', 'spam_handler_class', 'XenForo_SpamHandler_Post'),\r\n                ('post', 'stats_handler_class', 'XenForo_StatsHandler_Post'),\r\n                ('post', 'moderator_log_handler_class', 'XenForo_ModeratorLogHandler_Post'),\r\n                ('post', 'warning_handler_class', 'XenForo_WarningHandler_Post'),\r\n\r\n                ('thread', 'news_feed_handler_class', 'XenForo_NewsFeedHandler_Discussion_Thread'),\r\n                ('thread', 'search_handler_class', 'XenForo_Search_DataHandler_Thread'),\r\n                ('thread', 'moderation_queue_handler_class', 'XenForo_ModerationQueueHandler_Thread'),\r\n                ('thread', 'spam_handler_class', 'XenForo_SpamHandler_Thread'),\r\n                ('thread', 'stats_handler_class', 'XenForo_StatsHandler_Thread'),\r\n                ('thread', 'moderator_log_handler_class', 'XenForo_ModeratorLogHandler_Thread')\r\n        ");
     $db->query('DELETE FROM xf_cron_entry WHERE entry_id IN (' . $db->quote(array('cleanUpDaily', 'cleanUpHourly', 'views')) . ')');
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_feed']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_feed_log']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_forum']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_forum_prefix']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_link_forum']));
     $db->query("\r\n            INSERT IGNORE INTO xf_node_type\r\n                (node_type_id, handler_class, controller_admin_class, datawriter_class, permission_group_id,\r\n                        moderator_interface_group_id, public_route_prefix)\r\n            VALUES\r\n                ('Forum', 'XenForo_NodeHandler_Forum', 'XenForo_ControllerAdmin_Forum', 'XenForo_DataWriter_Forum', 'forum', 'forumModeratorPermissions', 'forums'),\r\n                ('LinkForum', 'XenForo_NodeHandler_LinkForum', 'XenForo_ControllerAdmin_LinkForum', 'XenForo_DataWriter_LinkForum', 'linkForum', '', 'link-forums')\r\n        ");
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_poll']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_poll_response']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_poll_vote']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_post']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_thread']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_thread_prefix']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_thread_prefix_group']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_thread_read']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_thread_redirect']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_thread_user_post']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_thread_view']));
     $db->query(str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $tables['xf_thread_watch']));
     $db->query($data['xf_trophy']);
 }