This directory contains the "Drupal Script Library". A set of Bash shell scripts for managing a set of Drupal installations. Script homepage: http://toddgee.com/drupalScripts If you find these scripts useful, please leave a comment there. Scripts always available from http://svn.toddgee.com/drupalScripts They may be checked out with the command: $ svn co "http://svn.toddgee.com/drupalScripts" All scripts in this package copyright (C) 2008, 2009 Todd Gee (toddgee.com) Please see the included file COPYING for information on the GNU Public License, under which these scripts are made available to the public. These scripts can leverage the Drush script system. See http://drupal.org/project/drush See also the script drupalManageDrush.sh -- Background These scripts were written in an environment containing many disparate Drupal sites under common management. The first strategy of dealing with the multiple sites was to deploy them all on the same Drupal installation (while still using separate databases). This quickly became difficult because when Drupal/contrib modules were upgraded all sites on the shared installation were affected. Every site needed simultaneous upgrading and verification. The solution was to migrate away from a single, shared Drupal install and to a Drupal install per site. While this solved the issues outline above, it increased the amount of work required to maintain the stable of sites. The scripts provided in this package provide easier management of a collection of Drupal sites. -- Glossary of Terms Install Group - The collection of Drupal sites managed together by the scripts in this library. Installation Site Name - The name of an individual site within an Install Group. This is equal to the domain name used in the URL to access the site. Install Group Root Dir - The common directory that forms the base of the install group. A.K.A. the "Drupal Install Root". Identified by the environment variable "DRUPAL_INSTALL_ROOT" Site Directory - The directory within an installation that contains all the files pertinent to a site. "This directory is sites/" within the installation's sub-tree. It holds any non-core modules and themes installed on that site, the 'files' directory in use by the site, and a directory for backups. -- General Concepts These scripts manage a collection of sites within an Install Group. All installations are located in the Install Group Root Dir. Each installation exists of a standard Drupal CVS checkout. (As noted above) the Site Directory contains all files for that installation. It has the following sub-directories: backups A non web-server readable directory that contains backup information generated by the drupalBackup.sh script. (DB dump, etc.) files The uploaded files directory used by the server. modules The installation directory for modules used by this installation. Contains sub-directory 'contrib' for installed contrib modules installed via Drush from the Drupal projects server. themes The installation directory for themes used by this installation. Contains sub-directory 'contrib' for installed contrib themes installed via Drush from the Drupal projects server. A convention exists that assumes that the admin user's (uid=1) password is identical to the database password. This is not required; but is provided for in the reporting script (drupalReport.sh admin ) and the DB query script (drupalDBQuery resetadmin ). The thinking is that if one is in a position to use the db password, then having uid=1 access is irrelevant. Regarding file permissions set on a Drupal installation: It is difficult to prescribe a common solution because of differences between hosting environments. In general, all directories & files in the installation should be readable (but not writable) by the user making the web call (often 'apache', etc.). The 'sites//files' directory needs to be writable by the calling user. The 'sites//backups' directory should not be readable by the calling user. See the script drupalSetPerms.sh. -- Scripts Every (runnable) script has built in help. Run the script w/ no arguments for usage information. A simple summary of scripts is provided here: bashrc_drupal.sh A script to be sourced in the bash shell of the user of these scripts. Performs all necessary environment setup for these scripts. Provides useful functions. bash_completion.sh A bash programmable completion script that adds -completion support to the scripts below. This is called by the bashrc_drupal.sh file. drupalAlias.sh Creates "site aliases" for an installation allowing the installation to be referred to by another domain name/URL. drupalBackup.sh Dumps state into the sites//backups directory. Dumped information includes a database dump (via drupalDBBackup.sh). drupalDBBackup.sh Calls mysqldump to dumps the site database (used by drupalBackup.sh). drupalDBCreate.sh Creates a new database instance (for environments were mysqladmin is used to create dbs). Can generate db name and db user name/password. drupalDBQuery.sh Runs generic or canned queries against a site db. drupalDeploy.sh Installs and updates Drupal core/modules/themes using Drush. (Performs checks and removes need to remember Drush syntax.) It is with this script that new installations are created. drupalManageDrush.sh Installs the Drush script system in a sub-directory to the directory in which these scripts are installed. drupalManageLibraries.sh Assists in the installation of the 3rd party library files required by various modules. drupalMigrateToDrush.sh A script to migrate from a CVS or Git based deployment (using the old drupalCVSDeploy.sh or drupalGitDeploy.sh scripts) to one based on git. drupalPojectVer.sh Provides information on the Git version tags of contrib projects (modules/themes). drupalReport.sh Reports on various bits of info related to a site. Run script w/ no parameters to see all items and suggestions w/ .bashrc integration. drupalRunCron.sh Runs the cron tasks associated with one or all sites. drupalSetAccessCheck.sh Sets the $accessCheck variable in the update.php file (Drupal 5) or the $update_free_access variable in settings.php file (Drupal 6+) enabling updating the installation without the admin being logged in. drupalSetDBParams.sh Sets the database connection parameters in a site's settings file. Can run in batch or interactive mode. drupalSetPerms.sh Sets file permissions on a Drupal install that works for many installation environments. drupalSiteCopy.sh Copies the files and db contents from an existing source site to a new domain name. The operation will migrate the the files and db contents from an existing source site to the new domain name. After the operation, the new site should be completely usable under the new name. drupalLibrary.sh A set of common procedures used by the rest of the Drupal library scripts. No stand alone functionality. mysqlLibrary.sh A standard library containing MySQL functionality. No stand alone functionality. stdLibrary.sh A standard library used by Todd for many of his script libraries. No stand alone functionality.