Register Arama Bugünkü Mesajlar Mark Forums Read

Reply
 
Thread Tools
Missing Attachments After Upgrading to VB 4.2.3 Fix
vB.Org Poster
vB.Org Poster has disabled reputation
Kayıt Tarihi: Jul 2018
Mesajlar: 298

Show Printable Version Email this Page
Makale: vBulletin 4 Makaleleri, yazar vB.Org Poster 10 Jul 2018, 10:24

NOTE: If you have downloaded vBulletin 4.2.3 files on or after July 5, 2016 you are not at risk of losing attachments as described below.

----

It has come to my attention that a bug fixed in VB 4.2.3 will in some cases cause the loss of some attachments on forums, particularly it seems older forums. The issue happens because the software deletes attachments it believes are no longer in use.

Anyone upgrading directly to 4.2.4 Beta 1 or above will not be affected.

Unfortunately many admins don't notice this right away, it might be weeks or months and by that time restoring to a pre-upgrade backup is not possible.

This fix requires a pre-upgrade backup of the database AND attachments (if saved in the file system) are available. Without the backup of both the database and attachments files there is no way to get back the deleted attachments.

There may well be better ways of doing this, I'm not claiming it is the best way, but I successfully used this to restore one site's attachments so I know it works.

Note: The database commands listed later assume no table prefix is in use. If you use a table prefix you will need to make appropriate changes to the code to account for the table prefixes.

Before starting make sure you take a fresh backup of your current database and files in case something goes wrong. This code is not officially supported, it is use at your own risk. There is no supported way to restore your old attachments.

From this point "old" refers to the old pre-4.2.3 backup. "New" refers to your live site.

1) Copy over the old attachment files over the new ones. Attachments shouldn't ever change so you'll overwrite a number of files but the deleted ones will return to their original locations. The new ones won't be affected. (If attachments are stored in the database skip this step.)

2) From your old backup export the following tables to individual .SQL files
  • attachment
  • attachmentcategoryuser
  • filedata

3) Edit each SQL file in a text editor. At the top of each file is a "CREATE TABLE" block of code, delete the entire block. Will look something like-


Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

But varies for each file.

Next Do a find / replace for the entire file.

Find: INSERT INTO
Replace With: INSERT IGNORE INTO

Then save the .SQL file. (Again you need to do this for all 3 files)

4) Now go to your live database and IMPORT each of the 3 files into your live database.

The "INSERT IGNORE INTO" commands will just discard any duplicate (existing) entries without error. All the deleted records will be restored.

5) RUN that MySQL command to fix the bug:


Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

6) Now go to the old database, go to the post table. Run the command:

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

Export the results of this command as a CSV File.

7) Open the CSV file in a spreadsheet program like Microsoft Excel. In the speadsheet add a column before the attach list, add a column between attach and postid.

In the first column add the text:

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

And copy it to boxes in the column, as far down as there is data.

In the middle column (between attach and postid) add the text:

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

Then copy this text to all rows like above.

Finally in a column to the right of the postid column add the text:

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

And again, copy this text to all columns.

When finished it will look something like this:
Attachment 154706

8) Export or Save the document again as a CSV file.

9) Open the new CSV file in a text editor. You're going to need to use find/replace to remove the commas and double quotes (if they exist) replace them all with spaces.

It's going to look something like this:
Attachment 154705

Save this now as a .SQL file.

10) Import the file to the live database. This should update any old posts that used to have attachments recorded that don't anymore. Nothing else will change in the post but the # of attachments. If the post has at least one attachment already it won't be touched.

That should do it.

One more step- to see the changes immediately the post cache must be cleared so EMPTY the postparsed table in the database. That will clear the the post cache so changes to cached posts are visible.

In the Admin CP -> Maintenance, run the Clear System Cache option as well.

Also in Maintenance, go to General Update Tools, and Rebuild Thread Information, followed by Rebuild Forum Information.
Views: 16
Reply With Quote
Reply

Thread Tools

Şunları Yapabilirsin
Yeni Konu Açmak
Konuya Cevap Yazmak
Eklenti Eklemek
Düzenleme Yapabilmek

Forum Atla


New To Site? Need Help?

All times are GMT +3. The time now is 15:43.

Tasarım Özelliği | Genişlik: Geniş Renk: Missing Attachments After Upgrading to VB 4.2.3 Fix Missing Attachments After Upgrading to VB 4.2.3 Fix Missing Attachments After Upgrading to VB 4.2.3 Fix Missing Attachments After Upgrading to VB 4.2.3 Fix Missing Attachments After Upgrading to VB 4.2.3 Fix