? includes/table.inc
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/README.txt,v
retrieving revision 1.49
diff -u -p -r1.49 README.txt
--- README.txt	1 Sep 2010 15:04:51 -0000	1.49
+++ README.txt	29 Sep 2010 02:57:07 -0000
@@ -48,13 +48,25 @@ For Linux/Unix/Mac:
 
      NOTE FOR ADVANCED USERS
      - If you want to run drush with a specific version of php, rather than the
-       one found by the drush command, you can instead create an alias that
-       executes the drush.php file directly:
-       $ alias drush='/path/to/php/php5 /path/to/drush/drush.php'
-       If you do this, to allow Drush to detect the number of available columns,
-       you need to add the line 'export COLUMNS' to the .profile file in your
-       home folder.
-
+       one found by the drush command, you can set the environment variable
+       DRUSH_PHP to point to the specific php executable that you want to use.
+       In the .profile in your home folder:
+         DRUSH_PHP=/path/to/php
+         export DRUSH_PHP
+     - Drush needs to run with more priveledges than the web server needs
+       to provide to Drupal.  For example, Drupal will run just fine with
+       "disable_functions = exec" in php.ini, but exec must not be disabled
+       when using drush.  Php is often configured to use separate php.ini
+       files for cli and web server use.  If your system uses the same
+       php.ini file for both environments, and you would like to define
+       a special php.ini file specificly for use with drush, you can do so
+       by defining the environment variable DRUSH_PHP_INI.  In your .profile
+       folder, add:
+         DRUSH_PHP_INI=/path/to/php.ini
+         export DRUSH_PHP_INI
+       Alternately, just put your php.ini file in the .drush folder in your
+       home directory, or in /etc/drush.
+       
   4. Start using drush by running "drush" from your Drupal root directory.
 
      (or, if you did not follow step 3, by running "/path/to/drush/drush"
Index: drush
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/drush,v
retrieving revision 1.21
diff -u -p -r1.21 drush
--- drush	12 Sep 2010 04:12:47 -0000	1.21
+++ drush	29 Sep 2010 02:57:07 -0000
@@ -10,7 +10,7 @@ ORIGDIR=$(pwd)
 SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
 
 # Resolve symlinks - this is the equivalent of "readlink -f", but also works with non-standard OS X readlink.
-while [ -h $SELF_PATH ]; do
+while [ -h "$SELF_PATH" ]; do
     # 1) cd to directory of the symlink
     # 2) cd to the directory of where the symlink points
     # 3) Get the pwd
@@ -22,7 +22,7 @@ done
 cd "$ORIGDIR"
 
 # Build the path to drush.php.
-SCRIPT_PATH=$(dirname $SELF_PATH)/drush.php
+SCRIPT_PATH=$(dirname "$SELF_PATH")/drush.php
 case $(uname -a) in
   CYGWIN*)
     SCRIPT_PATH=$(cygpath -w -a -- "$SCRIPT_PATH") ;;
@@ -40,19 +40,39 @@ if [ -z $COLUMNS ] && [ -n "$TERM" ]; th
   export COLUMNS=$(tput cols)
 fi
 
-# Special case for *AMP installers, since they normally don't set themselves as the default cli php out of the box.
-for php in /Applications/MAMP/bin/php5/bin/php /Applications/MAMP/bin/php5.2/bin/php /Applications/MAMP/bin/php5.3/bin/php /opt/lampp/bin/php /Applications/xampp/xamppfiles/bin/php /Applications/acquia-drupal/php/bin/php; do
-  if [ -x $php ]; then
-    exec $php $SCRIPT_PATH --php="$php" "$@"
+# Next determine which php to use.
+if [ ! -z "$DRUSH_PHP" ] ; then
+  # Use the DRUSH_PHP environment variable if it is available.
+  php="$DRUSH_PHP"
+else
+  # If our PHP is not specified via environment variable, then
+  # default to using the php that we find on the PATH.
+  # Note that we need the full path to php here for Dreamhost, which behaves oddly.  See http://drupal.org/node/662926
+  php=$(which php)
+
+  # We also check for a command line (cli) version of php, and if found use that.
+  which php-cli >/dev/null 2>&1
+  if [ "$?" = 0 ] ; then
+    php=`which php-cli`
   fi
-done
 
-# We check for a command line (cli) version of php, and if found use that.
-which php-cli >/dev/null 2>&1
-if [ "$?" = 0 ] ; then
-  exec php-cli $SCRIPT_PATH --php="php-cli" "$@"
-else
-  # Alternatively we run with straight php, which works on most other systems.
-  # The --php=`which php` is for Dreamhost, which behaves oddly.  See http://drupal.org/node/662926
-  exec php $SCRIPT_PATH --php=`which php` "$@"
+  # Special case for *AMP installers, since they normally don't set themselves as the default cli php out of the box.
+  for amp_php in /Applications/MAMP/bin/php5/bin/php /Applications/MAMP/bin/php5.2/bin/php /Applications/MAMP/bin/php5.3/bin/php /opt/lampp/bin/php /Applications/xampp/xamppfiles/bin/php /Applications/acquia-drupal/php/bin/php; do
+    if [ -x "$amp_php" ]; then
+      php=$amp_php
+    fi
+  done
 fi
+
+# Check to see if the user has provided a php.ini file particularly for drush
+if [ ! -z "$DRUSH_PHP_INI" ] ; then
+  php_args="--php-ini $DRUSH_PHP_INI"
+elif [ -f $HOME/.drush/php.ini ] ; then
+  php_args="--php-ini $HOME/.drush/php.ini"
+elif [ -f /etc/drush/php.ini ] ; then
+  php_args="--php-ini /etc/drush/php.ini"
+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" $php_args "$SCRIPT_PATH" --php="\"$php\" $php_args" "$@"
