? .komodotools ? drush.komodoproject ? tests ? win.patch ? commands/core/.cvsignore ? commands/core/drupal/.patch ? commands/pm/.cvsignore ? examples/.cvsignore ? includes/table.inc Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/drush/README.txt,v retrieving revision 1.55 diff -u -F '^f' -p -r1.55 README.txt --- README.txt 11 Dec 2010 04:49:36 -0000 1.55 +++ README.txt 12 Dec 2010 09:40:25 -0000 @@ -90,7 +90,7 @@ For Linux/Unix/Mac: For Windows: - Follow step 1. Use drush by navigating to /path/to/drush and running 'drush.bat'. - - You have to install gzip, libarchive, tar, wget, and less executables. Go to + - You have to install gzip, libarchive, tar, wget, ncurses, and less executables. Go to http://gnuwin32.sourceforge.net/packages.html and install the packages. Add the folder %ProgramFiles%\GnuWin32\bin to your PATH. Documentation can be found at http://drupal.org/node/594744 Index: drush =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/drush/drush,v retrieving revision 1.25 diff -u -F '^f' -p -r1.25 drush --- drush 10 Nov 2010 13:57:54 -0000 1.25 +++ drush 12 Dec 2010 09:40:25 -0000 @@ -85,5 +85,5 @@ fi # Pass in the path to php so that drush knows which one # to use if it re-launches itself to run subcommands -exec $php "$SCRIPT_PATH" "$@" --php="$php" +exec "$php" "$SCRIPT_PATH" "$@" --php="$php" Index: drush.bat =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/drush/drush.bat,v retrieving revision 1.4 diff -u -F '^f' -p -r1.4 drush.bat --- drush.bat 31 Dec 2009 22:02:55 -0000 1.4 +++ drush.bat 12 Dec 2010 09:40:25 -0000 @@ -1,3 +1,4 @@ @echo off REM See http://drupal.org/node/506448 for more information. +REM TODO: Check required Cygwin packages? - http://www.cygwin.com/cygwin-ug-net/using-utils.html#cygcheck @php.exe "%~dp0drush.php" %* Index: commands/core/site_install.drush.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/site_install.drush.inc,v retrieving revision 1.13 diff -u -F '^f' -p -r1.13 site_install.drush.inc --- commands/core/site_install.drush.inc 8 Dec 2010 14:58:47 -0000 1.13 +++ commands/core/site_install.drush.inc 12 Dec 2010 09:40:25 -0000 @@ -106,14 +106,34 @@ function drush_core_pre_site_install() { $command_parameter_name = 'command'; break; } - $execute = "$scheme_command $credentials --$command_parameter_name"; + $execute = "$scheme_command $credentials "; - if (drush_op_system("$execute='DROP DATABASE IF EXISTS $db_quoted_name'")) { - drush_set_error(dt('Could not drop database: @name', array('@name' => $db_name))); - return; + // Save $query to a tmp file. We will redirect it in. Fewer shell scaping issues that way. + $query = "DROP DATABASE IF EXISTS $db_quoted_name"; + if ($filename = drush_save_data_to_temp_file($query)) { + // In --simulate mode, drush_op will show the call to mysql or psql, + // but the sql query itself is stored in a temp file and not displayed. + // We will therefore show the query explicitly in the interest of full disclosure. + if (drush_get_context('DRUSH_SIMULATE')) { + drush_print('sql-query: ' . $query); + } + if (drush_op_system("$execute < $filename")) { + drush_set_error(dt('Could not drop database: @name', array('@name' => $db_name))); + return; + } } - if (drush_op_system("$execute='CREATE DATABASE $db_quoted_name'")) { - drush_set_error(dt('Could not create new database: @name', array('@name' => $db_name))); + + $query = "CREATE DATABASE $db_quoted_name"; + if ($filename = drush_save_data_to_temp_file($query)) { + // In --simulate mode, drush_op will show the call to mysql or psql, + // but the sql query itself is stored in a temp file and not displayed. + // We will therefore show the query explicitly in the interest of full disclosure. + if (drush_get_context('DRUSH_SIMULATE')) { + drush_print('sql-query: ' . $query); + } + if (drush_op_system("$execute < $filename")) { + drush_set_error(dt('Could not drop database: @name', array('@name' => $db_name))); + } return; } } Index: includes/environment.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/environment.inc,v retrieving revision 1.107 diff -u -F '^f' -p -r1.107 environment.inc --- includes/environment.inc 6 Dec 2010 21:57:08 -0000 1.107 +++ includes/environment.inc 12 Dec 2010 09:40:25 -0000 @@ -932,7 +932,8 @@ function _drush_bootstrap_drupal_login() function drush_cwd() { // We use PWD if available because getcwd() resolves symlinks, which // could take us outside of the Drupal root, making it impossible to find. - // $_SERVER['PWD'] isn't set on windows and generates a Notice. + // $_SERVER['PWD'] isn't set on some versions of windows + // and generates a Notice. $path = isset($_SERVER['PWD']) ? $_SERVER['PWD'] : ''; if (empty($path)) { $path = getcwd(); @@ -951,7 +952,13 @@ function drush_cwd() { */ function _drush_convert_path($path) { $path = str_replace('\\','/', $path); - $path = preg_replace('/^\/cygdrive\/([A-Za-z])(.*)$/', '\1:\2', $path); + + // Use `cygpath` to convert to Windows path (e.g. c:\foo\bar). + // $path can be like /home/weitzman or /cygdrive/c/cygwin/home/weitzman + if (substr(PHP_OS, 0, 3) == 'WIN' && drush_shell_exec('cygpath --windows %s', $path)) { + $output = drush_shell_exec_output(); + $path = $output[0]; + } return $path; } @@ -1186,7 +1193,7 @@ function drush_valid_db_credentials() { /** * Determine a proper way to call drush again * - * This check if we were called directly or as an argument to some + * This checks if we were called directly or as an argument to some * wrapper command (php and sudo are checked now). * * Calling ./drush.php directly yields the following environment: @@ -1211,13 +1218,15 @@ function drush_valid_db_credentials() { * @see DRUSH_COMMAND */ function drush_find_drush() { - $php = drush_get_option('php'); + $php = _drush_convert_path(drush_get_option('php')); + $drush = _drush_convert_path($_SERVER['argv'][0]); if (isset($php)) { - $drush = $php . " " . realpath($_SERVER['argv'][0]) . " --php='$php'"; - } else { - $drush = realpath($_SERVER['argv']['0']); + $full = $php . " " . $drush . " --php='$php'"; + } + else { + $full = $drush; } - return $drush; + return $full; } /**