Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 09-19-2015, 02:30 AM
puertoblack2003's Avatar
puertoblack2003 puertoblack2003 is offline
 
Join Date: Aug 2005
Location: Philadelphia
Posts: 1,073
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dariyos View Post
I know what refcount 0 is, but I don't think I had 50 % of attachments that are not used in posts.
5 % is okay, but not 50 %, it is not impossible!

I had restored all my attachments, I correct the value of refcount and set the value to 1 where attachments used in posts...

It was definitly a WRONG that they had the refcount value 0. And I still don't know why they got this value.
I had the same issue, but with my issue was the filedata in database was someone how deleted.Lucky i had backups and it was just as simple and as to restore it.
Reply With Quote
  #12  
Old 09-21-2015, 12:57 PM
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
Posts: 969
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by puertoblack2003 View Post
I had the same issue, but with my issue was the filedata in database was someone how deleted.Lucky i had backups and it was just as simple and as to restore it.
That's what happens with this bug, is that the filedata, and filecontent, get deleted. You were lucky and had a backup to go back to.

--------------- Added [DATE]1442848959[/DATE] at [TIME]1442848959[/TIME] ---------------

Quote:
Originally Posted by RichieBoy67 View Post
How did you fix this?
You'd want to run a script that goes through each non-zero refcount filedata and looks in the corresponding table(s) to determine the actual usage count for the filedata.

I tried to post a bit of sample code but vb.org kept hanging when I hit post.
Reply With Quote
Благодарность от:
RichieBoy67
  #13  
Old 09-28-2015, 08:02 AM
dariyos dariyos is offline
 
Join Date: Nov 2011
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

first step:

uncomment /includes/cron/cleanup2.php
Code:
// Unused filedata is removed after one hour
//$attachdata =& datamanager_init('Filedata', $vbulletin, ERRTYPE_SILENT, 'attachment');
//$attachdata->set_condition("fd.refcount = 0 AND fd.dateline < " . (TIMENOW - 3600));
//$attachdata->delete(true, false);
2) restore a old DB in a testforum
3) search for all entrys where the attachments was assigned a post with this query:

SELECT * FROM post a, attachment b, filedata c WHERE c.refcount =0 AND a.postid = b.contentid AND b.filedataid = c.filedataid

3) Update the refcount value from 0 to 1.
4) Search for the newest IDs from the tables (testforum):
-post
-attachment
-filedata
-thread

5) Search for the IDs (in acutal DB) bigger (>) than the IDs from testforum in:
-post
-attachment
-filedata
-thread

6) export the "new" entrys (bigger (>) than newest ids from testforum) from these tables.

8) Import the new entrys in testforum.

then you have all the entrys from old database and new database mixed and the right refcount value.

9) export the mixed tables
-post
-attachment
-filedata
-thread
from testforum

10) import it to actual db.
11) upload all deleted files in your filesystem


BACKUP FIRST, IF SOMETHING WENT WRONG!
Reply With Quote
Благодарность от:
RichieBoy67
  #14  
Old 09-28-2015, 01:56 PM
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
Posts: 969
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The above is not complete as it will only check post attachments. There are other content types that can be stored in the filedata table which might be where the filedata is actually being used. Albums are one that comes to mind, but potentially any mod you have that allows uploads might have added a new content type.
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 09:34 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.03635 seconds
  • Memory Usage 2,204KB
  • Queries Executed 11 (?)
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
  • (1)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
  • (4)post_thanks_box
  • (2)post_thanks_box_bit
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete