Old hyperlinks won't work
Old hyperlinks won't work
Heaps of people have hyperlinks in their posts. It seems since they link to the old forum they don't work.
Yep, I mentioned that in here:
http://freeorion.org//forum/viewtopic.php?t=650
http://freeorion.org//forum/viewtopic.php?t=650
Hmmm.... if you did a backup of the forum database, would it be possible to do a global search & replace of artcluster.com/bb. with freeorion.org/forum/ and then re-upload???
Or is the data not in a text searchable format?
I assume that the topic/post IDs would remain valid...
Or is the data not in a text searchable format?
I assume that the topic/post IDs would remain valid...
The COW Project : You have a spy in your midst.
-
- Dyson Forest
- Posts: 205
- Joined: Thu Aug 14, 2003 4:50 pm
- Location: United Kingdom of Great Britain and Northern Ireland
Hmmm, i don't think it can be done with MySQL, as i don't believe MySQL allows u to use Update in conjunction with REGEXP.
The following PHP script will however do the job for you.
U can run that as a stand alone script. Might take a few seconds with 11000 posts to go through though.
Note: you will need to change the login details for your database, and you will also need to change the
mysql_select_db("phpBB", $database_link);
phpBB part of the above, to whatever the database name is.
Should all work after that.
Should.
Any problems, just let me know.
The following PHP script will however do the job for you.
Code: Select all
<?php
//connect to DB.
$database_link = mysql_connect("localhost", "ENTER USERNAME", "ENTER PASS");
mysql_select_db("phpBB", $database_link);
$num_changed = 0;
$db_func_query = mysql_query("select post_text, post_id from phpbb_posts_text") or die(mysql_error());
//db("select post_text, post_id from phpbb_posts_text");
while($results = mysql_fetch_array($db_func_query)){
if(preg_match("/artclusta\.com\/bb/i", $results['text']) != 0){
mysql_query("update phpbb_posts_text set post_text = '".preg_replace("/artclusta\.com\/bb/i", "freeorion.org/forum", $results['post_text'])."' where post_id = '$results[post_id]'", $database_link);
$num_changed++;
}
}
echo $num_changed." links updated";
?>
Note: you will need to change the login details for your database, and you will also need to change the
mysql_select_db("phpBB", $database_link);
phpBB part of the above, to whatever the database name is.
Should all work after that.
Should.
Any problems, just let me know.