2

New to Drupal... I was wondering if it was possible to install it with the core and the modules kept in separate folders, rather than in a hierarchy. A bit like with WordPress, so to speak:

/.htaccess <-- site is here, in /, and in git
/drupal    <-- Drupal core, pulled as a git submodules
/content   <-- plugins and themes, each pulled as git submodules

I'm guessing it's possible, but the installation manual and a bit of googling (skeleton, subfolder, enterprise, etc.) led me nowhere. If so, I could use a pointer to get me in the right direction. If not, will it be possible with Drupal 8, which unless I am mistaking is using Symfony components?

  • Btw, sorry about the cross-post. I hadn't realized there was a special SE. – Denis de Bernardy Oct 16 '13 at 19:17
  • Your question is about file structure, but I guess from your mention of git submodules that you are really interested in how to manage core and modules in a convenient way. If so, please ask a separate question on that topic, as there's more to be said about that topic than file systems. – Letharion Oct 19 '13 at 15:41
  • @Letharion: not quite. I'm looking to do the same as the WP Skeleton template that I linked to. The master project is in git, WP is in /wp, plugins are in /content/plugins (rather than /wp/wp-content/plugins), etc. WordPress has a bunch of defines to enable this. I'm guessing that Drupal 7 does so as well (Symfony's autoloader should allow to do this in Drupal 8), and was hoping for a pointer to locate them. – Denis de Bernardy Oct 19 '13 at 16:28
  • right, so a quick look at the WP skeleton template suggests that what you are looking for is the equivalent of "define( 'WP_CONTENT_DIR', dirname( FILE ) . '/content' );". Drupal however, bases all file searches from "define('DRUPAL_ROOT', getcwd());" which is the very first statement in index.php. While in theory you could alter that, all sorts of havoc is likely to arise from it. Hence my answer below, is "no". There is no "Find files X here, and files Y there". – Letharion Oct 19 '13 at 17:25
1
+50

install it with the core and the modules kept in separate folders, rather than in a hierarchy

In short, no.

Drupal must be able to expect to find files in a certain location, and that is not dynamically configurable. The very first line of code Drupal executes is define('DRUPAL_ROOT', getcwd());, and file wise, most things are based on that constant.

Symfony, and PSR-0, doesn't inherently change that. PSR-0 only defines the directory structure around files, not where to find them. With that said, I haven't looked in enough detail at D8 to know if there's a simple way to alter where the autoloader looks for files.

If your filesystem (and webserver) supports symlinks, you can work around the problem by symlinking the appropriate directories in place.

  • Accepting it as is, I guess... Mind expanding a little on how to use git submodules in a convenient way? Your other comment made me wonder if there are things I'd want to know beyond git basics. – Denis de Bernardy Oct 19 '13 at 18:06
  • I don't mind at all, but it depends on what you are trying to achieve. :) I prefer to organize things with a make-file (or soon, hopefully a composer.json), since submodules have quite a few shortcomings. (See codingkilledthecat.wordpress.com/2012/04/28/… for examples). You can see drupal.stackexchange.com/questions/33403/… for a brief discussion on make-files. Again, depending on what exactly you aim to achieve, there's a lot that can be said, and it doesn't all fit into comments. :) – Letharion Oct 19 '13 at 18:46
  • Basically the same as what I do with the wp skeleton: git submodule add [plugin|theme], alongside an update.sh that takes care of git submodule update + git pull. I'll open a new question if needed. (Interesting reads, btw; thanks for your time.) – Denis de Bernardy Oct 19 '13 at 19:24
  • Those are technical implementations though, which doesn't say anything about what problem you are trying to solve. (It also happens to sound like it could bite you badly when deploying to production, but I could be wrong) – Letharion Oct 19 '13 at 19:55
  • Still, if you just want to copy the idea as closely as possible, a symlink for the sites directory should solve that for you. – Letharion Oct 19 '13 at 19:56
-1

try and make a link and see if it works. I have done that for files in drupal and it should work for modules too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.