Updated with 5.5 changes
[project/tinymce.git] / tinymce.install
1 <?php
2 // $Id$
3
4 /**
5 * Implementation of hook_install()
6 *
7 * This will automatically install the database tables for the TinyMCE module for both the MySQL and PostgreSQL databases.
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 tinymce_install() {
15 switch ($GLOBALS['db_type']) {
16 case 'mysql':
17 case 'mysqli':
18 db_query("CREATE TABLE {tinymce_settings} (
19 name varchar(128) NOT NULL default '',
20 settings text,
21 PRIMARY KEY (name)
22 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
23
24 db_query("CREATE TABLE {tinymce_role} (
25 name varchar(128) NOT NULL default '',
26 rid tinyint(3) unsigned NOT NULL default '0',
27 PRIMARY KEY (name,rid)
28 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
29 break;
30
31 case 'pgsql':
32 db_query("CREATE TABLE {tinymce_settings} (
33 name varchar(128) NOT NULL default '',
34 settings text,
35 PRIMARY KEY (name)
36 );");
37
38 db_query("CREATE TABLE {tinymce_role} (
39 name varchar(128) NOT NULL default '',
40 rid smallint NOT NULL default '0',
41 PRIMARY KEY (name,rid)
42 );");
43 break;
44 }
45 }
46
47 function tinymce_update_1() {
48 return _system_update_utf8(array('tinymce_settings', 'tinymce_role'));
49 }
50
51 /**
52 * Implementation of hook_uninstall()
53 */
54 function tinymce_uninstall() {
55 db_query('DROP TABLE {tinymce_settings}');
56 db_query('DROP TABLE {tinymce_role}');
57 }