2017 © Pedro PelĂĄez
 

library drupal-structure

Giving Drupal 6 & 7 a Directory Sturcture like Drupal 8 via Composer

image

davidbarratt/drupal-structure

Giving Drupal 6 & 7 a Directory Sturcture like Drupal 8 via Composer

  • Saturday, September 27, 2014
  • by davidbarratt
  • Repository
  • 2 Watchers
  • 5 Stars
  • 234 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Drupal Structure

Giving Drupal 6 & 7 a Directory Sturcture like Drupal 8 via Composer, (*1)

This script does the following tasks when Composer install and update is run:, (*2)

  1. Creates the folders libraries, modules, themes, and sites in the root
  2. Copies core/sites/README.txt and core/sites/example.sites.php to sites
  3. Copies core/sites/default/default.settings.php to sites/default/default.settings.php
  4. Removes each folder in core/sites that is present in sites
  5. Creates a symbolic link for each site from core/sites to sites
  6. Copies core/sites/all/modules/README.txt to modules/README.txt
  7. Copies core/sites/all/themes/README.txt to themes/README.txt
  8. Create symbolic link from core/sites/all/modules to modules
  9. Create symbolic link from core/sites/all/themes to themes
  10. Create symbolic link from core/sites/all/libraries to libraries
  11. Create sites/sites.php if the file doesn’t already exist
  12. Create symbolic link from core/sites/sites.php to sites/sites.php

Installation

Require this library in your composer.json file, (*3)

{
  "require": {
    "davidbarratt/drupal-structure": "1.0.*@alpha",
  }
}

Add the scripts, (*4)

{
  "scripts": {
    "post-install-cmd": [
      "DavidBarratt\\DrupalStructure\\ScriptHandler::postUpdate"
    ],
    "post-update-cmd": [
      "DavidBarratt\\DrupalStructure\\ScriptHandler::postUpdate"
    ]
  }
}

Configuration

By default, the script assumes that Drupal core is located in the core directory and the resources (modules, themes, etc.) are located in the same directory as your composer.json file., (*5)

However, if you’d like to customize this, you can simply add the parameters in the extra. Here are the defaults (which are not necessary to add):, (*6)

{
  "extra": {
      "drupal-structure": {
        "root": "",
        "core": "core"
      }
  }
}

Usage

You can use this script by simply executing composer install or composer update. Composer will execute the script when the process is finished., (*7)

Example

Here is a more practical example of how you might use this script in a real composer.json file. This setup assumes that the web root is core. However, you could copy index.php and .htaccess and alter them to fit your needs., (*8)

{
  "repositories": [
    {
      "type": "composer",
      "url": "http://static.drupal-packagist.org/v0.2.0/"
    }
  ],
  "require": {
    "mnsami/composer-custom-directory-installer": "1.0.*",
    "drupal/drupal": "~7.0",
    "davidbarratt/drupal-structure": "1.0.*@alpha"
  },
  "extra": {
      "installer-paths":{
        "core/": ["drupal/drupal"]
      }
  },
  "scripts": {
    "post-install-cmd": [
      "DavidBarratt\\DrupalStructure\\ScriptHandler::postUpdate"
    ],
    "post-update-cmd": [
      "DavidBarratt\\DrupalStructure\\ScriptHandler::postUpdate"
    ]
  }
}

For a more complicated example, please see: https://github.com/davidbarratt/drupal7/blob/master/composer.json, (*9)

The Versions

27/09 2014

dev-master

9999999-dev https://github.com/davidbarratt/drupal-structure

Giving Drupal 6 & 7 a Directory Sturcture like Drupal 8 via Composer

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

27/09 2014

1.0.0-alpha1

1.0.0.0-alpha1 https://github.com/davidbarratt/drupal-structure

Giving Drupal 6 & 7 a Directory Sturcture like Drupal 8 via Composer

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires