/[drupal]/contributions/modules/movino/optional/movino_node.install
ViewVC logotype

Contents of /contributions/modules/movino/optional/movino_node.install

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


Revision 1.2 - (show annotations) (download) (as text)
Sun Aug 5 16:29:33 2007 UTC (2 years, 3 months ago) by tomsun
Branch: MAIN
CVS Tags: DRUPAL-5--1-1, HEAD
Branch point for: DRUPAL-5
Changes since 1.1: +17 -1 lines
File MIME type: text/x-php
Modified the way nodes are mapped to videos, for easier integration with Views..
1 <?php // $Id: movino_node.install,v 1.1 2007/07/13 10:32:52 tomsun Exp $
2
3 function movino_node_install() {
4 switch ($GLOBALS['db_type']) {
5 case 'mysql':
6 case 'mysqli':
7 // the {tablename} syntax is so multisite installs can add a
8 // prefix to the table name as set in the settings.php file
9
10 db_query("CREATE TABLE IF NOT EXISTS {movino_node_mapping} (
11 nid int(10) NOT NULL default '0',
12 id varchar(127) NOT NULL default '0',
13 server varchar(127) NOT NULL default '0',
14 deleted int(1) NOT NULL default '0',
15 PRIMARY KEY (nid)
16 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
17 break;
18 }
19 }
20
21
22 function movino_node_update_1() {
23 $ret = array();
24 db_add_column($ret, 'movino_node_mapping', 'vid', 'int(10)');
25
26 $result = db_query("SELECT n.nid, v.vid FROM {movino_node_mapping} n LEFT JOIN {movino_videos} v ON n.id = v.id WHERE n.server = v.server");
27 while ($row = db_fetch_array($result)) {
28 $ret[] = update_sql("UPDATE {movino_node_mapping} SET vid = " . $row['vid'] . " WHERE nid = " . $row['nid']);
29 }
30 $ret[] = update_sql("ALTER TABLE {movino_node_mapping} DROP id");
31 $ret[] = update_sql("ALTER TABLE {movino_node_mapping} DROP server");
32
33 return $ret;
34 }
35
36 ?>

  ViewVC Help
Powered by ViewVC 1.1.2