4 replies [Last post]
peach's picture
Offline
Joined: 01/30/2009
Juice: 67
Was this information Helpful?

I've had similar problems a few times before, but back then I just restored from backup and it worked again.

This time when I restore these tables, or even the whole database to any backup that was working perfectly before: Ubercart keeps refusing file downloads and when editing nodes and their features ubercart will completely wipe out the tables that I mentioned in the title.

I heard of this problem this afternoon when clients started emailing me they keep getting this message when trying to download:

"The following URL is not a valid download link. Please contact the site administrator if this message has been received in error."

The problems are 99% sure caused by what I did yesterday night:

1. Update a file download file in the secure files folder ( /tmp/securefiles/myfolder)
2. Change permissions back to 444 by doing "chmod -R 444 myfolder"

Normally after I update file downloads I do "chmod 444 *" when in the myfolder path. This time I recursively set the permissions on the folder itself, thus also affecting all files inside the folder.

I dont know why I think I abadoned my routine and changed permissions on the folder instead of the files but it seems this really upset the system. Any idea why??

peach's picture
Offline
Joined: 01/30/2009
Juice: 67
Re: urgent: Ubercart keeps clearing out uc_files_products and uc

Ok its fixed. Its funny how I always come with a solution after I write an elaborate post about my problem. the writing requires you to step out of panic mode and you think more clearly I guess.

The tricky thing is that this didn't work:
Trying to undo the chmod -R by setting it to what I thought could be the default settings.

What did work.
1. copying the files from "myfolder" to another, temporary place
2. deleting the "myfolder"
3. re-creating the "myfolder". Now is has the proper permissions
4. putting the files back from the temporary folder to the new "myfolder" aka the secure folder

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: urgent: Ubercart keeps clearing out uc_files_products an

Yep, this is a permissions issue, as you discovered. One problem I have is that uc_file.module re-reads your "myfolder" (whatever is configured for your files base path) every time you add a new file product feature. It basically scrapes the directory and its children for new files.

The one issue you might want to watch out for is that now your pfid (product feature id) and fid (file id) in uc_files and uc_file_products has changed, and may not match up to what people already have as displayed in uc_file_users. The only way around this would be to restore an old version of those two tables from a backup, or to run a SQL script that can correct them for you. I had to do this one time (after our D5->D6 upgrade, of all things) and I was able to do it after an hour of finding all of the changed values and what their old values were.

It's a messy thing but I would make sure your site wasn't also affected in this way.

See my issue on d.o. here: http://drupal.org/node/647248

--
Help directly fund development: Donate via PayPal!

royerd's picture
Offline
Joined: 01/22/2008
Juice: 293
Re: Re: Re: urgent: Ubercart keeps clearing out uc_files_product

This has happened to me twice this week: "random" file downloads disappearing and the records within the tables just disappear. I've wondered if it was related to one of the file id's not having its proper sequence set in the sequence table. But what you say there Torgos helps me understand what might be going on. What other conditions would cause those tables to update after the "scrape" as you say?

thanks for all that you've done for Ubercart.

royerd's picture
Offline
Joined: 01/22/2008
Juice: 293
Re: Re: urgent: Ubercart keeps clearing out uc_files_products an

Have you had this trouble again? I don't see how it's a permissions issue really. Why would it work for months and then all of a sudden throw out large sets of records from the uc_file_users table? I think it' might have to do with sequences being off between the relevant uc tables and the sequence table and that when some activity in the folder scrapes the folder again, it resets the table and loses the file. Vague, but that seems like what's going on? I lost 7K file records the other day. Was able to restore, but scary. I wish I knew what was going on.