/[drupal]/contributions/modules/weblink/update-weblink.php
ViewVC logotype

Contents of /contributions/modules/weblink/update-weblink.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Sun Jun 19 15:50:42 2005 UTC (4 years, 5 months ago) by ber
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
File MIME type: text/x-php
fixed issue 23623
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 ?>

  ViewVC Help
Powered by ViewVC 1.1.2