drupal-console icon indicating copy to clipboard operation
drupal-console copied to clipboard

[multisite:command] Add Command for creating multisite using Drupal console

Open Ashwini7 opened this issue 10 years ago • 8 comments

Problem / motivation

It's really difficult to create multi site with so many configuration and creating the directories for specific sub sites.

Solution

Command should contains most of the config of multisite creation.

Config options:

  1. --file => create a copy of example.sites.php to sites.php in sites/ directory.
  2. --site-name => copy the default directory to your site name directory into sites/ directory.

Ashwini7 avatar May 13 '16 18:05 Ashwini7

I am currently working on this here:

https://github.com/jludwig/DrupalConsole/tree/command-for-new-multisite

The command seems to work so far.

jludwig avatar May 26 '16 06:05 jludwig

Sure @jludwig Please assign it to yourself. Also, it would be great if you can share the workflow of multisite command of yours.

Ashwini7 avatar May 26 '16 11:05 Ashwini7

@Ashwini7 I haven't figured out how to assign it to myself yet. Here's the --help output for it (without the global options):

Usage:
  multisite:new [options] [--] [<sites-subdir>]

Arguments:
  sites-subdir               Name of directory under 'sites' which should be created.

Options:
      --site-uri[=SITE-URI]  Site URI to add to sites.php
      --copy-install         Copies existing site from the default install.

Help:
 The multisite:new command assists in setting up new multisite installs by creating the needed subdirectory and files, and can optionally copy an existing 'default' installation

So, if someone wants to just create a directory with a settings.php file they could do:

$ drupal multisite:new files_only

If they wanted to instead copy what was already installed on default and add it to sites.php they could do:

$ drupal multisite:new --site-uri copy-install.localhost --copy-install copy_install

At this point, sites.php will have an entry with copy-install.localhost, and the copy_install directory will have the settings.php from /sites/default and the files directory placed there. If the files directory is located elsewhere, this needs to be handled manually right now.

A related issue is that site install fails when sites.php is present (issue #2333). On my own installs, I've scripted site:install to move sites.php out of the way before executing site:install. multisite:new currently detects and uses as the base for sites.php if the actual sites.php is not present, but I don't want to include that in the pull request until figuring out what will be the actual solution to #2333.

jludwig avatar May 26 '16 14:05 jludwig

Pull request: #2335

jludwig avatar May 26 '16 22:05 jludwig

@Ashwini7 does this fulfill your need?

jludwig avatar Jun 13 '16 21:06 jludwig

@jludwig Great work! I haven't tested yet. I am hospitalized facing some medical problem. I will look into once I am back to work. Feel free to resolve this issue. If you think issue has been addressed in your PR.

Thanks!

Ashwini7 avatar Jun 14 '16 11:06 Ashwini7

@jludwig Great work! I haven't tested yet. I am hospitalized facing some medical problem. I will look into once I am back to work. Feel free to resolve this issue. If you think issue has been addressed in your PR.

Thanks!

Ashwini7 avatar Jun 14 '16 11:06 Ashwini7

I believe this feature already checked in to drupal-console long back. Hence, closing this issue.

Ashwini7 avatar Mar 15 '19 10:03 Ashwini7