1

I am rebuilding a current site from scratch and I've rebuilt the file upload directories and migrated all of the previous uploads over but now, the path variable in my links references the upload directory ID of my previous installation. Before, it was...

{filedir_8}

and now, it's...

{filedir_2}

I am using WYGWAM v.2.7 and EE v.2.5.5. I am using CKFinder for the upload manager.

Any recommendations to correcting this? I know I could develop some sort of SQL query, but I am hoping there is another way.

Thanks for your help!

1 Answer 1

2

The simplest thing to do would be to go into your new database and manually change the IDs of your upload directories in exp_upload_prefs to match your old site. Use phpMyAdmin to do this if it's installed on your server.

(This is assuming, of course, that you haven't made a bunch of new associations with the new directory ID since migrating.)

UPDATE: Alternately, you can do a find and replace on each Wygwam field via SQL:

UPDATE exp_channel_data SET field_id_XX = REPLACE(field_id_XX,'filedir_8','filedir_2');

Do this for each Wygwam field, replacing field_id_XX with the actual id for that field.

3
  • Would there be a way to have the query JUST give me results from Wygwam fields? I am kinda floored that there isn't a script that auto-runs to re-map these when you change the file upload directory in the Wygwam editor configuration?
    – Jacob Graf
    Commented Apr 15, 2013 at 19:14
  • Not sure I understand your question? My answer directly changes {filedir_8} so it points to your new directory (initally named {filedir_2}, now {filedir_8}.) Re: lack of remapping - I imagine that it's because you can link to file in any upload directory you like - just because you change directory for CK Finder doesn't mean that all your past uploads are in this new directory. Commented Apr 15, 2013 at 19:40
  • Just appended my answer with a query to find/replace the references in your fields. Commented Apr 15, 2013 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.