- Patch #354162 by killes: convert install.inc to new database layer.
parent
c3ada1c861
commit
4d482a23ad
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue