카테고리 없음

Drupal Drush

nistmeltheniacusa 2021. 7. 20. 16:48


Pick a version

Each version of Drush supports multiple Drupal versions. Drush 7 is current stable Drush.

Drush VersionDrush BranchPHPCompatible Drupal versionsCode Status
Drush 9master5.5+D7, D8
Drush 88.x5.4.5+D6, D7, D8
Drush 77.x5.3.0+D6, D7
Drush 66.x5.3.0+D6, D7Unsupported
Drush 55.x5.2.0+D6, D7Unsupported
Drush 44.x5.2.0+D5, D6, D7Unsupported
Drush 33.x5.2.0+D5, D6Unsupported

Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt. Drush core ships with lots of useful commands for interacting with code like modules/themes/profiles. Drush is a shell-based application used to control, manipulate, and administer Drupal sites. On the surface, drush is an excellent tool for updating site modules, but here is a more comprehensive list of features for drush: Quick status report (get Drupal site version).

Pick an install method

The four sections below describe ways to install Drush. None is superior to the others.

Drupal Drush Not Working

Composer - One Drush for all Projects

  • Optional - video instructions by Drupalize.me.
  • Install Composer globally.
  • To install Drush 7.x (stable):

  • To install Drush 8.x (dev) which is required for Drupal 8:

  • Now add Drush to your system path by placing export PATH='$HOME/.composer/vendor/bin:$PATH' into your ~/.bash_profile (Mac OS users) or into your ~/.bashrc (Linux users).

  • To update to a newer version (what you get depends on your specification in ~/.composer/composer.json):

  • Alternate commands to install some other variant of Drush:

  • To install for all users on the server:

Drupal Drush

Tips:

  • If Drush cannot find an autoloaded class, run composer self-update. Drush often tracks composer changes closely, so you may have some problems if you are not running a recent version.
  • If composer cannot find a requirement, and suggests that The package is not available in a stable-enough version according to your minimum-stability setting, then place the following in $HOME/.composer/composer.json:

Merge this in with any other content that may already exist in this file.

See Configure for next steps.

Composer - One Drush per Project

  • If your web site is built from a composer.json file (see https://github.com/drupal-composer/drupal-project), add the following to the require section: 'drush/drush': '7.*'
  • Run composer install for a new project or composer update for an existing one. Do so from the same directory as composer.json.
  • Optional: Copy the /examples/drush file to your project root and modify to taste. This is a handy launcher script.
  • To update, change the drush/drush line and run composer update.

Git Clone (i.e. manual install)

  1. Place the uncompressed drush.tar.gz, drush.zip, or cloned git repository in a directory that is outside of your web root.
  2. Make the 'drush' command executable:

    $ chmod u+x /path/to/drush/drush

  3. Configure your system to recognize where Drush resides. There are 3 options:

    1. Create a symbolic link to the Drush executable in a directory that is already in your PATH, e.g.:

      $ ln -s /path/to/drush/drush /usr/bin/drush

    2. Explicitly add the Drush executable to the PATH variable which is defined in the the shell configuration file called .profile, .bash_profile, .bash_aliases, or .bashrc that is located in your home folder, i.e.:

      export PATH='$PATH:/path/to/drush:/usr/local/bin'

    3. Add an alias for drush (this method can also be handy if you want to use 2 versions of Drush, for example Drush 5 or 6 (stable) for Drupal 7 development, and Drush 7 (master) for Drupal 8 development). To add an alias to your Drush 7 executable, add this to you shell configuration file (see list in previous option): $ alias drush-master=/path/to/drush/drush

    For options 2 and 3 above, in order to apply your changes to your current session, either log out and then log back in again, or re-load your bash configuration file, i.e.:

    $ source .bashrc

  4. Test that Drush is found by your system:

    $ which drush

  5. From Drush root, run Composer to fetch dependencies.

    $ composer install

See Configure for next steps.

Windows Zip Package

Windows support has improved, but is still lagging. For full functionality, consider running Linux/Unix/OSX via Virtualbox, or other virtual machine platform. The Vlad virtual machine is popular.

These Windows packages include Drush and its dependencies (including MSys).

  • 7.0.0 (stable).
  • 6.6.0.
  • 6.0.

Unzip the downloaded file to anywhere thats convenient on your system.

Whenever the documentation or the help text refers to drush [option] <command> or something similar, 'drush' may need to be replaced by 'drush.bat'.

Most Drush commands will run in a Windows CMD shell or PowerShell, but the Git Bash shell provided by the Git for Windows installation is the preferred shell in which to run Drush commands.

When creating site aliases for Windows remote machines, pay particular attention to information presented in the example.aliases.drushrc.php file, especially when setting values for 'remote-host' and 'os', as these are very important when running Drush rsync and Drush sql-sync commands.

Drush is a command line shell and Unix scripting interface for Drupal. Drush core ships with lots of useful commands for interacting with code like modules/themes/profiles. Similarly, it runs update.php, executes SQL queries and DB migrations, and misc utilities like run cron or clear cache. Developers love the generate command, which jump starts your coding project by writing ready-to-customize PHP and YML files. Drush can be extended by 3rd party commandfiles.

Resources¶

  • Installing and Upgrading (Drush 8)
  • Usage (Drush 8)
  • Drush comes with a full test suite powered by PHPUnit. Each commit gets tested by our CI bots.

Support¶

  • Post support requests to Drupal Answers. Tag question with drush.
  • Report bugs and request features in the GitHub Drush Issue Queue.
  • Use pull requests (PRs) to contribute to Drush. Guidelines.

Code of Conduct¶

The Drush project expects all participants to abide by the Drupal Code of Conduct.

Drupal Drush

Drush Download

FAQ¶

What does Drush stand for?¶

A: The Drupal Shell.

How do I pronounce Drush?¶

Some people pronounce the dru with a long 'u' like Drupal. Fidelity pointsgo to them, but they are in the minority. Most pronounce Drush so that itrhymes with hush, rush, flush, etc. This is the preferred pronunciation.

Credits¶

Drush Update Db

  • Maintained by Moshe Weitzman with much help from the folks listed at https://github.com/orgs/drush-ops/people.
  • Originally developed by Arto Bendiken for Drupal 4.7.
  • Redesigned by Franz Heinzmann in May 2007 for Drupal 5.
  • Thanks to JetBrains for supporting this project and open source software.