VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: bunglehaze on May 27, 2014, 19:49:14 PM

Title: db crash and now images are on wrong products
Post by: bunglehaze on May 27, 2014, 19:49:14 PM
HI guys, I had a server/db outage yesterday and when it came back up again I have none of the product images linked to the products at all - they are all "no image available"

I have done the usual, repair and optimise db, backend of VM click tools and synchronise images but nothing has worked. I looked in the db and the product_media table seems to be the same as the last backup I managed to take though so I cannot see where the links between the product and the images in the products/categories folder etc is made.

The only thing that I can now see to change this is to go through each product and upload a new image manually which is really not something I wish to be doing.

Any other tips on where the product and image is linked up in the db so I can try and put this right again? It seems a very weak system if it can lose product images through a crash.
Title: Re: db crash and now images are on wrong products
Post by: GJC Web Design on May 27, 2014, 20:35:34 PM
the images are linked to products in  `jos_virtuemart_product_medias`
Title: Re: db crash and now images are on wrong products
Post by: bunglehaze on May 27, 2014, 22:52:07 PM
Hi GJC, that's what I thought. Something must be screwy with my VM2 if that is the case as I have used a slightly older backup with the SQL intact, emptied the table and then run the query to restore the data but the situation is still the same. To be honest it has me baffled as I know VM2 well enough to work this out but every avenue I explore seems to lead nowhere..

Is there any other place that the images are sym linked?
Title: Re: db crash and now images are on wrong products
Post by: GJC Web Design on May 27, 2014, 23:01:50 PM
nope - even multiple images for one product are held there  - just with a different order id
Title: Re: db crash and now images are on wrong products
Post by: bunglehaze on May 27, 2014, 23:31:36 PM
Very strange indeed... Well I guess all I can do is re-upload each image for each product again (yet another thing that has gone wrong with VM2 for me)
Title: Re: db crash and now images are on wrong products
Post by: GJC Web Design on May 27, 2014, 23:41:10 PM
what is in the jos_virtuemart_product_medias table?

if the imgs are on the server and entered in the media table wouldn't a manual edit of the jos_virtuemart_product_medias be quicker?
Title: Re: db crash and now images are on wrong products
Post by: bunglehaze on May 31, 2014, 01:09:29 AM
I ended up just reuploading them all, the images were there and there were numbers in the jos_virtuemart_product_medias table but from what I could tell there were not enough associations and the ones I checked were not linking to the right product id's.

It took a few hours but needed doing
Title: Re: db crash and now images are on wrong products
Post by: AH on May 31, 2014, 13:06:32 PM
Not sure why shop owners never expect stuff to go wrong and then have nothing in place to resolve an issue

On the premise that you probably don't add products everyday

I recommend an automated database backup strategy

Use a cron job to backup and archive the database

Akeeba can be used to achieve this and can archive the backup to your preferred location

Note that I recommend a database backup only on this frequency

At least minimum of daily is a useful place to start
Title: Re: db crash and now images are on wrong products
Post by: jenkinhill on May 31, 2014, 13:35:45 PM
I definitely agree with this. Regular backups are an important part of maintaining a business. My host runs a full backup of every site, including all mail on the site at that time. They do this every 6 hours. The backups are stored off site at another datacenter and kept for a minimum of 2 weeks. They are exact mirror copies so restoration is accurate and for an average site takes about 5 minutes.

Add in my weekly Akeeba backups stored in my office and on dropbox and I have most possibilities covered.
Title: Re: db crash and now images are on wrong products
Post by: bunglehaze on June 02, 2014, 12:26:23 PM
Quote from: Hutson on May 31, 2014, 13:06:32 PM
Not sure why shop owners never expect stuff to go wrong and then have nothing in place to resolve an issue

On the premise that you probably don't add products everyday

I recommend an automated database backup strategy

Use a cron job to backup and archive the database

Akeeba can be used to achieve this and can archive the backup to your preferred location

Note that I recommend a database backup only on this frequency

At least minimum of daily is a useful place to start

Honestly, the reason for not having a backup was that I had just finished adding a load of new products and images when the crash happened so in this case I had not had a chance to do a backup of the new changes. That being said I understand the sentiment, orders could have been manually sorted out if I needed to restore and old backup (which I had done on a test domain, with the exact same problem returning again)

I don't understand the way the images are linked up though in the db, it is not as though the image name was listed anywhere I could see and numbers mean nothing when you are trying to fix an issue like this - surely using image names would be a much more robust system?
Title: Re: db crash and now images are on wrong products
Post by: AH on June 02, 2014, 13:08:01 PM
The image is listed in the

db_virtuemart_medias

and linked in

db_virtuemart_product_medias

Title: Re: db crash and now images are on wrong products
Post by: bunglehaze on June 02, 2014, 13:10:32 PM
Aah, that's what I had asked for but only saw the product_medias table. That makes much more sense now, thanks
Title: Re: db crash and now images are on wrong products
Post by: AH on June 02, 2014, 13:11:26 PM
 8)