Please test it on a test installation - your vanilla 1 installation won't get any changes, but the table "media" and the Folder "upload/FileUpload" of Vanilla2 will.
Be sure to have enoght writing permissions on Vanilla 2 root/upload/FileUpload - this will be checked by the script, but see "What should be done"-section in this post.
Would be good to get bug reports, if there are still bugs.
On Monday I will clean up the code a little bit and put helpful comments in.
= What isn't working yet = Export the Attachments form one database host to another. Your vanilla 1 and vanilla 2 databases have to be on the same server, but can be in different tables. After enable export database to remote database host you could port your files and stuff from one server to another.
= What should be done = Divide Database Work from File Work - because errors on file porting things will lead to copy database again!
I'm trying to give possibility to have a testrun without changing anything - but seams much more difficult than I thought - because the file-stuff needs information of the new database that sould be build before...
Not ready yet: Export from one database host to another
@vegano: Thanks for the update. My server supports uppercase table names, so it was failing to find the tables. So I changed "attachment" on line 554 to "Attachment", and "media" on line 571 to "Media" and it got further.
Then it gave me an error that it couldn't find the files, and I realised I had entered the wrong directory. I had entered the plugin directory, not the upload directory. I suggest changing line 428 to:
Thanks @SubJunk - took all the improvements you suggested.
Hm - strange - you should only come to the "everythings done" page if things are right - my I messed things by working on the testrun feature - i will check this.
Please run the testrun und check what is displayed. You will see what SQL query will be run.
Oh - ok, I think I know, what happens:
the "-2" Database Lines meens, that there are two wrong statements of SQL - so no SQL export was done - and because database is empty no file export is possible
So I have to check the error handling on the database thing.
Please run the testrun and post results here or try to figure out whats wrong on your own and share your recognition
@SubJunk - is it working for you now. If yes - I will take your alpha3 and try to clean up the code a little.
Has one of you guys a idea how to make the Testrun a good thing.
And the export form one database host to another is still unsolved- I even don't know what will happen, if someone tryes to do so - but... there can't be much happen
@vegano: Sorry, I had forgotten to reply. alpha3 works but I have around 10,000 attachments on the forum I was testing so the script times out. I will try it on a forum with less attachments to confirm it is all working.
@SubJunk Moreso in the sense of deciding how to package it in the context of the exporter/importer. Dealing with files was left as a big question mark between Todd and I when we last discussed adding functionality.
@Lincoln: Ah I see now. Maybe it would make sense for it to be included with the FileUpload extension, so that in the Dashboard settings it offers the option. But then maybe they would have deleted the old database after the main export, so yeah maybe it would be best to integrate it with the official tool.
Yeah - would be great if @Todd can get benefit of the code rayk and I build.
@Todd if you need more documentation or stuff, I will try to help.
I have tried to take as many source snipped of the official exporter as I could need - but as I am not a PHP expert many parts of the code are way from best practice.
I've just modified the exporter so that Vanilla 1 exports will export the data for file attachments and then you can just copy the contents of your /uploads folder to your new installation. I'll post back here when everything is uploaded.
Comments
Here is the alpha: http://gist.github.com/629919#file_attachments2_file_upload_0_1_alpha.php
Please test it on a test installation - your vanilla 1 installation won't get any changes, but the table "media" and the Folder "upload/FileUpload" of Vanilla2 will.
Be sure to have enoght writing permissions on Vanilla 2 root/upload/FileUpload - this will be checked by the script, but see "What should be done"-section in this post.
Would be good to get bug reports, if there are still bugs.
On Monday I will clean up the code a little bit and put helpful comments in.
= What isn't working yet =
Export the Attachments form one database host to another. Your vanilla 1 and vanilla 2 databases have to be on the same server, but can be in different tables.
After enable export database to remote database host you could port your files and stuff from one server to another.
= What should be done =
Divide Database Work from File Work - because errors on file porting things will lead to copy database again!
PHP Parse error: syntax error, unexpected T_STRING on line 25
please try again:
http://gist.github.com/629919#file_attachments2_file_upload_0_1_alpha2.php
I'm trying to give possibility to have a testrun without changing anything - but seams much more difficult than I thought - because the file-stuff needs information of the new database that sould be build before...
Not ready yet: Export from one database host to another
My server supports uppercase table names, so it was failing to find the tables.
So I changed "attachment" on line 554 to "Attachment", and "media" on line 571 to "Media" and it got further.
Then it gave me an error that it couldn't find the files, and I realised I had entered the wrong directory.
I had entered the plugin directory, not the upload directory.
I suggest changing line 428 to:
<label>Attachment Uploads Path <span>your Attachment plugin's upload directory (absolute path)<br />Example:<br /><strong>/home/site/public_html/forumdirectory/uploads</strong></span></label>
and line 457 to:
<label>FileUpload Uploads Path <span>your FileUpload plugin's upload directory (absolute path)<br />Example:<br /><strong>/home/site/public_html/forumdirectory/uploads/FileUpload</strong></span></label>
Also if you remove line 89 the labels will have more room.
So anyway, I did it properly I think and it takes me to the finish page but nothing happened. It gives me the message:
Everythings done - you are ready now -2 Database Lines exported 0 Files exported
Despite there being a lot of attachments.
Hm - strange - you should only come to the "everythings done" page if things are right - my I messed things by working on the testrun feature - i will check this.
Please run the testrun und check what is displayed.
You will see what SQL query will be run.
Oh - ok, I think I know, what happens:
the "-2" Database Lines meens, that there are two wrong statements of SQL - so no SQL export was done - and because database is empty no file export is possible
So I have to check the error handling on the database thing.
Please run the testrun and post results here or try to figure out whats wrong on your own and share your recognition
Load new from http://gist.github.com/629919#file_attachments2_file_upload_0_1_alpha2.php
I have found and fixed some bugs, I uploaded an updated file to http://www.spirton.com/uploads/Attachments2FileUploadAlpha3/Attachments2FileUpload-0-1-alpha3.zip
If yes - I will take your alpha3 and try to clean up the code a little.
Has one of you guys a idea how to make the Testrun a good thing.
And the export form one database host to another is still unsolved- I even don't know what will happen, if someone tryes to do so - but... there can't be much happen
alpha3 works but I have around 10,000 attachments on the forum I was testing so the script times out. I will try it on a forum with less attachments to confirm it is all working.
Maybe it would make sense for it to be included with the FileUpload extension, so that in the Dashboard settings it offers the option.
But then maybe they would have deleted the old database after the main export, so yeah maybe it would be best to integrate it with the official tool.
Vanilla Forums COO [GitHub, Twitter, About.me]
@Todd if you need more documentation or stuff, I will try to help.
I have tried to take as many source snipped of the official exporter as I could need - but as I am not a PHP expert many parts of the code are way from best practice.
/uploads
folder to your new installation. I'll post back here when everything is uploaded.Thanks so much for your work on this guys.