OK maybe this will make a bit more sense.
So far as I can tell there is only one table in Drupal that
contains data on links to uploaded images and files.
That is the "drp_node_revisions" table.
And the only fields that need updating are the "body" field and the "teaser" field.
So the following query will successfully select all the required
records:
Code:
SELECT * FROM drp_node_revisions WHERE body LIKE '%/sites/default/files/%'
OR teaser LIKE '%/sites/default/files/%';
From that point, it is possible to go through each record and manually change the file reference.
However that's only a slight improvement on manually updating everything
from the Admin interface. I want to take it to the next level and run an SQL query that does that.
Would this work?:
Code:
UPDATE drp_node_revisions SET body, teaser
= replace(*, '/client1/sites/default/files/', '/sites/default/files/')
WHERE body LIKE '%/sites/default/files/%'
OR teaser LIKE '%/sites/default/files/%';
I'm not sure if a % sign in the replace parameters is necessary or not, because it is affecting a part of a longer string,
but the MySQL docs suggest not.
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals" Please login or register to view this content. Registration is FREE
Last edited by TWD; 03-01-2011 at 08:17 PM..
|