Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After cloning a site, the filepath column of the files table still had paths pointing to the cloned site.
I did a "update files set filepath = replace(filepath, 'sites/OLDURL/', 'sites/NEWURL/'));" and it fixed the issue.
Comment | File | Size | Author |
---|---|---|---|
#6 | provision_fix_clone3.diff | 355 bytes | adrian |
#5 | provision_fix_clone.diff | 968 bytes | adrian |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedYep, reproduced, this is definitely a FAIL:
So we are obviously not passing $old_url properly. Investigating
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedSo the trick is we can even force site_url to be the old url in clone.provision.inc when calling provision-deploy, but what happens is that after the backup has been unpacked into the new site's directory, its drushrc.php is loaded into scope, updates are run and then the drushrc.php is regenerated with a new site_url parameter. This parameter is then interpreted in the deploy.inc for drush_get_option('site_url') for both $new_url and $old_url and that's why the replace doesn't work: it's trying to replace a non-existent value with an identical value which never happens.
A tricky one, because as far as I can see we can't control this in clone.provision.inc: the problem is deploy.inc I think. I might be wrong.
Comment #3
adrinux CreditAttribution: adrinux commentedThis bit me on a clone too. My imagecache presets were all working fine though – until flushed – it was actually cck imagefield uploaded image paths that were not updated. So I think the 'breaks imagecache' is a bit misleading.
I used the sql workaround too.
One other thing I've seen is xmlsitemap's cache files - the module stores the filepath in the variables table. So obviously just checking the files table misses that. Easier one to change though.
( Looks like this won't be a problem for drupal 7, but will remain one for 6 "File table includes file_directory_path()" http://drupal.org/node/366464 )
I'm rambling. Sorry.
Comment #4
anarcat CreditAttribution: anarcat commentedmarking critical. basically, we need a way to pass the old url to the deploy because the url is somehow changed before deploy happens.
Comment #5
adrian CreditAttribution: adrian commentedThe issue is in the calling code :
As you can see, it needs to regenerate the settings.php and the drushrc.php for the updatedb to work properly.
Try this 2 line patch, which sets a process option called old_site_url right after initially loading the config file , so it can't be messed with.
Comment #6
adrian CreditAttribution: adrian commentedD'oh ..
drush_get_option has the place in the stack as the third parameter.
second is the default (like variable_get)
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedCommitted the patch which fixed the value of $old_url, but to compound matters our UPDATE query for the files table was faulty:
should be sites/%s . Committed that too and it all works as it should now.
Thanks guys