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

Contents of /contributions/modules/person/person.install

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


Revision 1.2 - (show annotations) (download) (as text)
Fri Apr 27 14:45:31 2007 UTC (2 years, 7 months ago) by claudiucristea
Branch: MAIN
CVS Tags: DRUPAL-5--1-0, HEAD
Changes since 1.1: +11 -8 lines
File MIME type: text/x-php
* LICENSE.txt added
* Small changes
1 <?php
2 /* $Id: person.install,v 1.1 2007/04/27 13:32:32 claudiucristea Exp $ */
3
4 // define the content type UNIX name
5 define('PERSON_CONTENT_TYPE', 'person');
6
7 /**
8 * Install procedure
9 */
10 function usernode_install() {
11 switch ($GLOBALS['db_type']) {
12 case 'mysqli':
13 case 'mysql':
14 db_query("CREATE TABLE if not exists {" . PERSON_CONTENT_TYPE . "_users} (
15 nid int(10) unsigned NOT NULL,
16 uid int(10) unsigned NOT NULL,
17 PRIMARY KEY(uid, nid)
18 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
19 break;
20 case 'pgsql':
21 db_query("CREATE TABLE {" . PERSON_CONTENT_TYPE . "_users} (
22 nid int_unsigned NOT NULL,
23 uid int_unsigned NOT NULL,
24 PRIMARY KEY(uid, nid)
25 )");
26 break;
27 default:
28 break;
29 }
30
31 // Prevent the promotion of new person node objects to the front page by default,
32 // by only placing 'status' (the 'Published' option) into the node options.
33 variable_set('node_options_' . PERSON_CONTENT_TYPE, array('status'));
34 }
35
36 /**
37 * Uninstall procedure
38 */
39 /* function usernode_uninstall() {
40 // We can't call node_type_delete() because person_delete() forbids that,
41 // so let's find and delete the person nodes manually
42 $result = db_query("SELECT u.* FROM {users} u ".
43 "JOIN {node} n ON u.uid = n.uid ".
44 "WHERE n.type = '". USERNODE_CONTENT_TYPE ."'");
45
46 while ($user = db_fetch_object($result)) {
47 usernode_delete_node($user);
48 }
49
50 db_query("DROP TABLE {person_user}");
51 db_query("DELETE FROM {node_type} WHERE type = '". USERNODE_CONTENT_TYPE ."'");
52 variable_del('node_options_'. USERNODE_CONTENT_TYPE);
53 }
54 */
55 ?>

  ViewVC Help
Powered by ViewVC 1.1.2