function backfill_attachment_urls()
{
global $wpdb;
// make sure we do the longest urls first, in case one is a substring of another
uksort($this->url_remap, array(&$this, 'cmpr_strlen'));
foreach ($this->url_remap as $from_url => $to_url) {
// remap urls in post_content
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)", $from_url, $to_url));
// remap enclosure urls
$result = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'", $from_url, $to_url));
}
}