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

Diff of /contributions/modules/session_restore/session_restore.install

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

revision 1.1, Wed Jul 11 08:17:19 2007 UTC revision 1.1.4.1, Sun Mar 30 06:41:13 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: session_restore.install 283 2007-06-23 19:08:43Z karthik $  // $Id: session_restore.install,v 1.1 2007/07/11 08:17:19 karthik Exp $
3    
4  /**  /**
5   * Implementation of hook_install().   * Implementation of hook_install().
6   */   */
7  function session_restore_install() {  function session_restore_install() {
8    switch ($GLOBALS['db_type']) {    drupal_install_schema('session_restore');
     case 'mysql':  
     case 'mysqli':  
       db_query("CREATE TABLE {session_restore} (  
         uid INT UNSIGNED NOT NULL,  
         session LONGTEXT,  
         PRIMARY KEY(uid)  
       ) /*!40100 DEFAULT CHARACTER SET utf8 */;");  
       break;  
     case 'pgsql':  
       db_query("CREATE TABLE {session_restore} (  
         nid INT_UNSIGNED NOT NULL,  
         session TEXT,  
         PRIMARY KEY(uid)  
       );");  
       break;  
   }  
9    
10    drupal_set_message(t('Session restore module: Installation script complete.'));    drupal_set_message(t('Session restore module: Installation script complete.'));
11  }  }
12    
13  /**  /**
14     * Implementation of hook_schema().
15     */
16    function session_restore_schema() {
17      $schema['session_restore'] = array(
18        'description' => t('Stores session variables for later restoration.'),
19        'fields' => array(
20          'uid' => array(
21            'type' => 'int',
22            'unsigned' => TRUE,
23            'not null' => TRUE,
24            'description' => t('Primary key: {users}.uid for user.')
25          ),
26          'session' => array(
27            'type' => 'text',
28            'size' => 'big',
29            'description' => t('Store serialised user session for later retrieval.')
30          ),
31        ),
32        'primary key' => array('uid')
33      );
34    
35      return $schema;
36    }
37    
38    /**
39   * Implementation of hook_uninstall().   * Implementation of hook_uninstall().
40   */   */
41  function session_restore_uninstall() {  function session_restore_uninstall() {
42    db_query("DROP TABLE {session_restore}");    drupal_uninstall_schema('session_restore');
43    
44    drupal_set_message(t('Session restore module: Uninstallation script complete.'));    drupal_set_message(t('Session restore module: Uninstallation script complete.'));
45  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.4.1

  ViewVC Help
Powered by ViewVC 1.1.2