Having converted the Optimizely module to run under D8 beta 4, I thought I'd get drush working under D8 as well.
Here's what I got when I downloaded the archive, installed drush as I had done previously for D7, and typed in drush status for a D8 site:
PHP Fatal error: Class 'Drupal' not found in /var/www/html/opti/core/includes/bootstrap.inc on line 171
Oops, outdated archive, dated July 2013. Do not use the archive at
drush 8.x-6.0-rc1
https://www.drupal.org/node/2041157
Drush is now maintained on GitHub at https://github.com/drush-ops/drush
According to the docs there, Drush 7 is the version that works with Drupal 8. Unfortunately, at the time I visited the repo, the build was flagged as "failing".
Masochist that I am, I decided to push on anyway to see how much mileage I might get. (The logs show that Drush is in very active development.)
There are a lot of different ways to install Drush — see Install - Drush docs.
Sometimes I just like to install in a slower but more transparent way.
So on my Linux Mint system, I downloaded the zip archive from the GitHub repo, extracted it, and created a symbolic link in /usr/local/bin to the drush executable so that this version of drush would be globally available.
From the Drush root, I ran composer install to fetch the dependencies. If you don't already have composer installed, that will need to be done first.
At that point I had a working copy of Drush.
At the root of a D8 site,
# drush status
worked as expected.
# drush cc all
gave the error message
`cache-clear all` is deprecated for Drupal 8 and later. Please use the `cache-rebuild` command instead.
The replacement commands for D8 are
# drush cache-rebuild
# drush cr
For the examples module, these worked fine to download and to enable.
# drush dl examples
# drush en examples
But
# drush dis examples
gave this expected error message
Drupal 8 does not support disabling modules. Use pm-uninstall instead
# drush pm-uninstall examples
# drush pmu examples
And at the root of a D7 site, all of the above commands worked except that you still use
# drush cc all
Sources:
Drush
https://www.drupal.org/project/drush
drush-ops / drush
https://github.com/drush-ops/drush
Install - Drush docs
http://docs.drush.org/en/master/install/
Upgrading Drush to work with Drupal 8
https://drupalize.me/blog/201408/upgrading-drush-work-drupal-8
No comments:
Post a Comment