Is there an equivalent to the /etc/drush/ folder when running drush on a windows box?

i.e. the "system wide configuration folder"

Comments

izkreny’s picture

AFAIK, drush @ Win(32) is not looking automatically for any configurations files in /etc equivalent folder on Windows OS, so you are out of luck here IMHO.

greg.1.anderson’s picture

What is the /etc equivalent folder on Windows OS, and how do you find it with php?

izkreny’s picture

/etc equivalent folder on Windows OS is probably http://en.wikipedia.org/wiki/Windows_Registry

Or maybe %SystemRoot%\system32\drivers\etc\ folder?

But, why bother with running Drupal on Windows (IIS) when today you can easily run LAMP (with even preinstalled Drupal 6.x) from your favorite OS via VritualBox? :)

greg.1.anderson’s picture

I think the Windows Registry is a poor choice for drush configuration. The 'drivers' folder doesn't seem natural either, unless the convention has evolved that this folder is the equivalent of /etc on Linux.

I'm definitely with you that LAMP on a virtual server beats IIS, and bash is a better environment than DOS for shell scripting (tho cygwin isn't so bad).

greg.1.anderson’s picture

Status: Active » Postponed (maintainer needs more info)

Anyway, I don't think Windows users are out of luck, we just need to identify the right folder. Maybe 'drivers' is it. I'm not enough into Windows to know. Marking this as 'postponed' until someone can come up with a definitive suggestion.

hutch’s picture

IIRC you do a search for 'hosts.sam', that should point to the winbox equivalent of /etc. Wether that applies to the current versions of Windows I don't know.

greg.1.anderson’s picture

Yes, you're right; hosts and hosts.sam are in system32\drivers\etc\, so I guess that means that drivers\etc is the Windows equivalent for /etc.

To fix this issue, all that we'd need to do is set the ETC_PREFIX option to the ssytem32/drivers folder on Windows machines. Is there a slick way to find that folder from PHP?

jmbarlow’s picture

Quick update after a bit of playing around.

Placing aliases.drushrc.php and the drushrc.php in the same directory as drush.php - the installation folder - is one way of getting a sort-of system-wide configuration on Win32.

The order of precedence given in the examples is:

* 1. Drupal site folder (e.g sites/{default|example.com}/drushrc.php).
* 2. Drupal installation root.
* 3. In any location, as specified by the --config (-c) option.
* 4. User Home folder (i.e. ~/.drushrc.php).
* 5. System wide configuration folder (e.g. /etc/drush/drushrc.php).
* 6. Drush installation folder.

Maybe add a comment: No such item as "5" on Win32

kulov’s picture

Component: Interoperability » PM (dl, en, up ...)
Assigned: Unassigned » kulov
Status: Postponed (maintainer needs more info) » Active

%windir%\system\drivers\etc is not the place to store system wide settings for applications.
One may want to use getenv('%ALLUSERSPROFILE%') and create Drush folder in there. This Drush folder can be then searched in step 5 of #8. However the technique does not differ too much than placing drush.rc files in installation directory of drush.php.

@mariomaric - This should solve the issue for you. Can you confirm?

kulov’s picture

Status: Active » Closed (works as designed)

closed because of inactivity

greg.1.anderson’s picture

Assigned: kulov » Unassigned
Category: support » feature
Status: Closed (works as designed) » Active

getenv('%ALLUSERSPROFILE%') sounds like a good idea to me. If we don't do this, we should at least adjust the docs as described in #8.

greg.1.anderson’s picture

Assigned: Unassigned » greg.1.anderson
Issue tags: +Windows

Could revisit this

beltofte’s picture

Status: Active » Needs review
StatusFileSize
new2.31 KB

Attached a patch adding a system wide configuration folder on Windows. It's using getenv('ALLUSERSPROFILE')\Drush, which is C:\ProgramData\Drush on Windows Vista, Windows 7, Windows Server 2008 and later versions. On previous versions is the folder C:\Documents and Settings\All Users\Drush.

The patch is covering the places I could find where Drush is defining these folders, and in the example.drushrc.php file.

@greg.1.anderson: Can you confirm if I found all places that needs to be changed or if it should be fixed other places too?

beltofte’s picture

Assigned: greg.1.anderson » beltofte
greg.1.anderson’s picture

That looks correct to me; I'll try to find time to power up the old Windows VM and try it out. Have you tried the test scripts on Windows, by any chance? I did some work on them a while back, but can't remember how close they are to functional. It would be very useful to get some help here.

beltofte’s picture

I have setup Jenkins / PHPUnit on a VM with Windows Server 2008 R2, but the tests scripts are failing max in the installation of Drupal and therefore rather difficult to run the tests. I need to debug the site install issue when I have the time. Right now is our (Propeople) priority some open Windows issues that Microsoft has asked to fix. After that will I focus on the PHPUnit test again.

greg.1.anderson’s picture

Great, thanks.

greg.1.anderson’s picture

Assigned: beltofte » greg.1.anderson
greg.1.anderson’s picture

Status: Needs review » Fixed

Committed. Also searches for commandfiles in getenv('ALLUSERSPROFILE')\Drush (equivalent of /etc/drush /usr/share/drush/commands on linux). Automatically downloads Drush commandfiles to this directory if it exists and is writable. Remove code that automatically created the global folder.

Commit 4e1b4e6.

Status: Fixed » Closed (fixed)
Issue tags: -Windows

Automatically closed -- issue fixed for 2 weeks with no activity.