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

Diff of /contributions/modules/path_access/path_access.install

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

revision 1.1, Thu Jun 1 00:09:54 2006 UTC revision 1.2, Sun Aug 10 16:42:29 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id $  // $Id $
3    
4  function path_access_install() {  function path_access_schema() {
5    drupal_set_message('Installing Path Access');    $schema['path_access'] = array(
6    switch ($GLOBALS['db_type']) {      'fields' => array(
7        case 'mysqli':        'pid' => array(
8        case 'mysql':          'type' => 'serial',
9          db_query("CREATE TABLE `path_access` (          'not null' => TRUE,
10                    `pid` int(10) NOT NULL default '0',        ),
11                    `rid` int(10) NOT NULL default '0',        'rid' => array(
12                    `pages` text,          'type' => 'int',
13                    `visibility` tinyint(1) NOT NULL default '0',          'not null' => TRUE,
14                    PRIMARY KEY  (`pid`),          'default' => 0,
15                    KEY `rid` (`rid`)        ),
16                    );");        'pages' => array(
17            'type' => 'text',
18          // By default grant access to all anon and authenticated users        ),
19          db_query("INSERT INTO {path_access} (pid, rid, pages, visibility) VALUES (%d, 1, '', 0)", db_next_id('path_access'));        'visibility' => array(
20          db_query("INSERT INTO {path_access} (pid, rid, pages, visibility) VALUES (%d, 2, '', 0)", db_next_id('path_access'));          'type' => 'int',
21            'size' => 'tiny',
22          // ensure the path.module is active          'not null' => TRUE,
23          db_query("UPDATE `system` SET status = 1 where name = 'path'");          'default' => 0,
24          ),
25        ),
26        'indexes' => array(
27          'rid' => array('rid'),
28        ),
29        'primary key' => array('pid'),
30      );
31      return $schema;
32    }
33    
34          $success = TRUE;  function path_access_install() {
35          break;    $res = drupal_install_schema('path_access');
36      $success = TRUE;
37      foreach($res as $v) {
38        if($v['success'] !== TRUE) {
39          $success = FALSE;
40          break;
41        }
42    }    }
   
43    if ($success) {    if ($success) {
44      drupal_set_message(t('Path Access module installed tables successfully.'));      drupal_set_message(t('Path Access module installed tables successfully.'));
45    }    }
# Line 34  function path_access_install() { Line 48  function path_access_install() {
48    }    }
49  }  }
50    
51    function path_access_uninstall() {
52      $res = drupal_uninstall_schema('path_access');
53      $success = TRUE;
54      foreach($res as $v) {
55        if($v['success'] !== TRUE) {
56          $success = FALSE;
57          break;
58        }
59      }
60      if ($success) {
61        drupal_set_message(t('Path Access module uninstalled tables successfully.'));
62      }
63      else {
64        drupal_set_message(t('The uninstallation of Path Access module was unsuccessful.'), 'error');
65      }
66    }
67    
68    // vim: set ft=php syntax=php expandtab ts=2 sw=2 autoindent smartindent:

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

  ViewVC Help
Powered by ViewVC 1.1.2