FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Converters » Changing old forum URLs in all messages
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Changing old forum URLs in all messages [message #22106 is a reply to message #21973] Sat, 15 January 2005 13:27 Go to previous messageGo to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma:
Senior Member
Administrator
Core Developer
OK, how does this look?

<?php
// Seach all messages for a string and replace with another

$seachfor    = "Frank";
$replacewith = "FRANK";

set_time_limit(-1);
ini_set('memory_limit', '128M');

include("./GLOBALS.php");
include("./fuddata/scripts/fudapi.inc.php");

$c = q("SELECT * FROM ${DBHOST_TBL_PREFIX}msg");
while ($r = db_rowobj($c)) {
  echo "ID=[" . $r->id . "], POSTER=[" . $r->poster_id . "], SUBJECT=[" . $r->subject . "]<br/>\n";

  $fp = fopen($GLOBALS['MSG_STORE_DIR'].'msg_'.$r->file_id, 'rb');
  fseek($fp, $r->foff);
  $body = fread($fp, $r->length);

  if (($p = strpos($body, $seachfor)) !== false) {
    $body = str_replace($seachfor, $replacewith, $body);
    echo "NEW BODY=[" . $body . "]<hr>\n";
    // fud_update_message($r->subject, $body, 0, $r->poster_id, $r->id);
  }
}
?>


Note that the update function is still commented out!

Best regards.

Frank
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Preparing for final conversion: reset the DB
Next Topic: Subscribe users to topics/ forums
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 19:39:36 GMT 2024

Total time taken to generate the page: 0.04607 seconds