Change from full url to not, now need to fix the data

6 posts by 3 authors in: Forums > CMS Builder
Last Post: January 8, 2010   (RSS)

Hi,

Due to the need to be able to switch back and forth between secure and non-secure mode, plus not wanting my images within posts to reference the development area, I need to turn off the "Save full URL for local links..." option in the General Settings.

Of course, this information is already saved in the database...all over the place and within content.

Do you have any suggestions as to how I can fix the data that resides in many different tables and in many different records within those tables to eliminate the use of the now pseudo hard-coded paths in the data?

I'm mainly dealing with pictures as a problem, so I can even limit my "fix" to just <img tags within the data.

Thanks,
Gary.

Re: [garyhoffmann] Change from full url to not, now need to fix the data

By Chris - January 7, 2010

Hi Gary,

That's not an easy problem to fix. The simple solution, of course, is to recreate all your records and uploads -- but that may be ridiculously time-consuming. :(

A more complicated solution would be to write a PHP script which scans through your records with a regular expression, updating URLs it finds. If you can give me some examples of fields which need to be changed (and what they should be changed to), as well as a list of fields, I could get you started with a script and a regexp. Note that this approach might involve lots of backups, testing, and back-and-forth.

Alternately, we could fix this for you through consulting. Please let me know if this is something you might be interested in.

I hope this helps!
All the best,
Chris

Re: [chris] Change from full url to not, now need to fix the data

By Damon - January 7, 2010

Another option is to backup your database, download it, open your database in a text editor and carefully do a search and replace. Then upload it again and restore.

Make sure you keep and back up of your backup!
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Change from full url to not, now need to fix the data

By Chris - January 7, 2010

Wow, that's much simpler! Kudos, Damon!
All the best,
Chris

Re: [garyhoffmann] Change from full url to not, now need to fix the data

By Chris - January 8, 2010

Best of luck! Please let us know how it goes. :)
All the best,
Chris