Drupal 7 - File Structure

  • user notice: The custom_breadcrumbs_nodeapi() function called token replacement with an array rather than a string for $text in /home/redleafmedia/redleafmedia.com/sites/all/modules/token/token.module on line 263.
  • user notice: The custom_breadcrumbs_nodeapi() function called token replacement with an array rather than a string for $text in /home/redleafmedia/redleafmedia.com/sites/all/modules/token/token.module on line 263.

The Drupal community is preparing to release version 7.0 in the near future, and I thought that I would welcome this release by taking a detailed look under the hood to see exactly how the shiny new version does what it does.  I have no idea how in depth I will go, but I hope that this is a good learning experience for myself and anyone who happens upon this series of posts.  In this post I'll take a look at Drupal 7's basic file structure.

As is the case with previous versions of Drupal, the site's root directory has an .htaccess file, several informational text files (e.g. INSTALL.txt), php files, and directories.

The php files in the root directory are:

  • authorize.php (new to D7)
  • cron.php
  • index.php
  • install.php
  • update.php
  • xmlrpc.php

The directories are:

  • database (new to D7)
  • files
  • includes
  • misc
  • modules
  • profiles
  • scripts
  • sites
  • themes

On my fresh install the 'database' and 'files' directories are empty.

'includes' Directory

The 'includes' directory contains many '.inc' files which are written in php (like the vast majority of Drupal code) and provide much of Drupal's infrastructure.  There is a new directory titled 'database' that houses the logic behind Drupal's new abstracted database system.  There is another new directory called 'filetransfer' which would logically contain code related to moving files in and out of the Drupal file system.  The final new directory is titled 'tests', but it is empty in my fresh install.  I presume that it has something to due with the increased push for simple tests on Drupal code.

'misc' Directory

As its name would imply, the 'misc' directory contains a lot of random files that don't fit anywhere else.  There are random images that are used within Drupal (e.g. checkmarks, throbber gifs, etc.).  There are also a lot of Javascript files that provide some of the jQuery flashiness that comes with Drupal (e.g. tabledrag.js).  There is a 'ui' directory that appears to contain the jQuery UI library.  This library is essentially an extension of the conventional jQuery Jasvascript library, providing many of the usual features that a developer would want in a user interface.

'modules' and 'themes' directories

These are where Drupal's "core" modules and themes, and all of their associated files, reside.

'scripts' directory

This directory contains various shell scripts.  I do not believe that these scripts are called by Drupal under normal operation.

'sites' directory

The sites diretory is where all "contributed" themes and modules should live.  These themes and/or modules will typically go into the "all" directory (e.g. 'sites/all/themes/mytheme' or 'sites/all/modules/mymodule', unless you are running a multi-site installation and want different sites to have different modules or themes.  The 'default' directory is where Drupal main configuration file ("settings.php") resides.  There is also a "files" folder in the "default" directory, which serves a similar purpose to the "files" folder in the root directory: storing files that are specific to the site.

 

This is obviously a very cursory look at the Drupal 7 file system, but I hope to springboard into more detailed posts in the near future.  Next up will be the root .htaccess file.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.