Suggestions for rescuing weblink entries in 4.7
As you know, weblink.module seems to be rather deceased or at least not upgraded to 4.7. I spent a little time thinking about how I can rescue my 843 weblink records which now only contain the bodies, but no longer link to the URL associated with the entry. So I was thinking I could use MySQL UPDATE and concatenate the node_revisions.body and weblink.weblink fields. Then I could change all weblink types to blog types.
I tried this MySQL statement:
UPDATE `node_revisions`, `weblink`
SET `node_revisions`.`body`=concat(`node_revisions`.`body`,"<br /><a href=\"",`weblink`.`weblink`,"\">Visit this page</a>")
WHERE `node_revisions`.`nid` = `weblink`.`nid`;MySQL returns this feedback:
Query OK, 813 rows affected (0.15 sec)
Rows matched: 813 Changed: 813 Warnings: 0
So all seems OK, but when I check any weblink records, node_revisions.body hasn't been modified. I then realize that the field is a LONGTEXT and wonder if that's why nothing is happening. Can anyone provide some insight into how to get the above to work? I would really appreciate someone's expertise with MySQL here.

Links package?
You can upgrade to the links package in 4.7 and use the migration script here:
http://drupal.org/node/42986
How do I pull up all the links?
I just installed links_weblink.module. How do I pull up a list view of all my weblinks?
These don't work:
www.site.com/weblink
www.site.com/link
www.site.com/links
You will need to run the script
That should convert your old weblinks to the new links package under Drupal 4.7. Of course, I would recommend backing up your data first, but it all worked for me. As for the URL's, check the documentation and admin->settings for the links package to see any paths that it sets up automatically (if you check off the directory option, I think this gives you an automatic links directory of sorts). You should be able to tailor those links to any url that you want; I recommend using the links package in combination with the views module... this seems to be a good approach to getting the listed links to behave and show where you want them...
Thanks. Works great.
Thanks. Works great.
The link is www.site.com/links/weblink
how do I run the script?
Sorry if this is a dumb question, but what exactly should I do to run the script on http://drupal.org/node/42986?
Should I place it inside a node body and just submit it?
Links not getting displayed
I'm not getting this. The upgrade seems to have run sucessfully for me and my weblinks are now available under admin > links. I can also see settings under admin > settings > links. But there is no option for a directory listing. That would actually be fine with me, but I also don't understand how to get the links to display in node.tpl.php. The link doesn't appear using the regular $links variable.
Links and weblinks
Do you have both links and weblinks endabled in your module list? Also, under admin->settings->links_weblink settings, check the box next to "Enable weblinks directory." This should create a menu item for a links directory. You may need to check admin->menu in order to enable the menu item to your links directory. I hope that helps.
Again, I like the flexibility of using the links package with the views module, but they should both work.
Yes, I have links and
Yes, I have links and weblinks enabled, but I don't see an option for settings > links_weblink. Strange. Not sure what's happening at this point.
Odd
You might try reinstalling the module and making sure you run update.php to ensure that your links_package tables are up-to-date. Other than that, I'm not sure I can help.
Thanks, bomarmonk
Thanks so much for you help so far, bomarmonk. Will try what you suggest.
Personally, I was hoping to divorce myself from any module and just change my entries to blogs so I wouldn't have to continue to deal with synchronizing weblinks with each upgrade.
Try this PHP snippet
As an admin, create a new node of type page, paste the code below, specify PHP as the input format, then click on submit.
<?php
$count = 0;
$new_type = 'page';
$result = db_query("SELECT n.nid, w.weblink
FROM node n INNER JOIN weblink w USING (nid)
WHERE n.type = 'weblink'");
while ($row = db_fetch_object($result)) {
$result_revisions = db_query("SELECT body, title FROM node_revisions WHERE nid = %d",
$row->nid);
while($row_revisions = db_fetch_object($result_revisions)) {
$body = $row_revisions->body;
$title = $row_revisions->title;
}
$link = db_result(db_query("SELECT weblink FROM weblink WHERE nid = %d",
$row->nid));
$body .= '<br/>' . '<a href="' . $link . '">' . $title . '</a>';
db_query("UPDATE node_revisions nr SET body = '%s' WHERE nid = %d",
$body, $row->nid);
db_query("UPDATE node SET type = '%s' WHERE nid = %d",
$new_type, $row->nid);
$count++;
}
print "processed: $count records";
?>
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com
Thanks, Khalid. I hadn't
Thanks, Khalid. I hadn't thought of running the query that way. Ran this and it indicated that the 813 records were processed, but once again, the records actually remain unchanged. Very strange. Should have worked in the first place from the MySQL command line.
Worked for me
I wrote it for a client and it worked. The reason I did it that way is that you reported the other way (pure MySQL) did not work.
Of course my approach was a one time dirty hack, and can be optimized by doing some joins instead of several queries.
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com