Drupal 7 Audit SQL Queries

13th December 2013 - 2 minutes read time

When doing site audits on Drupal sites it’s always a good idea to get a feel of what sort of content types, users and taxonomy terms are available. Here are some SQL queries that I tend to use when starting out on a Drupal Audit.

Deleting Unapproved Comments In Drupal 7

13th December 2013 - 3 minutes read time

I recently came under a spam attack that gave me a bit of a problem to sort out. Over the course of 24 hours my blog received over 50,000 comments, all of which were utterly useless. What was good was the fact that my tiny little VPS server managed to stay available for most of the attack.

Due to the vast number of comments the normal administration form in Drupal became a little useless. I could only delete 25 comments at a time, so after an hour of this I decided that I needed to run a few SQL statements to clear out all of the unwanted comments in the database. I thought I would write up the commands I used in a post.

The first thing to do was to delete any unapproved comments from the comments table.

DrupalCampNW 2013: A Review

2nd December 2013 - 16 minutes read time

It’s been a whole year since the last DrupalCampNW2012 and this years DrupalCampNW (appropriately titled DrupalCampNW2013) seems to have been a great success. This years camp was held in Manchester at The Studio and I was part of the committee of people who helped organise and run the event.

Over the course of the weekend there was a range of talented speakers covering differing issues around Drupal, open source technologies and user experience. The weekend consisted of a Friday business event, followed by a developer and site builder event on the Saturday and Sunday.

My main task during the event was making sure the volunteers we had there on the day knew what they were doing and when to do it. The trouble with organising and running a conference is that you are lucky if you get to see many of the sessions. I did, however, manage to see several sessions over the course of the weekend.

Drupal 7 File Stream Wrapper Translation

18th October 2013 - 4 minutes read time

Steam wrappers were introduced in Drupal 7 and allow user file locations to be kept in a maintainable way, although I often forget which function to use to translate them. The three wrappers available are public://, private://, and temporary://, which map to the public, private, and temporary files directories respectively. All user files in Drupal are stored in either of these directories and they are referenced in the database as the file wrapper followed by the location of the file. This means that the location of the files is only dependent on a single config setting.

Translation of the stream wrapper into a file location is dependent on one of two functions, depending on what sort of file location you want. If you want to get a local file location then you would use drupal_realpath(), whereas if you want a URL of the file you would use file_create_url().

PHPNW13: A Review

14th October 2013 - 18 minutes read time

PHPNW13 is the 6th annual PHPNW conference, organised by members of the PHPNW community and Magma Digital. This year the conference saw around 420 people (with myself as a helper) at the conference, which was held in the Manchester Conference Centre.

My involvement in PHPNW13 started a few months before the actual conference. When the call for papers closed back in June I spent a weekend reading the submissions so that we could pick which sessions would be at the conference. Out of the 183 papers submitted (20 more than last year) we had to pick just 35 or so sessions that would be presented at the weekend. The final selection of talks was really good and judging by the comments and rating on joind.in they were well received by the other conference attended as well.

The Monty Hall Problem In PHP

24th September 2013 - 12 minutes read time

The Monty Hall problem is a counter intuitive problem in probability mathematics that deals with picking the right prize from a set of three doors. The problem is named after the television celebrity Monty Hall and is loosely based on the USA game show Let's Make a Deal.

This has become a popular problem in programming as it is a good exercise in thinking through a problem to prove what outcome actually occurs. Lots of examples have been posted online so I thought I would sit down and attempt to solve it myself. The problem is most commonly summarised as follows (this example was taken from Rosetta Code):

Drupal 7: WYSIWYG Module Custom CKEditor Configuration

22nd September 2013 - 6 minutes read time

The WYSIWYG module in Drupal is a great way of integrating a client side HTML editor (better known as a WYSIWYG editor) into a Drupal site. It supports a variety of different editors, all of which can be configured depending on the input format being used by the user. The ability to incorporate many different content editors into a site using a single module means that the configuration interface for them all is pretty much the same. It also means that it isn't a disaster if a different editor is needed for an existing site. You just need to ensure that the correct configuration options are set to allow a similar user experience.

DrupalCon 2013 Prauge Is Next Week!

17th September 2013 - 3 minutes read time
This years European Drupalcon will be held in the Czech Republic city of Prague and tickets are still available. This is the largest gathering of Drupal developers, site builders, project managers and users in Europe and it is always run exceptionally well by the Drupal Association.

Turning Off Apache Basic Authentication For A Single Directory

11th September 2013 - 3 minutes read time
When setting up staging sites or similar I often add a simple Apache authentication check in order to stop everyone from viewing the site. This is also useful in stopping search engine spiders from accessing a site with testing content on it, which generally causes trouble. It isn't amazingly secure, but it keeps almost everyone out.

Changing Memory Allocation In Phing

7th August 2013 - 2 minutes read time

Running complex tasks in Phing can mean running out of memory, especially when altering or changing lots of files. I was recently working on a image sorting Phing project that sorted images based on EXIF information. The many thousands of files involved, along with the custom target used to extract the EXIF data caused the default avai

<php expression="ini_set('memory_limit', '1G');"></php>

lable memory to run out quite quickly.

There is no direct way to alter the PHP memory limit setting through Phing, but it can easily be altered using a Phing php task. This evaluates the PHP function ini_set() and set the memory_limit value. The following Phing task sets this limit to be 1G, or 1 gigabyte.