Jump to content


- - - - -
Photo

Archive System: Using an external database


The forum post archive system allows you to archive to database that is different from the one your forum uses. If your network allows it, this means you can use a different server to archive your posts onto.

To enable remote DB archiving, simply follow the steps below:

Set up your remote database and create this table in it:

CREATE TABLE `forums_archive_posts` (
  `archive_id` int(10) NOT NULL DEFAULT '0',
  `archive_author_id` int(10) NOT NULL DEFAULT '0',
  `archive_author_name` varchar(255) NOT NULL DEFAULT '0',
  `archive_ip_address` varchar(46) NOT NULL DEFAULT '',
  `archive_content_date` int(10) NOT NULL DEFAULT '0',
  `archive_content` mediumtext,
  `archive_queued` int(1) NOT NULL DEFAULT '1',
  `archive_topic_id` int(10) NOT NULL DEFAULT '0',
  `archive_is_first` int(1) NOT NULL DEFAULT '0',
  `archive_bwoptions` int(10) unsigned NOT NULL DEFAULT '0',
  `archive_attach_key` char(32) NOT NULL DEFAULT '',
  `archive_html_mode` int(1) NOT NULL DEFAULT '0',
  `archive_show_signature` int(1) NOT NULL DEFAULT '0',
  `archive_show_emoticons` int(1) NOT NULL DEFAULT '0',
  `archive_show_edited_by` int(1) NOT NULL DEFAULT '0',
  `archive_edit_time` int(10) NOT NULL DEFAULT '0',
  `archive_edit_name` int(10) NOT NULL DEFAULT '0',
  `archive_edit_reason` varchar(255) NOT NULL DEFAULT '',
  `archive_added` int(10) NOT NULL DEFAULT '0',
  `archive_restored` int(1) NOT NULL DEFAULT '0',
  `archive_forum_id` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`archive_id`),
  KEY `archive_author_id` (`archive_author_id`),
  KEY `archive_topic_id_2` (`archive_topic_id`,`archive_queued`,`archive_content_date`),
  KEY `archive_restored` (`archive_restored`),
  KEY `archive_content_date` (`archive_content_date`,`archive_topic_id`),
  FULLTEXT KEY `archive_content` (`archive_content`)
);

If you already have archived content in your 'forums_archive_posts' table, you will need to import them to this table or you will have empty archived topics.

Once the database has been set up, the table created and any existing rows imported simply add the following to your conf_global.php file:


$INFO['archive_remote_sql_host']						=	   '{host}';
$INFO['archive_remote_sql_database']					=	   '{database}';
$INFO['archive_remote_sql_user']						=	   '{username}';
$INFO['archive_remote_sql_pass']						=	   '{password}';
$INFO['archive_remote_sql_charset']					 =	   '';

The SQL charset can be left blank. It should match what ever value you have in $INFO['sql_charset']. Naturally, you'll want to use the real data instead of the {example} data.

Once this has been completed, check to ensure it's working by loading the archive dashboard page (Forums > Archiving > Overview). If there is a connection error, you'll see a red box entitled "Remote Database Connection Error"
  • AndyF, FCB-ROGA, Aussie Cable and 1 other like this



1 Comments

Presumably this would this help increase performance on large databases by helping reduce their overall size. Is there any risk of this feature ever being depreciated?


Developer Docs · Error Codes