Mercurial > defr > drupal > og_statistics
comparison og_statistics.install @ 2:48f07e7acaca
OG Stats 1.0-rc2
| author | Franck Deroche <franck@defr.org> |
|---|---|
| date | Tue, 24 Nov 2009 14:27:37 +0100 |
| parents | 9ce879ecbce6 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:9ce879ecbce6 | 2:48f07e7acaca |
|---|---|
| 1 <?php | 1 <?php |
| 2 // $Id: og_statistics.install,v 1.2 2009/05/29 16:46:25 dereine Exp $ | 2 // $Id: og_statistics.install,v 1.2.2.1 2009/08/12 19:53:28 dereine Exp $ |
| 3 | 3 |
| 4 /** | 4 /** |
| 5 * @file | 5 * @file |
| 6 * Installs the og_statistics module. | 6 * Installs the og_statistics module. |
| 7 */ | 7 */ |
| 63 'type' => 'int', | 63 'type' => 'int', |
| 64 'size' => 'normal', | 64 'size' => 'normal', |
| 65 'not null' => FALSE, | 65 'not null' => FALSE, |
| 66 'default' => 0, | 66 'default' => 0, |
| 67 ), | 67 ), |
| 68 'last_comment_uid' => array( | |
| 69 'description' => 'Last {users}.uid to post a comment in a group.', | |
| 70 'type' => 'int', | |
| 71 'unsigned' => TRUE, | |
| 72 'not null' => FALSE, | |
| 73 'default' => 0, | |
| 74 ), | |
| 75 'last_comment_nid' => array( | |
| 76 'description' => 'Node the last comment was posted to in a group.', | |
| 77 'type' => 'int', | |
| 78 'unsigned' => TRUE, | |
| 79 'not null' => FALSE, | |
| 80 'default' => 0, | |
| 81 ), | |
| 82 'last_comment_cid' => array( | |
| 83 'description' => '{comments}.cid of the last comment in a group.', | |
| 84 'type' => 'int', | |
| 85 'unsigned' => TRUE, | |
| 86 'not null' => FALSE, | |
| 87 'default' => 0, | |
| 88 ), | |
| 89 'last_node_nid' => array( | |
| 90 'description' => 'Last {node}.nid posted to a group.', | |
| 91 'type' => 'int', | |
| 92 'unsigned' => TRUE, | |
| 93 'not null' => FALSE, | |
| 94 'default' => 0, | |
| 95 ), | |
| 96 'last_node_uid' => array( | |
| 97 'description' => '{users}.uid of the last node posted to a group.', | |
| 98 'type' => 'int', | |
| 99 'unsigned' => TRUE, | |
| 100 'not null' => FALSE, | |
| 101 'default' => 0, | |
| 102 ), | |
| 103 'last_member_uid' => array( | |
| 104 'description' => '{users}.uid of the last user to join a group.', | |
| 105 'type' => 'int', | |
| 106 'unsigned' => TRUE, | |
| 107 'not null' => FALSE, | |
| 108 'default' => 0, | |
| 109 ), | |
| 68 ), | 110 ), |
| 69 'primary key' => array('nid'), | 111 'primary key' => array('nid'), |
| 70 ); | 112 ); |
| 71 | 113 |
| 72 return $schema; | 114 return $schema; |
| 76 * Implemenation of hook_uninstall(). | 118 * Implemenation of hook_uninstall(). |
| 77 */ | 119 */ |
| 78 function og_statistics_uninstall() { | 120 function og_statistics_uninstall() { |
| 79 drupal_uninstall_schema('og_statistics'); | 121 drupal_uninstall_schema('og_statistics'); |
| 80 } | 122 } |
| 123 | |
| 124 /** | |
| 125 * Adds more verbose og statistics. | |
| 126 */ | |
| 127 function og_statistics_update_6001() { | |
| 128 $ret = array(); | |
| 129 $schema = drupal_get_schema_unprocessed('og_statistics'); | |
| 130 $table_definition = $schema['og_statistics']; | |
| 131 // Add detailed columns for last comment post. | |
| 132 foreach (array('last_comment_uid', 'last_comment_nid', 'last_comment_cid') as $column) { | |
| 133 if (!db_column_exists('og_statistics', $column)) { | |
| 134 db_add_field($ret, 'og_statistics', $column, $table_definition['fields'][$column]); | |
| 135 } | |
| 136 } | |
| 137 // Add detailed columns for last node post. | |
| 138 foreach (array('last_node_uid', 'last_node_nid') as $column) { | |
| 139 if (!db_column_exists('og_statistics', $column)) { | |
| 140 db_add_field($ret, 'og_statistics', $column, $table_definition['fields'][$column]); | |
| 141 } | |
| 142 } | |
| 143 // Add detailed columns for last user to join. | |
| 144 foreach (array('last_member_uid') as $column) { | |
| 145 if (!db_column_exists('og_statistics', $column)) { | |
| 146 db_add_field($ret, 'og_statistics', $column, $table_definition['fields'][$column]); | |
| 147 } | |
| 148 } | |
| 149 // Rebuild schema. | |
| 150 drupal_get_schema('og_statistics', TRUE); | |
| 151 } |
