/[drupal]/contributions/modules/authorship/authorship.install
ViewVC logotype

Contents of /contributions/modules/authorship/authorship.install

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


Revision 1.9 - (show annotations) (download) (as text)
Sat Oct 11 12:22:16 2008 UTC (13 months, 2 weeks ago) by karpuz
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1
Changes since 1.8: +30 -61 lines
File MIME type: text/x-php
#231227 by Matt B, upgrade to Drupal 6
1 <?php
2 // $Id: authorship.install,v 1.5.2.1 2007/07/12 22:05:55 karpuz Exp $
3
4 /**
5 * @file
6 * Installation for db table for authorship
7 */
8
9 /**
10 * AjK, June 2006
11 */
12
13 /**
14 * v6.x-dev written by matt_b
15 */
16
17 function authorship_schema() {
18 $schema['node_authorship'] = array(
19 'fields' => array(
20 'nid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
21 'cid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
22 'authorship' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
23 'profile_real_name' => array('type' => 'int', 'not null' => FALSE, 'default' => 0, 'disp-width' => '2')),
24 'primary key' => array('nid', 'cid'),
25 'indexes' => array(
26 'authorship' => array(array('authorship', 8))),
27 );
28
29 return $schema;
30 }
31
32 /*
33 This need to be converted. For the moment, this module assumes that the latest 5.x version was used
34
35 function authorship_update_1() {
36 $items = array();
37 foreach(node_get_types('types') as $type) {
38 $r = db_query('SELECT value FROM {variable} WHERE name LIKE "authorship_%s_real_name"', $type);
39 if (db_num_rows($r) > 0) {
40 $row = db_fetch_array($r);
41 $items[] = update_sql('INSERT INTO {variable} SET name = "%s", value = "%s"', 'authorship_real_name_'. $type, $row['value']);
42 $items[] = update_sql('DELETE FROM {variable} WHERE name = "authorship_%s_real_name"', $type);
43 }
44 }
45 return $items;
46 }
47
48 function authorship_update_2() {
49 $items = array();
50 $items[] = update_sql("ALTER TABLE {node_authorship} ADD cid INT(10) NOT NULL DEFAULT 0 AFTER nid");
51 $items[] = update_sql("ALTER TABLE {node_authorship} DROP PRIMARY KEY");
52 $items[] = update_sql("ALTER TABLE {node_authorship} ADD PRIMARY KEY (nid, cid)");
53 return $items;
54 }
55 */
56
57 function authorship_install() {
58 // Create my tables.
59 drupal_install_schema('authorship');
60 }
61
62 function authorship_uninstall() {
63 // Drop my tables.
64 drupal_uninstall_schema('authorship');
65 }
66 ?>

  ViewVC Help
Powered by ViewVC 1.1.2