Previous Thread
Next Thread
Print Thread
Rate Thread
#213158 01/31/2002 2:14 PM
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Offline
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.

Sponsored Links
Joined: May 1999
Posts: 23
Journeyman
Journeyman
Offline
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
Offline
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
Offline
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.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
• Shock Hosting
• Stable Host
• bluehost
• InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,080
Joined: March 2000
Forum Statistics
Forums63
Topics37,583
Posts293,957
Members13,826
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 3418
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 25
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20261026)