diff --git a/commands/core/core.drush.inc b/commands/core/core.drush.inc index 5e901b4fdc..e4d97ce259 100644 --- a/commands/core/core.drush.inc +++ b/commands/core/core.drush.inc @@ -106,6 +106,7 @@ function core_drush_command() { function core_drush_engine_drupal() { $engines = array(); $engines['update'] = array(); + $engines['environment'] = array(); return $engines; } @@ -424,12 +425,12 @@ function core_watchdog_format_message($watchdog) { function drush_core_watchdog_delete($type = NULL) { if ($type == "all") { // D7: ought to be a dynamic query. - drush_op('db_query', 'DELETE FROM {watchdog}'); // indiscriminately delete all - drush_log(dt('Deleted !n rows.', array('!n' => db_affected_rows())), 'ok'); + drush_op('db_query', 'DELETE FROM {watchdog}'); // Indiscriminately delete all + drush_log(dt('Deleted all rows.'), 'ok'); } elseif (!empty($type)) { drush_op('db_query', 'DELETE FROM {watchdog} WHERE type = \'%s\'', $type); - drush_log(dt('Deleted !n rows.', array('!n' => db_affected_rows())), 'ok'); + drush_log(dt('Deleted all rows.'), 'ok'); } else { drush_set_error(dt('Please specify a message type, or "all" to delete all messages.')); diff --git a/commands/core/drupal/environment.inc b/commands/core/drupal/environment.inc new file mode 100644 index 0000000000..9848d492e4 --- /dev/null +++ b/commands/core/drupal/environment.inc @@ -0,0 +1,29 @@ + $module){ + $module_info[$module_name]->info = drupal_parse_info_file(dirname($module->filename) .'/'. $module->name .'.info'); + } + return $module_info; +} + +/** + * Get theme information for all installed themes. + * + * @return + * An array containing theme info for all installed themes. + */ +function _drush_get_themes() { + return _system_get_theme_data(); +} \ No newline at end of file diff --git a/commands/core/drupal/update_6.inc b/commands/core/drupal/update_6.inc index ec595f7ccd..a313f16d02 100644 --- a/commands/core/drupal/update_6.inc +++ b/commands/core/drupal/update_6.inc @@ -149,8 +149,8 @@ function update_check_incompatibility($name, $type = 'module') { // Store values of expensive functions for future use. if (empty($themes) || empty($modules)) { - $themes = _system_theme_data(); - $modules = module_rebuild_cache(); + $themes = drush_get_themes(); + $modules = drush_get_modules(); } if ($type == 'module' && isset($modules[$name])) { diff --git a/commands/core/drupal/update_7.inc b/commands/core/drupal/update_7.inc index c1880b850a..de4fcf0d2f 100644 --- a/commands/core/drupal/update_7.inc +++ b/commands/core/drupal/update_7.inc @@ -246,8 +246,8 @@ function update_check_incompatibility($name, $type = 'module') { // Store values of expensive functions for future use. if (empty($themes) || empty($modules)) { - $themes = _system_theme_data(); - $modules = module_rebuild_cache(); + $themes = drush_get_themes(); + $modules = drush_get_modules(); } if ($type == 'module' && isset($modules[$name])) { @@ -418,7 +418,7 @@ function update_main() { drupal_load('module', 'filter'); // Set up $language, since the installer components require it. - drupal_init_language(); + drupal_language_initialize(); // Set up theme system for the maintenance page. drupal_maintenance_theme(); @@ -430,7 +430,7 @@ function update_main() { // been created yet. drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_DATABASE); include_once DRUPAL_ROOT . '/includes/install.inc'; - drupal_install_init_database(); + drupal_install_initialize_database(); spl_autoload_unregister('drupal_autoload_class'); spl_autoload_unregister('drupal_autoload_interface'); // The new {blocked_ips} table is used in Drupal 7 to store a list of @@ -451,13 +451,8 @@ function update_main() { // Updates only run reliably if user ID #1 is logged in. For example, node_delete() requires elevated perms in D5/6. if (!drush_get_context('DRUSH_USER')) { - // Remove after http://drupal.org/node/439236 lands. - require(DRUPAL_ROOT . '/modules/field/field.crud.inc'); - require(DRUPAL_ROOT . '/modules/field/field.autoload.inc'); - drush_set_option('user', 1); drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_LOGIN); - } drupal_maintenance_theme(); diff --git a/commands/pm/pm.drush.inc b/commands/pm/pm.drush.inc index 85ef7a480f..4e9a435347 100644 --- a/commands/pm/pm.drush.inc +++ b/commands/pm/pm.drush.inc @@ -213,7 +213,7 @@ function pm_module_manage($modules = array(), $enable = TRUE) { require_once('./'. drupal_get_path('module', 'system') .'/system.module'); } - $module_info = module_rebuild_cache(); + $module_info = drush_get_modules(); $enabled = array(); foreach ($module_info as $module_name => $module) { // In Drupal 5, system_modules() returns NULL for the dependency list of the module if there are no dependencies. @@ -274,7 +274,7 @@ function pm_module_manage($modules = array(), $enable = TRUE) { drupal_form_submit('system_modules', $form_state); } - $module_info = module_rebuild_cache(); + $module_info = drush_get_modules(); foreach ($modules as $module_name) { if ($enable) { if ($module_info[$module_name]->status) { diff --git a/includes/command.inc b/includes/command.inc index 2c8323e5fb..2654e1dcb3 100644 --- a/includes/command.inc +++ b/includes/command.inc @@ -404,7 +404,7 @@ function _drush_find_commandfiles($phase) { case DRUSH_BOOTSTRAP_DRUPAL_FULL: // Add enabled module paths. Since we are bootstrapped, // we can use the Drupal API. - $files = module_rebuild_cache(); + $files = drush_get_modules(); foreach ($files as $file) { if ($file->status) { $searchpath[] = dirname($file->filename); diff --git a/includes/drush.inc b/includes/drush.inc index 741efaed9a..85399dc686 100644 --- a/includes/drush.inc +++ b/includes/drush.inc @@ -264,7 +264,7 @@ function drush_op($function) { * * @see t() */ -function dt($string, $args = NULL) { +function dt($string, $args = array()) { if (function_exists('t')) { return t($string, $args); } diff --git a/includes/environment.inc b/includes/environment.inc index 31647417b0..98710d76af 100644 --- a/includes/environment.inc +++ b/includes/environment.inc @@ -819,3 +819,33 @@ function drush_valid_db_credentials() { return TRUE; } } + +/** + * Get module information for all installed modules. Wrapper for _drush_get_modules(). + * + * @return + * An array containing module info for all installed modules or FALSE on error. + */ +function drush_get_modules() { + if(drush_include_engine('drupal', 'environment')){ + return _drush_get_modules(); + } + else { + return drush_set_error('DRUSH_CORE', dt('Drush was unable to load module information.')); + } +} + +/** + * Get theme information for all installed themes. Wrapper for _drush_get_themes(). + * + * @return + * An array containing theme info for all installed themes or FALSE on error. + */ +function drush_get_themes() { + if(drush_include_engine('drupal', 'environment')){ + return _drush_get_themes(); + } + else { + return drush_set_error('DRUSH_CORE', dt('Drush was unable to load theme information.')); + } +} \ No newline at end of file