Drupal social publishing software

Drupal is a powerful content management system and framework that makes building powerful websites possible for mere mortals. Some of the posts here will be syndicated to Drupal planet.

MAMP redirect to SSL

If part of your daily work is working on SSL websites then tools like MAMP are quite useful. However it's easy to forget to add https:// when you'd rather just type the hostname. By Adding a snippet to the default virtual host that can still be easy:

RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

Note, however, that you may mask some bugs where your local development server silently redirects to the SSL server where the production server would fail to do so.

Almost WSOD after Drupal 8 install

I haven't had time to find if there is an open issue and this is really about my config so leaving a note here in case it's useful. After a fresh install of Drupal 8 everything looked good. At least until I got to the Add Article page. The page said nothing but "Restricted HTML".

It's not quite a WSOD of old but it is still a PHP fatal. Looking through the log I found:

Fatal error:  Maximum function nesting level of '100' reached, aborting! in .../drupal-8/core/vendor/twig/twig/lib/Twig/Node.php on line 141

The solution was to increase the xdebug limit on nesting by adding this to the php.ini in the xdebug section:

xdebug.max_nesting_level = 1000

A one-liner for Drupal 7.32 security update

Yesterday an important security update was released for Drupal. This update, Drupal 7.32 is a highly critical update for everyone running a Drupal 7 site.

You may have seen a tweet where I posted the following suggestion which works on OS X:

sudo find . -name database.inc | grep "/includes/database/database.inc" | xargs sed -i '' 's/$data /array_values($data) /'

On linux the arguments for 'sed -i' work a little differently and this works better:

sudo find . -name database.inc | grep "/includes/database/database.inc" | xargs sed -i 's/$data /array_values($data) /'

Twitter might be good for getting the message out but it doesn't provide the space to explain. Why would one use this? Wouldn't it be better to just upgrade to Drupal 7.32?

Drush and cloning

I need to pull down a site I have on my other computer but haven't setup here for local development. I keep thinking there should be a 'drush clone' command... well there is but it clones modules not the way I'm thinking of. Basically the command I have in mind would:

  1. Clone the git repository of the site into the proper local directory.
  2. Copy the files from the production or developer site.
  3. Create the local database and sync from production or developer instance.
  4. Or instead of syncing the database do a site install if that's called for.

This requires of course that drush aliases already exist for the site. How to handle this and keep everybody in sync. Well, here's my stab at a highly configurable, very customizable drush configuration for people who work with one or more teams.

More Alfred and drush love

A couple years ago I started playing with using the stellar Alfred.app with drush to get things done. This post describes how I used a now defunct URL shortener to create short links from Alfred.

Fast forward a couple of years and Adjix is no longer but the basic script still works. However it had run into a couple of issues like being hard-coded to drush paths which can vary from machine to machine. This was because the non-interactive shell wasn't picking up all the wonderful things like my $PATH definitions in settings files. So a bit of work later and this script now looks like this:

#!/bin/bash
source ~/.bashrc
echo `drush .env ev 'print (shorten_url("{query}"));'`

That's it. Well there are two outputs of the workflow. The first copies the results of the statement to the clipboard. The other posts it to Notification Center so you know the work is done and get to see the URL for your shortened link.

Hosting Drupal sites on CloudFront

So the term hosting may be technically inaccurate here. However the practice of deploying sites entirely behind CloudFront recently got much easier. The change came in this announcement that CloudFront now supports POST requests. A long time (years) in coming, this now gives options to sites that would like to have quick setup with a CDN and have lightening fast sites with minimal setup. I'll post more soon on how to do it but it's great to know that it's possible now.

Farewell comments

For quite some time I have been thinking about how to make sites that are more useful and better assembled. No this is not a post-CMS look how we're managing content like it is 1995 post. But how to best put together sites that have services that the site or a small group of sites consume. The Distributed Blocks module in Drupal is a piece of this that I have batted around with several folks much brighter than me (I don't have any experience with the Distributed Blocks module or involvement in it's creation just an example of the sort of distributed SaaS solution I've envisioned.)

At any rate while I was doing some work on this site today I was facing the problem of what to do with commenting. The comments here haven't been used in a long time for anything but an attempt to spam the site. In the typical flow of things there are waves of time when spammers overwhelm or come up with a new technique to get past the excellent Mollom service. Over the last few years I've removed far more spam posts than there have been meaningful additions.

And so it becomes Drupal 7

It has taken far longer than one might have guessed but after many months of sitting mostly dormant this site finally got an upgrade to Drupal 7. Eventually maybe it will get some new functionality but for now we'll settle for a clean, responsive design.

The responsive design comes from a theme based on the contributed Corolla theme. Otherwise things are quite similar.

So while it's true what they say about the cobbler's children going barefoot the public view at least matches what I've been seeing for a while. And we won't talk about the state of the children's websites.

Setting up Xdebug with Acquia Dev Desktop for local debugging

A while back Robert Douglass had written a great guide to setting up to use Xdebug on Mac OS X. Looking for it today it looks like the sands of time have erased it from the webs. At the same time the recent versions of Dev Desktop include Xdebug so the process is a little different (and simpler).

Settings panel with Edit highlighted

In this case I'm setting up Xdebug to work with Komodo IDE and Dev Desktop that comes bundled with Drupal 7. After installing Dev Desktop and setting up your first site it's time to enable Xdebug. In the recent versions of Dev Desktop it ships with Xdebug but the PHP extension is turned off.

The first step is launching the Dev Desktop control panel. Once it has started click the "Settings..." button in the lower right. Then pick the "Config" tab at the top center to see the server configuration. The screen shot here shows PHP 5.2 but the process is the same for 5.2 or 5.3. Whichever version of PHP click the Edit link beside the php configuration files.

This will open the chosen php.ini file in Text Edit. With the file open look for the line containing xdebug.so. If the installation is in the standard directory it will look something like this:

Drush make and Pressflow

A quick note on using Pressflow as the basis of a Drush build using Drush make can be a little confusing as the changes necessary to use the newer github-based repository aren't abundant. So without further ado here's what works:

projects[pressflow][type] = "core"
projects[pressflow][download][type] = "git"
projects[pressflow][download][url] = "https://github.com/pressflow/6.git"
projects[pressflow][download][tag] = "DRUPAL-6-24"

Note that the previous instructions around the web tend to be problematic because the tarball file contains a git repo which Drush make doesn't know to strop since it's getting it as a tarball instead of from git.

Pages

Subscribe to Joshua Brauer: All Drupal items Subscribe to Joshua Brauer: Drupal Planet only