<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="http://old.atsmath.com/taxonomy/term/7/all" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Code snippets</title>
    <link>http://old.atsmath.com/taxonomy/term/7/all</link>
    <description></description>
    <language>en</language>
          <item>
    <title>MySQL Search and Replace</title>
    <link>http://old.atsmath.com/blog/mysql-search-and-replace</link>
    <description>&lt;p&gt;I&#039;ve recently been moving a drupal site from one hosting environment to another, and the folder structure between the two within Drupal&#039;s &lt;em&gt;sites/&lt;/em&gt; is not identical. The main headache I was having was getting all nodes containing attached files and images to display properly. The Drupal &lt;a href=&quot;http://drupal.org/project/image&quot; title=&quot;Drupal image module&quot;&gt;image module&lt;/a&gt; is particularly unhelpful and unsympathetic about such moves. &lt;/p&gt;
&lt;p&gt;A google search brought me to &lt;a href=&quot;http://blog.urbanmainframe.com/2008/07/mysql-search-replace/&quot; title=&quot;MySQL search and replace&quot;&gt;this page&lt;/a&gt; on &lt;a href=&quot;http://www.urbanmainframe.com&quot; title=&quot;Urban Mainframe&quot;&gt;urbanmainframe.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;update table_name set table_field = replace(table_field,&#039;replace_that&#039;,&#039;with_this&#039;);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;So to fix your file paths on a Drupal site that you&#039;re migrating that will ultimately live in a different directory within your sites folder,&lt;/p&gt;
&lt;p&gt;&lt;code&gt;UPDATE files SET filepath = replace( filepath, &#039;sites/all/files&#039;, &#039;sites/sitename.com/files&#039; );&lt;/code&gt;&lt;/p&gt;
</description>
     <comments>http://old.atsmath.com/blog/mysql-search-and-replace#comments</comments>
 <category domain="http://old.atsmath.com/category/tags/code-snippets">Code snippets</category>
 <category domain="http://old.atsmath.com/category/tags/drupal">Drupal</category>
 <category domain="http://old.atsmath.com/category/tags/mysql">MySQL</category>
 <category domain="http://old.atsmath.com/category/tags/note-self">Note to self</category>
 <pubDate>Tue, 17 Feb 2009 18:51:08 +0000</pubDate>
 <dc:creator>Smath</dc:creator>
 <guid isPermaLink="false">6587 at http://old.atsmath.com</guid>
  </item>
  </channel>
</rss>