| 1 |
<?php |
<?php |
| 2 |
|
// $Id$ |
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* Implementation of hook_install(). |
| 6 |
|
*/ |
| 7 |
function user_tags_install() { |
function user_tags_install() { |
| 8 |
drupal_set_message('Installing user_tags.....'); |
drupal_set_message('Installing user_tags.....'); |
| 9 |
switch ($GLOBALS['db_type']) { |
switch ($GLOBALS['db_type']) { |
| 10 |
case 'mysql': |
case 'mysql': |
| 11 |
case 'mysqli': |
case 'mysqli': |
| 12 |
$query1 = db_query("CREATE TABLE {term_user} ( |
$query1 = db_query("CREATE TABLE {term_user} ( |
| 13 |
vid int(10) unsigned NOT NULL default '0', |
vid int(10) unsigned NOT NULL default '0', |
| 14 |
tid int(10) unsigned NOT NULL default '0', |
tid int(10) unsigned NOT NULL default '0', |
| 15 |
uid int(10) unsigned NOT NULL default '0', |
uid int(10) unsigned NOT NULL default '0', |
| 16 |
PRIMARY KEY (`tid`,`uid`) |
PRIMARY KEY (`tid`,`uid`) |
| 17 |
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
| 18 |
|
|
| 19 |
$query2 = db_query("CREATE TABLE {user_tags_vocabulary} ( |
$query2 = db_query("CREATE TABLE {user_tags_vocabulary} ( |
| 20 |
vid INT NOT NULL |
vid INT NOT NULL |
| 21 |
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
| 22 |
|
|
| 23 |
if ($query1 && $query2) { |
if ($query1 && $query2) { |
| 24 |
$success = TRUE; |
$success = TRUE; |
| 25 |
} |
} |
| 26 |
break; |
break; |
| 27 |
} |
} |
| 28 |
|
|
| 29 |
//if all the tables were installed give confirmation, otherwise display error. |
//if all the tables were installed give confirmation, otherwise display error. |
| 30 |
if ($success) { |
if ($success) { |
| 31 |
drupal_set_message(t("user_tags module installed successfully.")); |
drupal_set_message(t("user_tags module installed successfully.")); |
| 32 |
} |
} |
| 33 |
else { |
else { |
| 34 |
drupal_set_message(t("user_tags module was not installed. Please view the user_tags module folder and read the INSTALL.txt"), 'error'); |
drupal_set_message(t("user_tags module was not installed. Please view the user_tags module folder and read the INSTALL.txt"), 'error'); |
| 35 |
} |
} |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
/** |
| 39 |
|
* Implementation of hook_uninstall(). |
| 40 |
|
*/ |
| 41 |
|
function user_tags_uninstall() { |
| 42 |
|
variable_del('user_tags_vocabulary_list'); |
| 43 |
|
variable_del('user_tags_user_page'); |
| 44 |
} |
} |