We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Converting Newsfeed to new domain URL | Forum

Richard Carr
Richard Carr May 20 '13
Hello folks, I will be changing my primary domain soon and from asking puru and Den it seems i will have to change domain in config.php and cron settings (if your cron has been setup with wget/lynx command)...


However according to Den "newsfeed's entries contain an old domain name. Like "Someone commented on <a href='http://old-domain/photo-url'>your photo</a>". It's not so easy to convert it to new one as they are stored into the newsfeed cache. A complex sql query should be performed to apply new domain into newsfeed' entries URL. Create a separate topic on the forum and ask our support team to provide you with this query if you take care about it." 


So can anybody shed any light on how to do this?

Daisy Team
Daisy May 24 '13
Unfortunately, we cannot provide you with the query. As Den said, it's not so easy converting URLs to new ones and it requires a complicated script that should parse the newsfeed data, find the URLs and change them to new URLs.
 
However, we've considered this issue and found out that this is a problem that should be solved. We should not store the definite URLs, we should insert variables, so if the URL has been changed it wouldn't affect the newsfeed functionality.
 
Sorry to say, but for now there are no easy ways to change the URLs in the static newsfeed content.
webcs Club
webcs Mar 8 '14

Quote from Daisy Unfortunately, we cannot provide you with the query. As Den said, it's not so easy converting URLs to new ones and it requires a complicated script that should parse the newsfeed data, find the URLs and change them to new URLs.
 
However, we've considered this issue and found out that this is a problem that should be solved. We should not store the definite URLs, we should insert variables, so if the URL has been changed it wouldn't affect the newsfeed functionality.
 
Sorry to say, but for now there are no easy ways to change the URLs in the static newsfeed content.
for newsfeed
goto phpmyadmin>go to database>part sql
Enter the code below

UPDATE ow_newsfeed_action SET data = replace(data,"url old","url new")

for blog

goto phpmyadmin>go to database>part sql
Enter the code below

UPDATE ow_blogs_post SET post = replace(post,"url old","url new")


Daisy Team
Daisy Mar 20 '14
Alireza, here is the example of the newsfeed action data:

 {"string":{"key":"friends+newsfeed_action_string","vars":{"user_url":"http:\/\/10.0.0.4\/user\/qwe","name":"Admin","requester_url":"http:\/\/10.0.0.4\/user\/grey","requester_name":"grey"}},"actionDto":null}

To replace the URL: "http:\/\/10.0.0.4\/user\/qwe" - you need to parse this data to detect which of the attributes is the URL and how to replace this with the new one. Therefore it's not so easy as you described. You need to write a script which will parse the newsfeed data, find the URLs and change them to new URLs.
Heri Bender
Heri Bender Nov 13 '14
What about this: Export the whole DB into an sql dump. Then just replace all strings <old domain> with <new domain>, create your DB new and import the changed sql dump?