Drupal Development Basics

Architecture

Drupal used the LAMP (Linux, Apache, MySQL, PHP) architecture. Linux is the operating system, the operating system is the most basic part of this enviroment.

Apache, the webserver handles making the files in the website available on the internet. It also works with PHP to make the programming magic happen on the internet. PHP without an Apache webserver isn't avialable to the web.

PHP provides all the programming that handles the "business logic" and "presentation logic" making the website available. Business logic are things like who can see a certain piece of content or leave comments on a site. Presentaion logic are things like the page layout, color palette ect. In general Drupal Modules are mostly business logic, while Drupal Themes are only presentation logic. The Drupal core, site settings, modules, and themes make up the drupal Code Base.

Hosted Code base

The Drupal "Code Base" we use as a group is checked in to the UCSF version control system. That codebase consists of the Drupal core, the settings.php for each of the hosted mulit-sites, the UCSF supported modules (located in the sites/all directory), UCSF supported themes (also in sites/all), sub-site modules, and sub-site themes.

Drupal Core

Drupal core is the stock element of Drupal. The core Drupal distribution provides a number of features, including:

  • Access statistics and logging
  • Advanced search
  • Blogs, books, comments, forums, and polls
  • Caching and feature throttling for improved performance
  • Descriptive URLs
  • Multi-level menu system
  • Multi-site support
  • Multi-user content creation and editing
  • OpenID support
  • RSS feed and feed aggregator
  • Security and new release update notification
  • User profiles
  • Various access control restrictions (user roles, IP addresses, email)
  • Workflow tools (triggers and actions)

Extending the core

Drupal core is modular, defining a system of hooks and callbacks, which are accessed internally via an API. This design allows third-party contributed (often abbreviated to "contrib") modules and themes to extend or override Drupal's default behaviors without changing Drupal core's code.

Drupal isolates core files from contributed modules and themes. This increases flexibility and security and allows administrators to cleanly upgrade to new releases without overwriting their site's customizations.To maintain this separation, Drupal does not support altering Drupal core's software.

Modules

Contributed modules offer image galleries, custom content types and content listings, WYSIWYG editors, private messaging, third-party integration tools,and more. As of August 2011 the Drupal website lists over 11,000 free modules.

Some of the most commonly used contrib modules include:

  • Content Construction Kit (CCK): allows site administrators to dynamically create content types by extending the database schema. "Content type" describes the kind of information. Content types include, but are not limited to, events, invitations, reviews, articles, and products. The CCK Fields API is in Drupal core in Drupal 7.
  • Views: facilitates the retrieval and presentation, through a database abstraction system, of content to site visitors.
  • Panels: drag and drop layout manager that allows site administrators to visually design their site.

Themes

Contributed themes adapt or replace a Drupal site's default look and feel.

Drupal themes use standardized formats that may be generated by common third-party theme design engines. Many are written in the PHPTemplate engine or, to a lesser extent, the XTemplate engine. Some templates use hard-coded PHP.

The Drupal theming system utilizes a template engine to further separate HTML/CSS from PHP. A popular Drupal contributed module called 'Devel' provides GUI information to developers and themers about the page build.

Community-contributed themes at the Drupal website are released under a free GPL license, and most of them are demonstrated at the Drupal Theme Garden.

Settings.php

Setting.php handles the operations unqiue to that site. In most cases in the UCSF could hosted environment only the database connection will be defined in this file. To see more about this read the page on multi-site setup.

Database(s)

The databases store all the site information. From what module are enabled for a site to the actual content of the site. The database is the heart of any drupal site.

For those intested the schema is outlined here.

Files

In Drupal parlance, files usually refers to uploaded images and other non-code type of files (word docs, PDFs, etc). The files are usually uploaded to via the Drupal CMS. When migrating a new site to staging and production, or on very special occasions with currently production sites these files can be moved into the staging and production environment via SFTP. Files are rarely moved from development once a site is launched. Files uploaded to the site could overwrite the current files on production.