Commit b8230986 authored by omega8cc's avatar omega8cc Committed by anarcat

Update paths also in nodes revisions for sites migrated/cloned/renamed and...

Update paths also in nodes revisions for sites migrated/cloned/renamed and also imported from standalone install.
parent b40b6e32
......@@ -20,10 +20,26 @@ drush_log(
dt('Changed paths from sites/@old_url to sites/@new_url',
array('@old_url' => $old_url, '@new_url' => $new_url)));
db_query("UPDATE {files} SET filepath=replace(filepath, 'sites/%s', 'sites/%s')", $old_url, $new_url);
db_query("UPDATE {users} SET picture = replace(picture, 'sites/%s', 'sites/%s')", $old_url, $new_url);
db_query("UPDATE {files} SET filepath=replace(filepath, 'sites/default', 'sites/%s')", $new_url);
db_query("UPDATE {users} SET picture = replace(picture, 'sites/default', 'sites/%s')", $new_url);
/*
* Update paths for sites migrated
* from standalone to the multisite install.
*/
db_query("UPDATE {files} SET filepath = REPLACE(filepath, 'sites/default', 'sites/%s')", $new_url);
db_query("UPDATE {users} SET picture = REPLACE(picture, 'sites/default', 'sites/%s')", $new_url);
db_query("UPDATE {boxes} SET body = REPLACE(body, 'sites/default', 'sites/%s')", $new_url);
db_query("UPDATE {node_revisions} SET body = REPLACE(body, 'sites/default', 'sites/%s')", $new_url);
db_query("UPDATE {node_revisions} SET teaser = REPLACE(teaser, 'sites/default', 'sites/%s')", $new_url);
/*
* Update paths for sites cloned/migrated/renamed
* in the multisite install.
*/
db_query("UPDATE {files} SET filepath = REPLACE(filepath, 'sites/%s', 'sites/%s')", $old_url, $new_url);
db_query("UPDATE {users} SET picture = REPLACE(picture, 'sites/%s', 'sites/%s')", $old_url, $new_url);
db_query("UPDATE {boxes} SET body = REPLACE(body, 'sites/%s', 'sites/%s')", $old_url, $new_url);
db_query("UPDATE {node_revisions} SET body = REPLACE(body, 'sites/%s', 'sites/%s')", $old_url, $new_url);
db_query("UPDATE {node_revisions} SET teaser = REPLACE(teaser, 'sites/%s', 'sites/%s')", $old_url, $new_url);
variable_set('file_directory_path', "sites/$new_url/files");
variable_set('file_directory_temp', "sites/$new_url/files/tmp");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment