firefox
Automating Drupal module activation
When upgrading a large Drupal site between major revisions, I find myself doing the update over and over again. Since one site I maintain has 149 modules, and a few more that come packaged with other contrib that are not activated, I decided I don't want to click all those checkboxes every time I do a trial upgrade. While I could have probably come up with some way to just activate every module easily, I really wanted selective activation.
Thanks to Greasemonkey, a Firefox addon, I have automated the activation of all the modules I want.
First, make a list of all the modules you want to activate. You can do this by viewing the HTML source of your modules page and looking for the name of your modules in the form input fields named something like status[coder]. You'll just want the coder part. I recommend putting each module on its own line so if you change your mind on one module, you can just comment out that line.
var modules = new Array();
modules = Array(
// REMOVE DEVEL MODULES BEFORE LIVE LAUNCH
// Development
'coder',
'devel',
'reroute_email',
'cache_disable',
'simpletest',
// END DEVELOPMENT MODULES
// Core - optional
'help',
'menu',
'path',
'syslog',
'tracker',
'update',
// Other
'advanced_help',
'cvs_deploy'
);The working part of the Greasemonkey script is a loop that examines the name of all the checkboxes on the page.
var chkboxes=document.getElementsByTagName('input');
for (var i=0; i < chkboxes.length; i++) {
if (chkboxes[i].type=="checkbox" && in_modules(chkboxes[i].name, modules)) {
chkboxes[i].checked=true;
}
}Then the part that finds the name of the module is similar to PHP's core in_array() function, with a change to wrap the status[] input array around the string of the module name you're searching for to activate. Remember, the name of each checkbox is actually something like status[coder], not just the module name as we have in the modules array at the start of the file.
function in_modules(needle, haystack) {
var found = false, key;
for (key in haystack) {
if ('status[' + haystack[key] + ']' == needle) {
found = true;
break;
}
}
return found;
}The nice part about how this script works is that you can keep the same list of modules as you add modules back to your contrib modules directory during your upgrade. In the case of 149 modules, I have to activate them in groups when I add them back during the update.php process. First I activate and update core optional modules as a group, then cck, views, and workflow as a group, then two groups of the remaining contrib modules. I'm positive that I experience weirdness when activating and updating all 149 modules at the same time, especially with CCK widgets. Since in this process you're only checking the available checkboxes against a list of valid ones to check, there is no error if you have not yet added all the modules in your Greasemonkey array.
Best of all, you can be sure you're checking the correct checkboxes each time. Just be sure to make the included pages URL in your Greasemonkey configuration appropriate to your environment so you don't accidentally activate your development modules on your live site. It's a good idea to keep those development modules in a separate block for easy disabling when going to production.
The attached script should get you started with a long list of popular modules as an example.
My Firefox2 addons
I've been using Qute as my theme for probably years now. I have tried others, but I keep coming back to Qute. The rest of this list is extensions.
- Adblock Plus Turned off most of the time, but doesn't load ads on webpages when it is enabled.
- Autocopy Copies text you highlight in Firefox to the clipboard automatically.
- Clipboard Save As Save the clipboard as a file.
- ColorZilla For those rare times I do website themeing and want to know what a hex color value is on a different website I like.
- CookieCuller
- CookieSwap Switch users on the same website without having to logout.
- CustomizeGoogle My favorite options: turn off Google's tracking cookies but still be logged in, removes ads from google.com pages, adds links to competitors, refuse cookies from Google Analytics (though I also let NoScript refuse those), and auto-switch to https where possible.
- Distrust For when I want to minimize traces of my browsing for a short period of time.
- DownThemAll! I originally installed this to download all the MP3s on webpage I subscribed to without having to click 50 links (it let me just download everything with .mp3 ink the link very easily). Now I use it because it saves download location favorites, has a nicer download queue than Firefox's default, and has some resume functionality I can interact with.
- Firebug Just standard to the web developer's toolkit now. I most often use it with YSlow for optimizing page loading performance. It's supposed to help with javascript debugging, too, but I can't speak to that.
- FEBE It backs up your Firefox config and addons. I think it might only be useful if you're afraid your hard drive will crash and Firefox will stop allowing downloads of addons to replace them at the same time.
- FireFTP FTP Client that's actually pretty good.
- Flashblock or Stop Autoplay stops the automatic loading of Flash and other media and replaces it with a play button.
- Formfiller Fills in repetitive forms more easily.
- FoxyProxy I used to use Torbutton instead of this, but FoxyProxy has a configuration wizard to setup for working with Tor and it lets you set white and blacklist rules for sites you want to be proxied. This was especially an issue for me when I wouldn't want my localhost/127.0.0.1/davidnorman.local requests to go through privoxy or I wanted to send traffic I didn't trust with a random Tor exit server.
- Google Send to Phone Sends text messages for free.
- Greasemonkey A quick way to write interface modifications for webpages if you're handy at scripting.
- Hackbar A toolbar for shortcuts to creating tests for SQL injections.
- iMacros for Firefox When I was selecting and submitting a form over and over again, this was a cool way to record what I did one time, then just replay it for each new test.
- 1337 key allows typing and transliterating English into 1337 and other encoding schemes such as ROT13, Base64, HEX, URL etc.
- MeasureIt A pixel ruler. There's also one in the Web Developer addon, but this one gets added to the bottom left of the status bar for easy finding next to the ColorZilla and Palette Grabber buttons.
- NoScript Blocks Javascript, Flash, Java, and suspicious redirects by default.
- Page Title Eraser Useful when you're taking a screenshot and don't want the recipient to know where the website is (e.g. intranet, client who hasn't paid, etc)
- Paste and Go 2 One of the simple pleasure addons that allowes you to right-click in the address bar, select "Paste and go 2" and you instantly load the page without having to click go or hit enter.
- refcontrol Control who you send Referrer headers to.
- Resurrect Pages When a page is Not Found, this will add links to various Internet archives and search engine caches to find an old version of the URL.
- Screen Grab! Save a webpage as an image (screenshot). Saves as a PNG. Not much to say, but it's a great tool; I use it often.
- securedrupalorg Automatically redirects requests from http://drupal.org/user to https://drupal.org/user.
- Send Referer By default, turns off sending Referers to webpages unless you select to open the link by right clicking to select the Open Links with Referer Header option.
- Snap Links Right-click drag over a group of links and open them all in new tabs automatically. Doesn't work on Mac, but I like it on Linux and Windows.
- Split Pannel Like the split screen you might know better from MS Word. Lets you use the side panel as a website browser so you can view two pages next to each other. Split Browser has more features, but I've pinpointed it as the cause for my Firefox crashing lots.
- Tab Mix Plus Instead of having my tabs spill off the screen when I open lots, I stack them in rows. It also has features for freezing, protecting, locking, reloading, recovering, resizing, renaming, and other things to tabs.
- Timestamp Converter Popup mini app for converting UNIX timestamps to something readable or vice versa.
- Timestamp Decode Does the same thing as Timestamp Converter, but based on text you highlight. It's hard to remember I have this option, so I'm not sure I've actually used it.
- Unhide Passwords Lets you see the text in a password field instead of just asterisks. Web Developer has something similar, but this addon is turned on all password fields all the time. Unfortunately, it doesn't catch every password field and convert it to plaintext.
- URL Fixer Auto-fixes common typos in the URL bar.
- URL Link Visit a URL by right clicking on it when the website author didn't make it clickable (by wrapping it in a HREF tag).
- User Agent Switcher If you've never tried it, sometimes websites show different content if you pretend to be Googlebot. You could also make a new string in about:config named general.useragent.override with a blank value.
- Web Developer If you're a web developer, you're probably already nodding your head about just how essential this addon is.
- Xdebug Helper I had to modify this one's XPI source to get it working. Worth the trouble if you use Xdebug.
- YSlow Gives you advice on how to optimize your webpage.
- Zend Studio Toolbar Debug helper. A must if you're using Zend Studio to step through files.

