For large, busy sites, the database can become too large for the server to handle; specifically, the indexes become too large to keep in memory, and the whole thing slows down drastically. Story and comment archiving addresses that by moving older stories and comments to a secondary database.
The primary database is used for new and still-active stories and their comments; the archive database is used for older stories, and does not allow new comments, ratings, or poll votes. Archived stories are available at the same URL as they were before being archived, to prevent links bringing people to your site from breaking. To search the archive for comments and stories, the user must check the ``Search Archive'' box in the search form as the regular and archive databases are searched separately.
To set up the archive database, you must first create the database and set the access rules for it as described in section 2.5.1. This is the same procedure as for the regular database, but you must substitute the name of the archive database and its sql file in the command. The sql file for the archive database is in your scoop/struct/archive directory. You may use the same database username and password for the regular and archive databases.
For Scoop to access the archive database properly, you have to tell Apache about it in the httpd.conf file, or wherever your main Scoop config directives are:
# Archive config: # Set these vars if you use an archive database # The name of the archive database PerlSetVar db_name_archive __DBNAMEARCHIVE__ # The host where mySQL is running PerlSetVar db_host_archive __DBHOSTARCHIVE__ # The user to connect as PerlSetVar db_user_archive __DBUSERARCHIVE__ # The user's database password PerlSetVar db_pass_archive __DBPASSARCHIVE__
Substitute the correct values for the name, host, user, and password, then stop and start Apache (never restart). A good place to paste these commands in your config file is right after the commands for your regular database; that way they're all together.
Archiving is controlled through the variables in the Site Controls Admin Tool (A.6).
Stories and their comments are archived together; polls, even those attached to stories, are archived separately.
Stories are archived based on their age and optionally their activity. The variable story_archive_age sets the age of a story in days before it will be considered for archiving. Any story posted (not submitted) more days ago than this value will be archived or considered for archiving. To disable story archiving, set story_archive_age to 0.
If you wish to protect old but active stories from archiving, the variable comment_archive_age is what you want. Stories considered for archiving are tested for new comments; if they have any comments newer than the age in this variable, they are not archived. If the newest comment is older than the age in this variable, then the story is archived. To disable this check and archive stories purely on their age, set comment_archive_age to 0.
In addition to archiving stories and their comments, you have the option of archiving a story's voting record instead of just its displaystatus (Front Page or Section). You also have the option of archiving a comment's rating history, instead of just its score and the number of ratings. Both of these are informational only, and archiving and display will work equally well with or without them. They are set using the variables archive_moderations and archive_ratings, respectively.
Polls are archived based purely on their age; there is no option to protect active polls. The variable poll_archive_age sets the age of a poll in days before it will be archived. To disable poll archiving, set poll_archive_age to 0.
Once the archive database and archiving configuration are set, the actual process of archiving is started using the Cron Admin Tool (A.14). The cron item archive_stories runs the code that checks the age of stories and comments, then archives those that match the criteria set in the Site Controls. The cron item poll_archive runs the code that checks the age of polls, then archives those that match the criteria set it the Site Controls.