Cannot convert from DB to FS

Project:ProjectPier
Version:0.8.6-stable
Component:Code
Category:bug report
Priority:critical
Assigned:phpfreak
Status:patch - code needs review
Description

I needed to convert the file storage engine from Mysql to Filesystem but that's not working with the blob2fs.php I found at http://www.activecollab.com/files/blob2fs.php.zip

Here's the error I get:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/project/upload/blob2fs.php on line 31

Converting is really important because projectpier doesn't move the files from db to fs when its changed from projectpier configurations. And by the time I realized that mysql storage engine is not for me, its too late to move to FS as old uploaded files have stopped working!

#1

Can someone please check it out?

#2
Assigned to:Visitor» phpfreak
Status:new» open - assigned

I will have a look this weekend.

#3

Thank you.

#6
Status:open - assigned» patch - code needs review

Here is the patched code. The basic problem was that TABLE_PREFIX is not defined in the config file anymore. I also removed the activecollab reference, renamed blob to db and added some error handling.

Can you try this?

AttachmentSize
db2fs.zip 1.22 KB
#7

Just did.
It seemed to be working for each file but failed to covert. Below is the error:

Warning: file_put_contents(/home/project/upload/fad1de7/c6sd8ba/7ad/) [function.file-put-contents]: failed to open stream: Is a directory in /home/project/upload/db2fs.php on line 67
Converting files. Please wait ...

Thank you.

#8

My bad, forgot to rename a few blob references.

Try again please.

AttachmentSize
db2fs.zip 1.24 KB
#9

It now gives the message "Files have been converted" without any errors but I see the script is not performing individual convert reloads which I noticed it was trying to perform earlier.

I did check the old files uploaded in db and they are giving the same error, when their download is attempted.

Thanks.

#10

Any way of sharing a (zipped) copy of your database with me? Or the tables that have to do with files?

That way I can investigate.

#13

Is there a script to do the opposite, that is move files from filesystem to database?