-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathactivitystream.install
96 lines (85 loc) · 3.27 KB
/
activitystream.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
// $Id: activitystream.install,v 1.3.2.5 2009/11/25 05:19:35 akalsey Exp $
/**
* @file
* Installs the tables for activitystream.
*/
/**
* Implementation of hook_install()
*
* This will automatically install the database tables for the Activity Stream
* module for MySQL.
*
* If you are using another database, you will have to install the
* tables by hand, using the queries below as a reference.
*
* Note that the curly braces around table names are a drupal-specific
* feature to allow for automatic database table prefixing, and will
* need to be removed.
*/
function activitystream_install() {
//create tables
drupal_install_schema('activitystream');
drupal_set_message(t('Activity Stream module installed successfully.'));
db_query("UPDATE {system} SET weight = 100 WHERE name = 'activitystream'");
}
/**
* Implementation of hook_schema().
*/
function activitystream_schema() {
$schema = array();
$schema['activitystream'] = array(
'fields' => array(
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
'module' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
'guid' => array('type' => 'varchar', 'length' => '32', 'not null' => TRUE),
'link' => array('type' => 'varchar', 'length' => '255'),
'data' => array('type' => 'text'),
'changed' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10')
),
'indexes' => array('nid' => array('nid')),
'primary key' => array('guid'),
);
$schema['activitystream_accounts'] = array(
'fields' => array(
'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
'module' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
'userid' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
'password' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
'feed' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE),
'lastfetch' => array('type' => 'datetime', 'not null' => FALSE)),
);
return $schema;
}
/**
* Implementation of hook_uninstall().
*/
function activitystream_uninstall() {
//remove tables
drupal_uninstall_schema('activitystream');
$variables = db_query("SELECT name FROM {variable} WHERE name LIKE 'activitystream%%'");
while ($variable = db_fetch_object($variables)) {
variable_del($variable->name);
}
update_sql("DELETE FROM {system} WHERE name like '%activitystream'");
}
/*
Instead of using the dummy category, we now use hook_user's categories $op switch.
So we can remove the dummy category from the database.
*/
function activitystream_update_1() {
if (module_exists('profile')) {
db_query("DELETE FROM {profile_fields} WHERE title = 'Placeholder' and name = 'profile_activitystream_placeholder'");
}
}
/*
Move the module weight to the bottom so it's likely to run after Simplepie.
*/
function activitystream_update_2() {
db_query("UPDATE {system} SET weight = 100 WHERE name = 'activitystream'");
}
function activitystream_update_6201() {
$ret = array();
db_add_index(&$ret, 'activitystream', 'nid', array('nid'));
return $ret;
}