Hi,
As I just check all options with @jmolivas on gitter.im, it's seem there is a problem with Drupal Console on multi sites.
drupal multi:debug output is ok (see my 2 sites)
But ...
deuser@debian:~/www/fwm/web$ drupal --uri=http://supervisionweb.p.net list
Drupal Console version 0.10.5
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-e, --env[=ENV] The Environment name [default: "prod"]
--root[=ROOT] Define the Drupal root to be use in command execution
--no-debug Switches off debug mode
--learning Generate a verbose code output
-t, --target[=TARGET] Site name you want to interact with (for local or remote sites)
-l, --uri=URI URI of the Drupal site to use (for multisite environments or when running on an alternate port)
-y, --yes Skip confirmation and proceed
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
-gc, --generate-chain Shows command options and arguments as yaml output to be used in chain command
-gi, --generate-inline Shows command options and arguments as inline command
-gd, --generate-doc Shows command options and arguments as markdown
Available commands:
_completion BASH completion hook.
about Display basic information about Drupal Console project
chain Chain command execution
complete Shell completion command list
help Displays help for a command
init Copy configuration files to user home directory.
list Lists all available commands
md Download module or modules in application
sd List all known local and remote sites.
self-update Update project to the latest version.
server Runs PHP built-in web server
si Install a Drupal project
sn Create a new Drupal project
td Download theme in application
yd Compare two YAML files in order to find differences between them.
ym Merge one or more YAML files in a new YAML file. Latest values are preserved.
ys Split a YAML file using indent as separator criteria
yu Replace a YAML key in a YAML file.
yuv Update a value for a specific key in a YAML file.
module
module:download Download module or modules in application
multisite
multisite:debug List all multisites available in system
site
site:debug List all known local and remote sites.
site:install Install a Drupal project
site:new Create a new Drupal project
theme
theme:download Download theme in application
yaml
yaml:diff Compare two YAML files in order to find differences between them.
yaml:merge Merge one or more YAML files in a new YAML file. Latest values are preserved.
yaml:split Split a YAML file using indent as separator criteria
yaml:update:key Replace a YAML key in a YAML file.
yaml:update:value Update a value for a specific key in a YAML file.
[WARNING] In order to list all of the available commands you should install
drupal first.
And
deuser@debian:~/www/fwm/web$ drupal --uri=http://supervisionweb.p.net generate:module
[InvalidArgumentException]
There are no commands defined in the "generate" namespace.
Need help please, I think it's a bug :)
Regards
Ok ... working fine, my uri parameter was incorrect.
Painful to use drupal console with multisite :/
I will look for aliases :)
@rroblik what was the issue?
Do you mind to elaborate, based on your comments we can improve the documentation pages:
https://hechoendrupal.gitbooks.io/drupal-console/content/en/using/how-to-use-drupal-console-in-a-multisite-installation.html
@rroblik closing this based on your comment
Ok ... working fine, my uri parameter was incorrect.
Unfortunately I have same problem:
drupal --uri=http://local.site.org list
Drupal Console version 1.0.0-alpha1
...
[WARNING] In order to list all of the available commands you should install drupal first.
I have my site running in virtual machine and tried drupal list command for both local and vm machine. Same error.
Any suggestions?
I had the same issue when doing a fresh install of Drupal with the default installation.
Steps to recreate
download Drupal 8.1.*
create a sites.php and add a new site alias to it.
create a vhost for that site and install the website.
Verify if that site is available with drupal multisite:debug
run the list command on your new created site drupal --uri=http://mysite.dev list
Drupal console now returns the error.
[WARNING] In order to list all of the available commands you should install drupal first.
The fix was, run touch sites/default/settings.php and the re-run the drupal --uri=http://mysite.dev list
I have not digged through the code, but I do suspect that there is a check if sites/default/settings.php somewhere that throws the errors without checking if the drupal console was executed within a multisite environment.
@rroblik @cr0ss @renebakx do you mind to share the site on a repo to clone or steps to configure it to replicate and test this issue and have it fixed.
NOTE: Make sure you remove any sensitive data as database credentials.
I could do that, but it's not really a site ;) My test was a new clone of https://www.drupal.org/project/lightning and instead of creating a default project in sites/default I decided to first setup a .dev site with sites.php
<?php
$sites['lightning.dev'] = 'lightning_test';
?>
Then installed the site, so the config files are writen to sites/lightning_test/ and that contains
settings.local.php
settings.php
settings.php is a copy of sites/default/default.settings.php and the settings.local.php contains the following code :
$databases['default']['default'] = array (
'database' => 'lightning_dev',
'username' => 'root',
'password' => 'root',
'prefix' => '',
'host' => 'localhost',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
// Hook in the development settings
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
// disable render cache
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
and the sites/default/ only contained the two default files.
default.services.yml
default.settings.php
And the the above mentioned steps to reproduce and 'fix' the issue.
The warning only occurs when there is NO sites/default/settings.php file available. Creating a empty file fixes the issue.
I did some quick digging, and i suspect the issue is triggered by the hardcoded constant in Drupal\Console\Helper\DrupalHelper class
const DEFAULT_SETTINGS_PHP = 'sites/default/settings.php';
in conjunction with the isConnectionInfo method, that checks the above declared hardcoded path
$settingsPath = sprintf('%s/%s', $this->root, self::DEFAULT_SETTINGS_PHP);
if (!file_exists($settingsPath)) {
return false;
}
I'am sorry that I don't have a patch to fix this, will see if I can find some more time digging in this issue. I think that it is fixable by making the isConnectionInfo trying to find the local files for the site root if using the --uri parameter or the --root should be the multisite root instead of the Drupal installation root.
Having the same issue, this fixes it (touch sites/default/settings.php)
Many thanks, renebakx, been banging my head against the wall.
Documentation or better error logging is SORELY needed for these cases. I was banging my head on this problem and finally found this page.