At Last - 4.7
Posted on | July 1, 2006 |
After really getting f***ed up in the upgrade process, at last I was able to upgrade to Drupal 4.7. I did encounter some problems though, but the most serious for them all was that the authors name of the comments posted on my blogger account which I had them imported into drupal 4.6 did not show correctly. Not being a php guru, I had to go to EGLUG to ask for help, as the bozos on #drupal and #drupal-support were too busy to even reply back. MSameer, helped me at 3.00 am and wrote two scripts which solved the problem.
There were two scripts which had to be run. For both all you will have to do is copy and paste it in a new content page, and select the input format to php and then preview it. They will fix the errors in the database. What I mean by error is that the author is shown as a html link syntax instead of the name itself as a hyperlink (more on this will come soon).
The scripts are;
1.
<?php$r = db_query("SELECT cid, name, homepage from comments");
while ($o = db_fetch_object($r)){if ($o->name[0] == "<"){$old = $o->name;$o->name = preg_replace('/<[^>]*>(.*)<\/a>/', '$1', $o->name);$o->homepage = preg_replace('/<[^"]*"([^"]*)".*/', '$1', $old);db_query("UPDATE comments set name='%s', homepage='%s' where cid=%d", $o->name, $o->homepage, $o->cid);echo "Updated Comment $o->cid</br />";}
}?>
2.
<?php$r = db_query("SELECT cid, name, homepage from comments");
while ($o = db_fetch_object($r)){if ($o->name[0] == "<"){$old = $o->name;$o->name = preg_replace('/<span[^>]*>([^<]*)<.*/', '$1', $o->name);$o->homepage = "";db_query("UPDATE comments set name='%s', homepage='%s' where cid=%d", $o->name, $o->homepage, $o->cid);echo "Updated Comment $o->cid</br />";}
}?>
There you go guys. Enjoy. And don't forget to thank MSameer ;)
Comments
Leave a Reply


