diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-01-04 18:50:23 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-01-04 18:50:23 +0000 |
commit | 4d482a23ad10ef08072e381a7d6f8e8f114f6221 (patch) | |
tree | ab980fc4385d93d76c4497c6fa556a11f4181820 /includes/install.inc | |
parent | c3ada1c8619edf6db79a7af9a3a7bf62bc02c06b (diff) | |
download | brdo-4d482a23ad10ef08072e381a7d6f8e8f114f6221.tar.gz brdo-4d482a23ad10ef08072e381a7d6f8e8f114f6221.tar.bz2 |
- Patch #354162 by killes: convert install.inc to new database layer.
Diffstat (limited to 'includes/install.inc')
-rw-r--r-- | includes/install.inc | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/includes/install.inc b/includes/install.inc index 7e822edb1..4299cfd1b 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -134,8 +134,8 @@ function drupal_get_installed_schema_version($module, $reset = FALSE, $array = F if (!$versions) { $versions = array(); - $result = db_query("SELECT name, schema_version FROM {system} WHERE type = '%s'", 'module'); - while ($row = db_fetch_object($result)) { + $result = db_query("SELECT name, schema_version FROM {system} WHERE type = :type", array(':type' => 'module')); + foreach ($result as $row) { $versions[$row->name] = $row->schema_version; } } @@ -152,7 +152,10 @@ function drupal_get_installed_schema_version($module, $reset = FALSE, $array = F * The new schema version. */ function drupal_set_installed_schema_version($module, $version) { - db_query("UPDATE {system} SET schema_version = %d WHERE name = '%s'", $version, $module); + db_update('system') + ->fields(array('schema_version' => $version)) + ->condition('name', $module) + ->execute(); } /** @@ -572,7 +575,17 @@ function drupal_install_system() { $system_versions = drupal_get_schema_versions('system'); $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED; - db_query("INSERT INTO {system} (filename, name, type, owner, status, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, $system_version); + db_insert('system') + ->fields(array('filename', 'name', 'type', 'owner', 'status', 'schema_version')) + ->values(array( + 'filename' => $system_path . '/system.module', + 'name' => 'system', + 'type' => 'module', + 'owner' => '', + 'status' => 1, + 'schema_version' => $system_version + )) + ->execute(); // Now that we've installed things properly, bootstrap the full Drupal environment drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); module_rebuild_cache(); @@ -609,10 +622,15 @@ function drupal_uninstall_modules($module_list = array()) { } $placeholders = implode(', ', array_fill(0, count($paths), "'%s'")); - $result = db_query('SELECT * FROM {menu_links} WHERE router_path IN (' . $placeholders . ') AND external = 0 ORDER BY depth DESC', $paths); + $result = db_select('menu_links') + ->fields('menu_links') + ->condition('router_path', $paths, 'IN') + ->condition('external', 0) + ->orderBy('depth') + ->execute(); // Remove all such items. Starting from those with the greatest depth will // minimize the amount of re-parenting done by menu_link_delete(). - while ($item = db_fetch_array($result)) { + foreach ($result as $item) { _menu_delete_item($item, TRUE); } } |