Working with Drupal
The last couple of weeks have been very exciting as I've managed to migrate two websites (www.onecoursesource.com and www.technicaltrainingresources.com) that were created in Drupal and helped to build a new one in Drupal (www.missionbaymassage.com). In the last year, I've been doing more and more with PHP programming directly on our company's Point Of Sale system. At first, I found that working with Drupal was confusing, as what thought would be a web page file was really just an entry in the Drupal database.
What Got Me Started
The Fedora server that I set up several years to run postfix/dovecot/squirrelmail/ftp/http for our two company domains was at end-of-life for software updates, so we needed to upgrade. Rather than actually upgrading, a new server was installed, and I was tasked with making the new server do everything that the old server was doing.
How I Fixed Problems
Download drush and install it. drupal.org does keep files for the release of drush, but the project is now maintained at github in the repository: https://github.com/drush-ops/drush
There is documentation available at http://docs.drush.org/ and specifically for installation for English users at http://docs.drush.org/en/master/install/.
Start by executing the following commands (the exact file name may vary):
Examine the output of the PATH directories listed for an optimal one where you have write permission
In my case, I was limited to my home directory/bin, so I executed -C option with the name of my home directory:
tar -xvf drush-7.x-5.9.tar.gz -C ~/
Next, create the links to the executables in the directory where you have write permission:
ln -s ~/drush/drush ~/bin/drush
ln -s ~/drush.php ~/bin/drush.php
Now, you can use drush, but before you execute it, you should change to directory where drupal is installed. In a few of my sites this is /usr/share/drupal, but in this example for HostGator, it is ~/public_html. In order to use drush, cd to the directory where drupal is installed:
If you successfully executed drush, then you can see all the sub commands available:
Execute a drush command. Run `drush help [command]` to view command-specific help. Run
`drush topic` to read even more documentation.
Global options (see `drush topic core-global-options` for the full list):
-d, --debug Display even more information, including
-h, --help This help system.
-ia, --interactive Force interactive mode for commands run on
multiple targets (e.g. `drush @site1,@site2
-n, --no Assume 'no' as answer to all prompts.
if not 'php' in the path.
-p, --pipe Emit a compact representation of the
command for scripting.
, --root= Drupal root directory to use (default:
-s, --simulate Simulate all relevant actions (don't
actually change the system).
, URI of the drupal site to use (only needed
in multisite environments or when running
on an alternate port).
-v, --verbose Display extra information about the
--version Show drush version.
-y, --yes Assume 'yes' as answer to all prompts.
Core drush commands: (core)
archive-dump (ard, Backup your code, files, and database into a single file.
archive-restore Expand a site archive into a Drupal web site.
cache-clear (cc) Clear a specific cache, or all drupal caches.
cache-get (cg) Fetch a cached object and display it.
cache-set (cs) Cache an object expressed in JSON or var_export() format.
core-config (conf, Edit drushrc, site alias, and Drupal settings.php files.
core-cron (cron) Run all cron hooks in all active modules for specified site.
core-execute (exec, Execute a shell command. Usually used with a site alias.
core-quick-drupal Download, install, serve and login to Drupal with minimal
(qd) configuration and dependencies.
core-requirements Provides information about things that may be wrong in your
(status-report, rq) Drupal installation, if any.
core-rsync (rsync) Rsync the Drupal tree to/from another server using ssh.
core-status (status, Provides a birds-eye view of the current Drupal installation,
st) if any.
core-topic (topic) Read detailed documentation on a given topic.
drupal-directory Return path to a given module/theme directory.
help Print this help message. See `drush help help` for more
image-flush Flush all derived images for a given style.
php-eval (eval, ev) Evaluate arbitrary php code after bootstrapping Drupal (if
php-script (scr) Run php script(s).
queue-list Returns a list of all defined queues
queue-run Run a specific queue by name
search-index Index the remaining search items without wiping the index.
search-reindex Force the search index to be rebuilt.
search-status Show how many items remain to be indexed out of the total.
self-update Check to see if there is a newer Drush release available.
shell-alias (sha) Print all known shell alias records.
site-alias (sa) Print site alias records for all known site aliases and local
site-install (si) Install Drupal along with modules/themes/configuration using
the specified install profile.
site-reset Reset a persistently set site.
site-set (use) Set a site alias to work on that will persist for the current
site-ssh (ssh) Connect to a Drupal site's server via SSH for an interactive
session or to run a shell command
test-clean Clean temporary tables and files.
test-run Run tests. Note that you must use the --uri option.
updatedb (updb) Apply any database updates required (as with running
usage-send (usend) Send anonymous Drush usage information to statistics logging
site. Usage statistics contain the Drush command name and the
Drush option names, but no arguments or option values.
usage-show (ushow) Show Drush usage information that has been logged but not sent.
Usage statistics contain the Drush command name and the Drush
option names, but no arguments or option values.
variable-delete Delete a variable.
variable-get (vget) Get a list of some or all site variables and values.
variable-set (vset) Set a variable.
version Show drush version.
watchdog-delete Delete watchdog messages.
watchdog-list Show available message types and severity levels. A prompt will
(wd-list) ask for a choice to show watchdog messages.
watchdog-show Show watchdog messages.
Runserver commands: (runserver)
runserver (rs) Runs a lightweight built in http server for development.
Field commands: (field)
field-clone Clone a field and all its instances.
field-create Create fields and instances. Returns urls for field editing.
field-delete Delete a field and its instances.
field-info View information about fields, field_types, and widgets.
field-update Return URL for field editing web page.
Project manager commands: (pm)
pm-disable (dis) Disable one or more extensions (modules or themes).
pm-download (dl) Download projects from drupal.org or other sources.
pm-enable (en) Enable one or more extensions (modules or themes).
pm-info (pmi) Show detailed info for one or more extensions (modules or
pm-list (pml) Show a list of available extensions (modules and themes).
pm-refresh (rf) Refresh update status information.
pm-releasenotes Print release notes for given projects.
pm-releases (rl) Print release information for given projects.
pm-uninstall Uninstall one or more modules.
pm-update (up) Update Drupal core and contrib projects and apply any pending
database updates (Same as pm-updatecode + updatedb).
pm-updatecode (upc) Update Drupal core and contrib projects to latest recommended
SQL commands: (sql)
sql-cli (sqlc) Open a SQL command-line interface using Drupal's credentials.
sql-connect A string for connecting to the DB.
sql-create Create a database.
sql-drop Drop all tables in a given database.
sql-dump Exports the Drupal DB as SQL using mysqldump or equivalent.
sql-query (sqlq) Execute a query against the site database.
sql-sync Copy and import source database to target database. Transfers
User commands: (user)
user-add-role (urol) Add a role to the specified user accounts.
user-block (ublk) Block the specified user(s).
user-cancel (ucan) Cancel a user account with the specified name.
user-create (ucrt) Create a user account with the specified name.
user-information Print information about the specified user(s).
user-login (uli) Display a one time login link for the given user account
(defaults to uid 1).
user-password (upwd) (Re)Set the password for the user account with the specified
user-remove-role Remove a role from the specified user accounts.
user-unblock (uublk) Unblock the specified user(s).
Other commands: (make)
make Turns a makefile into a working Drupal codebase.
make-generate Generate a makefile from the current Drupal site.
What Kept Me Going
It was frustrating and difficult to migrate the existing websites because I was not involved in creating them. My girlfriend was frustrated at the same time that the company hosting her website was not responsive to her requests. I had been reluctant to create a website for my girlfriend, as I was not wanting to have to be the one who would have to be responsive to all of her requests.
I had reached a tipping point. I decided that if I helped my girlfriend create a new site in Drupal, then I might have a better understanding of the whole framework. I was right! While my girlfriend still has plenty of requests, gradually I'm teaching her how to use Drupal (and HTML) to solve them on her own.