Skip to content

Commit

Permalink
Fix #2895. Add descriptive help for legacy commands. (#2897)
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed Sep 1, 2017
1 parent d129657 commit efee454
Showing 1 changed file with 56 additions and 20 deletions.
76 changes: 56 additions & 20 deletions src/Commands/LegacyCommands.php
Original file line number Diff line number Diff line change
@@ -1,115 +1,151 @@
<?php
namespace Drush\Commands;

use Drush\Drush;

class LegacyCommands extends DrushCommands
{

/**
* Drupal 8 does not support disabling modules. See pm-uninstall command.
*
* @command pm-disable
* @aliases dis
* @allow-additional-options
* @hidden
*/
public function disable()
{
$msg = 'Drupal 8 does not support disabling modules. See pm-uninstall command.';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-disable');
}

/**
* The pm-info command was deprecated. Please see `drush pm-list` and `composer show`
*
* @command pm-info
* @aliases pmi
* @allow-additional-options
* @hidden
*/
public function info()
{
$msg = 'The pm-info command was deprecated. Please see `drush pm-list` and `composer show`';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-info');
}

/**
* The pm-projectinfo command was deprecated. Please see `drush pm-list` and `composer show`
*
* @command pm-projectinfo
* @allow-additional-options
* @hidden
*/
public function projectInfo()
{
$msg = 'The pm-projectinfo command was deprecated. Please see `drush pm-list` and `composer show`';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-projectinfo');
}

/**
* The pm-refresh command was deprecated. It is no longer useful.
*
* @command pm-refresh
* @aliases rf
* @allow-additional-options
* @hidden
*/
public function refresh()
{
$msg = 'The pm-refresh command was deprecated. It is no longer useful.';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-refresh');
}

/**
* The pm-updatestatus command was deprecated. Please see `composer show` and `composer outdated`. For security release notification, your project should depend on https://github.com/drupal-composer/drupal-security-advisories.
*
* @command pm-updatestatus
* @aliases ups
* @allow-additional-options
* @hidden
*/
public function updatestatus()
{
$msg = 'The pm-updatestatus command was deprecated. Please see `composer show` and `composer outdated`. For security release notification, your project should depend on https://github.com/drupal-composer/drupal-security-advisories.';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-updatestatus');
}

/**
* The pm-updatecode command was deprecated. Please see `composer outdated` and `composer update`. For security release notification, your project should depend on https://github.com/drupal-composer/drupal-security-advisories.
*
* @command pm-updatecode
* @aliases pm-update,upc
* @allow-additional-options
* @hidden
*/
public function updatecode()
{
$msg = 'The pm-updatecode command was deprecated. Please see `composer outdated` and `composer update`. For security release notification, your project should depend on https://github.com/drupal-composer/drupal-security-advisories.';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-updatecode');
}

/**
* The pm-releasenotes command was deprecated. No replacement available.
*
* @command pm-releasenotes
* @aliases rln
* @allow-additional-options
* @hidden
*/
public function releaseNotes()
{
$msg = 'The pm-releasenotes command was deprecated. No replacement available.';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-releasenotes');
}

/**
* The pm-releases command was deprecated. Please see `composer show <packagename>`
*
* @command pm-releases
* @aliases rl
* @allow-additional-options
* @hidden
*/
public function releases()
{
$msg = 'The pm-releases command was deprecated. Please see `composer show <packagename>`';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-releases');
}

/**
* Make has been removed, in favor of Composer. Use the make-convert command in Drush 8 to quickly upgrade your build to Composer.
*
* @command make
* @aliases make-convert,make-generate,make-lock,make-update
* @allow-additional-options
* @hidden
*/
public function make()
{
$msg = 'Make has been removed, in favor of Composer. Use the make-convert command in Drush 8 to quickly upgrade your build to Composer.';
$this->logger()->notice($msg);
$this->legacyFailureMessage('make');
}

/**
* dl has been deprecated. Please build your site using Composer. Add new projects with composer require drupal/[project-name]. Use https://www.drupal.org/project/composer_generate to build a composer.json which represents the the enabled modules on your site.
*
* @command pm-download
* @aliases dl
* @allow-additional-options
* @hidden
*/
public function download()
{
$msg = 'dl has been deprecated. Please build your site using Composer. Add new projects with composer require drupal/[project-name]. Use https://www.drupal.org/project/composer_generate to build a composer.json which represents the the enabled modules on your site.';
$this->logger()->notice($msg);
$this->legacyFailureMessage('pm-download');
}

/**
* Throw and exception taken from the description of the legacy command.
*
* @param string $commandName
* @throws \Exception
*/
public function legacyFailureMessage($commandName)
{
$application = Drush::getApplication();
$command = $application->get($commandName);
$message = $command->getDescription();
throw new \Exception($message);
}
}

0 comments on commit efee454

Please sign in to comment.