Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-22-2009, 04:58 AM
RedTrinity's Avatar
RedTrinity RedTrinity is offline
 
Join Date: Mar 2008
Location: QLD, Australia
Posts: 265
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Freezing postcounts during board cleanup

Hi guys.

I'm planning to do a cleanup of our forum, however I am hoping there is a way I can 'freeze' the postcounts of all members in the meanwhile... in other words, so they have the same post amounts afterwards, even after mass topics have been deleted from the forum.

Basically just want to do a big cleanup without it affecting any post counts at all! Otherwise, with over 1,000 members, it would take too long to restore them manually afterwards.

Can anybody please point me in the right direction for a mod which would help with this, or even might be interested in helping me with their own hack/mod for it?

Thanks in advance
Reply With Quote
  #2  
Old 10-22-2009, 02:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have never seen a mod to do this. What you might be able to do is create a new field in the user table and copy the post count to that new field. Then do your maintenance. Then copy the field back to the post counts field.
Reply With Quote
  #3  
Old 10-23-2009, 05:02 AM
RedTrinity's Avatar
RedTrinity RedTrinity is offline
 
Join Date: Mar 2008
Location: QLD, Australia
Posts: 265
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne,

Thanks for your advice. Would this method work effectively for a board with a lot of members ie. can it be done in one hit, via an SQL query or the like? It would it have to be done manually per user (ie. one-by-one)?

I'm hoping the first is an option, with the amount of members we have it may take too long to do otherwise.

Cheers
Reply With Quote
  #4  
Old 10-23-2009, 06:45 AM
dartho dartho is offline
 
Join Date: Sep 2005
Location: Australia
Posts: 2,303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm pretty sure you can delete to your hearts content and post numbers won't go down so long as you don't perform a "Update Post Counts" in the maintenance section of the admincp.

[But you should probably perform a database backup first! 1. "just in case" and 2. so you have those soon to be deleted posts save for posterity should you need to go back to them.]
Reply With Quote
  #5  
Old 10-23-2009, 07:45 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is a somewhat common request which is virtually impossible to achieve, as there are a million + 1 places where the postcount gets updated.

Even if you did backup and restore the postcount, it would get updated to the real numbers the next time you run the maintenance function.

My best advice would be: Don't delete content - or don't care about post counters.
Reply With Quote
  #6  
Old 10-27-2009, 02:32 AM
RedTrinity's Avatar
RedTrinity RedTrinity is offline
 
Join Date: Mar 2008
Location: QLD, Australia
Posts: 265
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Andreas View Post
My best advice would be: Don't delete content - or don't care about post counters.
Unfortunately our database is getting very large, I'm looking to delete older content to free up some space and shrink things down. Otherwise for a non-profit forum, its gonna get too expensive for me to host.

We also have an established post count 'program' where members see it as a big achievement to reach certain post milestones (in fact we have a section specifically where members post about them, and get medals/trophies for it) and we also have postcount restricted areas on our forum too. So we can't really do without the post counters option.

I guess I'll have to keep searching in the meanwhile for a way to do this.

Quote:
Originally Posted by dartho View Post
I'm pretty sure you can delete to your hearts content and post numbers won't go down so long as you don't perform a "Update Post Counts" in the maintenance section of the admincp.

[But you should probably perform a database backup first! 1. "just in case" and 2. so you have those soon to be deleted posts save for posterity should you need to go back to them.]
Thanks Dartho, I'll do some testing and see if it works
Reply With Quote
  #7  
Old 10-27-2009, 02:48 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by GamerGirl27 View Post
Hi Lynne,

Thanks for your advice. Would this method work effectively for a board with a lot of members ie. can it be done in one hit, via an SQL query or the like? It would it have to be done manually per user (ie. one-by-one)?
I was thinking you could just create a new field, like posts2, and then write a query to copy the content from posts to posts2. then, after you were done deleting posts you could just copy it back.
Reply With Quote
  #8  
Old 10-27-2009, 02:49 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If not, SQL for the win:

Run these before:
Code:
 CREATE TABLE postcounts (
    userid INTEGER UNSIGNED NOT NULL PRIMARY KEY
  , posts  INTEGER UNSIGNED NOT NULL 
);

INSERT INTO postcounts
SELECT userid
     , posts
  FROM user;
Run these after:
Code:
UPDATE user
INNER
  JOIN postcounts
    ON postcounts.userid = user.userid
   SET user.posts = postcounts.posts;

DROP TABLE postcounts;
Add your prefixes if necessary.
Reply With Quote
  #9  
Old 10-27-2009, 02:56 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^^ Adrian wrote out what I was thinking.
Reply With Quote
  #10  
Old 11-24-2009, 10:36 PM
RedTrinity's Avatar
RedTrinity RedTrinity is offline
 
Join Date: Mar 2008
Location: QLD, Australia
Posts: 265
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much for that, the queries are perfect for what I want to do

I do have one more small request though... would there be a similar one for reinstating post/topic counts for the forum stats?

Ie. Members: 1,087, Threads: 25,591, Posts: 420,667

Or where would I edit this afterwards to reflect the counts prior to the changes being made?

Thanks again SirAdrian, you've been a great help sofar!!

PS. Thought I had better note as well in regards to your suggestion Dartho - I did a test and unfortunately postcounts are affected with topic/post deletion, even without touching the maintenance section of the AdminCP! Just to let you know I wasn't sure of this beforehand, either.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:12 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07394 seconds
  • Memory Usage 2,280KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete