|
|
Joined: Jul 2001
Posts: 442
Enthusiast
|
Enthusiast
Joined: Jul 2001
Posts: 442 |
How do I archive old posts so I can save them off and maybe even have some kind of searchable table or something.
|
|
|
|
Joined: May 1999
Posts: 23
Journeyman
|
Journeyman
Joined: May 1999
Posts: 23 |
Make a new table, say w3t_PostsOld, with exactly same definition as w3t_Posts. Do queries: INSERT INTO w3t_PostsOld SELECT * from w3t_Posts where B_Number<N; DELETE FROM w3t_Posts where B_Number<N; You may run this from cron to assure regular archiving (remember to optimize w3t_Posts after deleting old posts). You can use B_Posted instead of B_Number to move posts to archive based on date they were posted. Ie. to archive posts older that 30 days you should do following query: INSERT INTO w3t_PostsOld SELECT * from w3t_Posts where (UNIX_TIMESTAMP()-B_Posted)>2592000; DELETE FROM w3t_Posts where (UNIX_TIMESTAMP()-B_Posted)>2592000;
Then you must create some addititional files (by making changed copies of original files) to do searching in w3t_PostsOld (archiveshowflat.php, archivedosearch.php, archivesearch.php, archiveshowthreaded.php) and additional option in menu: "Search archive". You can also create archiveaddpost.php and archivenewreply.php which will allow your users to reply to posts in archive and post these replies into w3t_Posts. I can post here my archive* files, but they have searching changed to use fulltext indexes from mysql 4.0.1 (because in other way searching is toooooo ssssssllllllooooowwwww with large number of posts /I have about 500k/). But if anyone interested let me know.
Greetings, Piotr
|
|
|
|
Joined: May 1999
Posts: 23
Journeyman
|
Journeyman
Joined: May 1999
Posts: 23 |
btw. I tried to do that with MERGE table type. I created w3t_PostsOld the way I wrote earlier, then w3t_PostsAll of type MERGE (merges w3t_Posts and w3t_PostsOld). The bonus is you do not have to create additional files, just change all references for w3t_Posts to w3t_PostsAll in dosearch.php. The minus is that searching is much slower than in both tables separately. But I didn't try with full text index, so maybe...
Greetings, Piotr
|
|
|
|
Joined: Jan 2002
Posts: 218
Enthusiast
|
Enthusiast
Joined: Jan 2002
Posts: 218 |
Actually, that gives me some ideas for future site improvements. I don't really have the trouble right now, but I imagine I will eventually.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 87
Joined: December 2001
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|