5 * Implementation of hook_install()
7 * This will automatically install the database tables for the TinyMCE module for both the MySQL and PostgreSQL databases.
9 * If you are using another database, you will have to install the tables by hand, using the queries below as a reference.
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.
14 function tinymce_install() {
15 switch ($GLOBALS['db_type']) {
18 $query1 = db_query("CREATE TABLE IF NOT EXISTS {tinymce_settings} (
19 name varchar(128) NOT NULL default '',
20 settings text NOT NULL default '',
22 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
24 $query2 = db_query("CREATE TABLE IF NOT EXISTS {tinymce_role} (
25 name varchar(128) NOT NULL default '',
26 rid tinyint(3) unsigned NOT NULL default '0',
27 PRIMARY KEY (name,rid)
28 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
30 if ($query1 && $query2) {
36 $query1 = db_query("CREATE TABLE {tinymce_settings} (
37 name varchar(128) NOT NULL default '',
38 settings text NOT NULL default '',
39 PRIMARY KEY (name));");
41 $query2 = db_query("CREATE TABLE {tinymce_role} (
42 name varchar(128) NOT NULL default '',
43 rid smallint NOT NULL default '0',
44 PRIMARY KEY (name,rid));");
46 if ($query1 && $query2) {
56 drupal_set_message(t('TinyMCE module installed successfully.'));
59 drupal_set_message(t('Table installation for the TinyMCE module was unsuccessful. The tables may need to be installed by hand. See tinymce.install file for a list of the installation queries.'), 'error');
63 function tinymce_update_1() {
64 return _system_update_utf8(array('tinymce_settings', 'tinymce_role'));