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

Diff of /contributions/modules/schedule/schedule.install

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

revision 1.1.2.1, Mon Jan 8 16:25:56 2007 UTC revision 1.1.2.2, Mon Jan 8 16:43:07 2007 UTC
# Line 0  Line 1 
1    <?php
2    // $Id: $
3    
4    /**
5     * Implementation of hook_install()
6     *
7     * This will automatically install the database tables for the schedule module for the MySQL database.
8     *
9     * If you are using another database, you will have to install the tables by hand, using the queries below as a reference.
10     *
11     * Note that the curly braces around table names are a drupal-specific feature to allow for automatic database table prefixing,
12     * and will need to be removed.
13     */
14    function schedule_install() {
15      switch ($GLOBALS['db_type']) {
16        case 'mysqli':
17        case 'mysql':
18          $query1 = db_query("CREATE TABLE IF NOT EXISTS {schedules} (
19                          schedule_id int(10) NOT NULL auto_increment,
20                          schedule_title varchar(100) NOT NULL,
21                          type varchar(20) NOT NULL,
22                          publication_id int(10) NOT NULL default '0',
23                          start int(11) NOT NULL default '0',
24                          first int(11) NOT NULL default '0',
25                          next int(11) NOT NULL default '0',
26                          last int(11) NOT NULL default '0',
27                          every int(3) NOT NULL default '0',
28                          frequency varchar(6) NOT NULL,
29                          relative varchar(6) NOT NULL,
30                          relative_date varchar(25) NOT NULL,
31                          timeout int(4) NOT NULL default '0',
32                          PRIMARY KEY  (schedule_id)
33                            ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
34    
35          $query2 = db_query("CREATE TABLE IF NOT EXISTS {schedules_action} (
36                            action_id INT( 10 ) NOT NULL AUTO_INCREMENT ,
37                            type varchar(20) NOT NULL,
38                            publication_id INT( 10 ) NOT NULL ,
39                            schedule_id INT( 10 ) NOT NULL ,
40                            pub_time INT( 11 ) NOT NULL ,
41                            PRIMARY KEY ( action_id )
42                            ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
43    
44          if ($query1 && $query2) {
45            $created = TRUE;
46          }
47          break;
48        default:
49          break;
50      }
51    
52      if ($created) {
53        drupal_set_message(t('schedule module installed successfully.'));
54      }
55      else {
56        drupal_set_message(t('Table installation for the schedule module was unsuccessful. The tables may need to be installed by hand. See schedule.install file for a list of the installation queries.'), 'error');
57      }
58    
59      return;
60    }
61    
62    function schedule_update_1() {
63    
64        _system_update_utf8(array('schedules', 'schedules_action'));
65    
66      return;
67    }
68    
69    ?>

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

  ViewVC Help
Powered by ViewVC 1.1.2