| 1 |
<?php
|
| 2 |
/**
|
| 3 |
* Copy this file to your drupal installation root and run from a web browser
|
| 4 |
*
|
| 5 |
* BACK UP YOUR DATABASE FIRST!
|
| 6 |
*/
|
| 7 |
|
| 8 |
|
| 9 |
include_once 'includes/bootstrap.inc';
|
| 10 |
include_once 'includes/common.inc';
|
| 11 |
|
| 12 |
|
| 13 |
if (module_exist('weblink')) {
|
| 14 |
$result = db_queryd("SELECT * FROM {weblink}");
|
| 15 |
while ($weblink = db_fetch_object($result)) {
|
| 16 |
if (!db_fetch_object(db_query("SELECT * FROM {weblinks_node} WHERE nid = %d", $weblink->nid))) { //only upgrade wen the nodes is not yet in weblinks_node table
|
| 17 |
$lid = db_next_id('weblinks_lid');
|
| 18 |
db_query("INSERT INTO {weblinks_node} (lid, nid) VALUES ('%d', '%d')", $lid, $weblink->nid);
|
| 19 |
db_query("INSERT INTO {weblinks} (lid, url, url_md5, clicks) VALUES (%d, '%s', '%s', %d)", $lid, $weblink->weblink, md5($weblink->weblink),$weblink->click);
|
| 20 |
print("Updated weblink '$weblink->weblink'<br/>\n");
|
| 21 |
}
|
| 22 |
}
|
| 23 |
}
|
| 24 |
|
| 25 |
?>
|