summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-09-10 06:38:20 +0000
committerDries Buytaert <dries@buytaert.net>2009-09-10 06:38:20 +0000
commit029c48c68d7f4f2bc94e93e3333908ca158433c5 (patch)
treebf1fef18db8910f94ee977861829b966d42efb00 /includes
parent82b51dff1d2fd90b439129c70b415d30a06d1bce (diff)
downloadbrdo-029c48c68d7f4f2bc94e93e3333908ca158433c5.tar.gz
brdo-029c48c68d7f4f2bc94e93e3333908ca158433c5.tar.bz2
- Patch #306151 by agentrickard, David_Rothstein, Dave Reid, dbabbage, moshe weitzman: automatically install/uninstall schema.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc3
-rw-r--r--includes/database/database.inc4
-rw-r--r--includes/install.inc5
3 files changed, 9 insertions, 3 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 75f6f820b..781e27a9c 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -4798,9 +4798,10 @@ function drupal_get_schema_unprocessed($module, $table = NULL) {
if (!is_null($table) && isset($schema[$table])) {
return $schema[$table];
}
- else {
+ else if (!empty($schema)) {
return $schema;
}
+ return array();
}
/**
diff --git a/includes/database/database.inc b/includes/database/database.inc
index 22bd8fe2e..f298376ff 100644
--- a/includes/database/database.inc
+++ b/includes/database/database.inc
@@ -2130,7 +2130,9 @@ function db_close(array $options = array()) {
* A Schema API table definition array.
*/
function db_create_table(&$ret, $name, $table) {
- return Database::getConnection()->schema()->createTable($ret, $name, $table);
+ if (!db_table_exists($name)) {
+ return Database::getConnection()->schema()->createTable($ret, $name, $table);
+ }
}
/**
diff --git a/includes/install.inc b/includes/install.inc
index 0e68a1b06..e8efe4b07 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -586,8 +586,9 @@ function drupal_install_modules($module_list = array(), $disable_modules_install
*/
function _drupal_install_module($module) {
if (drupal_get_installed_schema_version($module, TRUE) == SCHEMA_UNINSTALLED) {
- module_load_install($module);
drupal_load('module', $module);
+ drupal_install_schema($module);
+ // Now allow the module to perform install tasks.
module_invoke($module, 'install');
$versions = drupal_get_schema_versions($module);
drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);
@@ -663,6 +664,8 @@ function drupal_uninstall_modules($module_list = array()) {
// Uninstall the module.
module_load_install($module);
module_invoke($module, 'uninstall');
+ drupal_uninstall_schema($module);
+
watchdog('system', '%module module uninstalled.', array('%module' => $module), WATCHDOG_INFO);
// Now remove the menu links for all paths declared by this module.