Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 14 Sep 2015, 08:58
dariyos dariyos is offline
 
Join Date: Nov 2011
Attachments have been deleted vb 4.2.3

Hello,

wrong uploaded attachments have been deleted and will delete in future and I don't know why.
Over 12.000 Files in Filesystem and Database deleted already!

An attachment from friday is also deleted.

you can see here in post #3:

http://www.sps-forum.de/codesys-und-...rittkette.html

It shows only the text:

Attachment (ID)

I know, that the attachments will be delete automatically (after upgrading to vb 4.2.3), when the refcount value of filedata entry is null - but I don't know why so many files had the refcount value 0, and why I get more "wrong uploaded attachments".

maybe there are problems with the filemanager since the upgrade?

today I will correct the values from an older Database, and copy the entrys to the actual database and upload the attachments from an backup, again.

I don't want that they will be delete in the future and get the wrong refcount value.

How is it possible to upload an attachment WRONG, that it get the value 0 and be deleted?

I don't have any Image/Attachment-Upload Plugins installed ...

What can be the issue?

PHP 5.4.42-nmm1
Mysql Version 5.6.24-nmm1-log
vb 4.2.3

Last edited by dariyos; 14 Sep 2015 at 09:24.
Reply With Quote
  #2  
Old 14 Sep 2015, 16:28
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
See my posts in http://www.vbulletin.org/forum/showthread.php?t=319394

Basically, it is or was possible to incorrectly attach attachments, but due to a bug in vb they weren't deleted. That bug was fixed in vb4.2.3 and following that all the incorrectly attached attachments started getting deleted.
Reply With Quote
  #3  
Old 15 Sep 2015, 02:15
dariyos dariyos is offline
 
Join Date: Nov 2011
I dont think that I had 12,000 incorrect attached attachments from 22,000 total attachments...
Reply With Quote
  #4  
Old 15 Sep 2015, 04:49
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Real name: Richie
I just noticed the same issue on my site though I am not sure if related to that. I know that when I ran an update counter I saw attachments being removed so I stopped it. I am not sure how many attachments I lost but mostly very, very old ones.

I can still see the attachments in the database though the id is missing. I replace the id from a back up and the attachment still does not show so I am assuming the files were deleted as well. Is this possible? Would the counter delete the attachment file or is there another reason the attachment would not show when all the data is there in the attachment table?
__________________

Let us take care of your forum, seo, seo reports, maintenance, what ever you need.

Reply With Quote
  #5  
Old 15 Sep 2015, 04:59
dariyos dariyos is offline
 
Join Date: Nov 2011
I think it is a big bug!
Can't resore the attachments, most of the attachments were online, 1 month ago.

this update deletes all attachments when the refcount value is 0 from the file system and the entries in the database. (I don't know how 12,000 files can get this value)

I stopped the cleanup2.php script now, but its to late.

It is not possible to restore the files, you need all files and entries from database, too.

you have informations about attachments in the tables
- post
- thread
- attachment
- filedata

Ich have backups from all, database and filesystem, but for me it is not possible to restore all attachments.
Reply With Quote
  #6  
Old 15 Sep 2015, 09:38
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Real name: Richie
Yes, in my case I think I may just be missing the filedata data.
__________________

Let us take care of your forum, seo, seo reports, maintenance, what ever you need.

Reply With Quote
  #7  
Old 16 Sep 2015, 01:58
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Real name: Zachery Woods
If refcount is 0, the attachment is not being used, and should be removed.
__________________
Looking for ImpEx?
Reply With Quote
  #8  
Old 16 Sep 2015, 02:33
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
 
Join Date: Sep 2008
Real name: Michael Miller Jr
^ What Zachery is trying to convey is that, if the refcount is zero it means that the attachment is not being referenced i.e. used in any posts therefor it deletes them due to that fact alone. Why retain an old attachment (especially if storing attachments in filesystem which takes up more disk space) if its not being called by a page/post? It's basically like leaving tons of old recipes in your cook book despite having a new version on your tablet at a touch of a finger... in a sense if you followed my odd analogy lol! The script (update counter) is doing what it needs to do, if however something is in fact very odd about your attachments this might be something unrelated entirely or if related perhaps an issue with your single site alone, that we're unsure of so we cannot comment regarding that only what we know it should be doing.
__________________
Daddy Does Dios and Figs!
https://www.linkedin.com/in/thelastsuperman

Search - Use the search feature to find similar issues/answers.
Information - Include screenshots, copy/pasted error codes, url etc.
Fixed - Please return to your thread/post and let us know how it was fixed!
Thanks - For participating! Click the "Like" on a post if someone helped you!
Reply With Quote
  #9  
Old 18 Sep 2015, 08:39
dariyos dariyos is offline
 
Join Date: Nov 2011
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.
Reply With Quote
  #10  
Old 18 Sep 2015, 11:01
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Real name: Richie
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.
How did you fix this?
__________________

Let us take care of your forum, seo, seo reports, maintenance, what ever you need.

Reply With Quote
  #11  
Old 19 Sep 2015, 05:30
puertoblack2003's Avatar
puertoblack2003 puertoblack2003 is offline
 
Join Date: Aug 2005
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.
__________________
Android Custom Creations
Reply With Quote
  #12  
Old 21 Sep 2015, 15:57
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
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 21 Sep 2015 at 16:22 ---------------

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
  #13  
Old 28 Sep 2015, 11:02
dariyos dariyos is offline
 
Join Date: Nov 2011
first step:

uncomment /includes/cron/cleanup2.php

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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
  #14  
Old 28 Sep 2015, 16:56
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
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



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 01:44.

Layout Options | Width: Wide Color: