VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: GooRu on November 21, 2012, 02:33:57 AM

Title: Moved servers, media files have old path
Post by: GooRu on November 21, 2012, 02:33:57 AM
Hi...

I developed a site on my servers with downloadable products and everything tested well. I moved to the new server and now the media files that were associated with the downloads still have the old path in it. How can I can change it to the new?
Title: Re: Moved servers, media files have old path
Post by: moe455 on February 04, 2015, 05:48:24 AM
I know this is an old post however I have just experienced the same thing. I check the Template safe path and it is correct however when a customer purchases a downloadable product the error message received states a different path. It happens to be the path that was on the old server. Is there a setting or cache that has to be set/reset?
Also I noticed that the product ID did not lign up with the product in the database. Here is the message I received after purchasing a downloadable product via PayPal and clicking on the download link in the invoice.

"Media file is not available (ID=68, path=/home/oldhost/vmfiles/in-him.mp3)"

Can someone please advise?

VirtueMart 2.6.14
PHP - 5.3.29
Joomla - Joomla! 2.5.14
Title: Re: Moved servers, media files have old path
Post by: jenkinhill on February 04, 2015, 11:33:02 AM
Use phpMyAdmin to check the product paths in the database.
Title: Re: Moved servers, media files have old path
Post by: Milbo on February 04, 2015, 11:44:19 AM
As far as I know, just edit your safepath and it should still work.
Title: Re: Moved servers, media files have old path
Post by: moe455 on February 04, 2015, 12:39:11 PM
Milbo, I tried to change the safepath but got an error when I did, so I left it the same as the Global Config server setting for the Temp file with the suffix of vmfiles/ in stead of temp/

Jenkinhill, I looked in the virtumart_medias table and noticed that the path is incorrect in the field "file_url". It states "/home/oldhost/vmfiles/in-him.mp3". I take it that I will have to manually update this field in all the products. Its a variable - varchar(900) - so I guess there is no other place to update it. I will also try to re upload the mp3 file and see if that fixes the path.

Thanks
Title: Re: Moved servers, media files have old path
Post by: Milbo on February 04, 2015, 12:49:27 PM
You must set the safepath to your new correct path. then you must copy the files into your new path of course.

Then it should work, because I rewrote it so, that it just takes the filename and tries it with the new safepath. Could be also interesting to provide a slq here. I could also add a tool for it.
Title: Re: Moved servers, media files have old path
Post by: jenkinhill on February 04, 2015, 13:06:19 PM
Yes you will have to update the fields in the db. If you have a lot of products you could do it using SQL, or export a copy of the table and do a search and replace for oldhost/newhost then reimport. I alwayus take a backup copy of a db before making any edits.
Title: Re: Moved servers, media files have old path
Post by: moe455 on February 04, 2015, 13:10:13 PM
Yes Milbo I have the files in the location of the new correct path. Any new product I upload works ok as the file_url in the table is updated with the new path. All the existing products still have the old path pre the migration. So I take it that by changing the safepath the products field "file_url" does not get updated. I'll try and remove the path and just leave the filename to see if it works.
Title: Re: Moved servers, media files have old path
Post by: moe455 on February 04, 2015, 13:20:15 PM
Thanks Kelvyn, I don't have that many so a manual change is ok.

Rather than me purchasing the item again so I can test the path change, is there a counter somewhere that is incremented each time I download a paid product? I just want to click on the same invoice link of the same purchase for testing purposes.
Title: Re: Moved servers, media files have old path
Post by: jenkinhill on February 04, 2015, 13:41:17 PM
I have no idea. I'd guess some d/l plugins could do that, but none of the sites I have worked on are for downloadable products.
Title: Re: Moved servers, media files have old path
Post by: Milbo on February 04, 2015, 13:44:47 PM
In case you are using the virtual shipment plugin of istraxx, I can help you. If you are using another download software you must ask there.