University of Oregon

Drush enable all inactive modules

I’ve been using make files a lot lately and when ever I’m ready to release an updated file I like to verify that all the project versions are up to date.
To leverage Drupal’s update functionality each project needs to be enabled. So I typically generate a new site from the make file and enable all the projects with drush. The key to that is the combination of commands:

drush en `drush pm-list --status="disabled,not installed" --pipe`

Here I’m enabling a list of module; specifically drush’s list of disabled and not installed modules.

drush pm-list --status="disabled,not installed"

That code gets you part of the way there. The addition of this:

--pipe

makes it a script-able list. Then when I surround that with back-ticks and feed it to

drush en `...`

I’m in business. (more…)

Drupal 7 Field Collection for build an order form

I’ve been leveraging the Field Collection module in a few projects lately and today I created a quick demo of how it could be used in a print shop order form.
Thanks to Joseph (here at the UO and directcommunities.com) who demonstrated the Field Collection module recently.

The form needed to allow an individual to upload a file and then choose certain options for that file. There is a requirement that the user would be able to upload an infinite number of files and each file can have unique options. This is the current version: image of form fields required

Here’s what my Field Collection option looked like:
Screen shot of form with field collection
(more…)

bash function – cddrush

This is a quick function that reduces the keystrokes for using ‘drush dd’ in a cd command like so:

cd `drush dd @my.site.alias:%site`

Which is great but this is simpler

cddrush my.site.alias

Oh, that’s nice!
(more…)

Drupal DB backup bash script with Drush and Git

I like to make incremental backups of my drupal databases. To do that I’ve tried combine the best practices* into one bash script that I can run periodically and easily.
The end result is a bash function that’s easy and user friendly.
It works by leveraging Drush aliases and the drush sql-dump command in combination with git.

Usage is simple. From the command line:

$ dg_db_backup drush.alias "commit message" 

Note: dg_db_backup -> drush git database backup
(more…)

Drush Make post processing – Adding module type

We’re using drush make files to keep our Drupal sites updated.
Aegir will build a platform (base install for a multisite) from a make file. I believe it also re-builds the platform from that makeFile each time the platform is verified.

This is pretty handy but requires some leg work up front to generate the makeFile. http://drushmake.me is the go-to site to get a fresh makeFile built.
Though I just looked at the drush help file and saw that there’s a drush make-generate command ($ drush make-generate myMakeFile.make) that

Attempts to generate a makefile from the current Drupal install, specifying project version numbers unless not known or otherwise specified. Unversioned projects will be interpreted later by drush make as “most recent stable release”

So I gave it a shot and it did a great job.
(more…)

Drupal & shell bookmarklet for updating modules 5 (updated – mulitple dbs, backup only option)

*Note: This is a follow up to the posts:

First off: here is the bookmarklet:
This first one is bare-bones; you get prompted for every var:
Install Mods Prompt

This next one needs to be customized to contain your directory and server data but then you don’t have to answer questions every time:
Install mods mysite
You can use http://subsimple.com/bookmarklets/jsbuilder.htm to edit the bookmarklet and set the defaults before saving it.

Now for the details:
I’ve refined the module install bookmarklets once again.
As with the previous versions: click the bookmarklet on a Drupal project page, pick the module and get the ssh script to install it.
Click the bookmarklet on your admin/reports/updates and get the code to install all the recommended updates.
This is tailored to work on our server and doesn’t work on our shell environment. Although it could with some modifications.
At this point you need to cut and paste the file and database backup lines independently because they each require passwords.
I’ll work towards a version that allows a single cut and paste.
(more…)

Drupal & shell bookmarklet for updating modules 4 (updated – bookmarklet w/ base code)

*Note: A new post is available here: Drupal & shell bookmarklet for updating modules 5 (updated – mulitple dbs, backup only option)

This is a follow up to the posts:

Here they are.
This first one is bare-bones; you get prompted for every var:
Install Mods Prompt

This one needs to be customized to contain your directory and server data but then you don’t have to answer questions every time:
Install mods mysite
You can use http://subsimple.com/bookmarklets/jsbuilder.htm to edit the bookmarklet and set the defaults before saving it.

Details
I’ve refined the module install bookmarklets again.
I considered abandoning these in favor of the drush component but drush requires php 5.2 and we’re still using 5.1 at this point.
This works pretty well for me. Click it on a Drupal project page, pick the module and get the ssh to install it.
Click it on the admin/reports/updates and get the code to install all the recommended updates
(more…)