Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hi guys,

here is my question today:
I have a website on a preview server and the blog has some embedded images.

Once I moved the website on the new server with the gen_dump.php every link updated, images, files etc but the ones embedded in the richtext. There is a massive number of these images os I was wondering if there is a way (even manipulating the DB which I'm requesting the access to right now) to change them all in one.

Thanks
Hi Emanuele,

As you noticed, Couch takes care of changed path for images within 'image' and 'file' editable regions. However, images embedded directly within CKEditor retain their original links (CKEditor insists on saving the full path - would have been good if it saved only relative paths).

Anyways, this is what seems to be the preferred way of handling this problem -
1. As usual, begin the migration by creating a database dump of your test site using gen_dump.php.
2. The dump is a plain text file. Before uploading it to the new server, open it up in any text editor (Notepad++ or Textpad work well for me on Windows).
3. Use 'Find and Replace' (could be known as something different in your editor but the function will be there) to replace all explicit links to your test site with that of the new site
e.g. find the string http://www.testsite.com/ and replace it with http://www.livesite.com/. This is a single-step procedure and will modify all the local links.
4. Finally, continue with the migration by uploading this modified dump file to the live server and following the usual steps (http://www.couchcms.com/docs/miscellane ... erver.html)

The steps outlined above should be taken before migrating the site. In your case, the migration is already complete. So what you can do now is re-install the site.
Don't worry you won't have to upload all files again. We'll modify the existing live site.

Before taking the steps below, make sure to generate and modify the dump file as outlined above so that the links now are all correct. First upload this modified dump file to your server's couch folder. It will be used in the re-installation that follows.

Now edit the config.php file on your live site.
Find the following lines in it:
// 7b.
// Needed only if multiple instances of this CMS are to be installed in the same database
// (please use only alphanumeric characters or underscore (NO hyphen) )
define( 'K_DB_TABLES_PREFIX', '' );

Add some prefix to the declaration e.g.
define( 'K_DB_TABLES_PREFIX', 'new_' );

Access your site and since no tables with the prefix we specified exist in the database, Couch will assume we are installing the site and will prompt you for the super-admin creds etc. to do a fresh installation.
This time, however, it will use the modified dump file with the correct links.

As for the original installation, it will still be in the database as the unprefixed tables. You can choose to delete those tables once you have access to the database or maybe just ignore them.

Hope this helps.
2 posts Page 1 of 1