Planet Drupal

Subscribe to Planet Drupal feed
Drupal.org - aggregated feeds in category Planet Drupal
Updated: 38 min 56 sec ago

LevelTen Interactive: DrupalCamp PHX Session: Drupal as an Inbound Marketing Platform

Mon, 13/04/2015 - 20:32

A few weeks ago, Brent Bice attended DrupalCamp PHX to host a session on Drupal as an Inbound Marketing Platform. The video of the PowerPoint presentation of the session, along with audio were made available for everyone to visit and listen to this session.... Read more

Categories: Elsewhere

Liran Tal's Enginx: The Drupal Rap song – Everyday I’m Drupalin’

Mon, 13/04/2015 - 19:26

This YouTube video doesn’t need any further explanation beside it’s title: The Drupal Rap song – Everyday I’m Drupalin’

 

 

 

Lyrics:

Chorus
Everyday I’m drupalin

Verse
Where them forms you gettin fapi with I’m the fapi boss/ hookin into edit form and webforms is my specialty sauce/ I’ll hook form alter by form id’s or entities/ put a list on Ajax/ just to keep it callin back/

I got them distrobutions, I’m like acqia/
Check my public repos, I didn’t copy nuttin/ I know dries n webchick, I kno Ryan szrama/ all the commerce guys we hipchat when they got some drama/
Might not be pretty code but it gets me paid/ I’m using rules like php loopin through arrays/ I put it all in features, so the code is stable/ it might take longer, but next time I just click enable/ These dudes clearin caches, on every hook init/ queries by thousands, page loads by the minutes

Verse
No matter the language we compress it hard/ drugs cc all, we just drugs cc all/
Where’s all of the changes, you never saw/ so drush cc all, we just drugs cc all/ I lean heavy on smacss, compass compilin my sass/ you just installed flexslider now you teachin a class/
I seen your content types, I don’t need to kno you/ to know that we ain’t even in the same nodequeue/
I’m on drupal answers, check my reputation/ I’m on my tablet earnin karma while I’m on vacation/ ya girl like a module, she stay hookin n/ you couldn’t code an info file, without lookin in/
Mo scrums, equals better sprints, break the huddle, n the work begins

Thanks to New Valley Media for helping with the video http://www.newvalleymedia.com/
Thanks to Broadstreet Consullting http://www.broadstreetconsulting.net

(adsbygoogle = window.adsbygoogle || []).push({});

The post The Drupal Rap song – Everyday I’m Drupalin’ appeared first on Liran Tal's Enginx.

Categories: Elsewhere

Drupal Association News: Drupal Newsletter: Jobs, Events, News, and Conversation

Mon, 13/04/2015 - 18:58

A long, long time ago—7 years, if you remember—the Drupal Newsletter faded away. On March 26th, the Drupal Association rebooted it. The community does so much that we want to share.

We partnered with TheWeeklyDrop to bring blog posts, articles, podcasts, and more to your inbox. Now, once a week, we’re taking all the effort out of keeping up with the best in Drupal news and events.

The fourth issue hit more than 32,000 inboxes on April 9. Inside it, subscribers from all around the world found Drupal 7.36 and Webform 7.x-3.24 releases, an introduction to D8Upgrade.org (a service offering advice for when you should upgrade to Drupal 8), and more.

To get the newsletter, subscribe via your Drupal.org profile.

The (Renewed) Drupal Newsletter

The Drupal Newsletter will be an opt-in-only thing. Once you’ve subscribed, you’ll get the newsletter in your inbox once a week, every Thursday, at about 06:30 PT / 13:30 GMT.

What kind of content will you get?

  • Drupal 8 progress updates
  • Jobs, so you can find work (or people who get work done)
  • Tutorials, guides, and podcasts
  • Events throughout the community
  • Projects and releases
  • News and conversation

It’s all brought to you by TheWeeklyDrop and us, the Drupal Association. It’s content hand-picked by humans, not bots or aggregators. You’ll get an uncluttered, distraction-free snapshot of the latest from the Drupal community. (Though we could be swayed by community vote to add gratuitous pictures of cats.)

It’s Like the Amazon Dash Button

Ok, no, it’s not. That’s not true. Unless you want it to be, in which case it sort of is.

Subscribe and never run out of the latest news, announcements, and innovations from the Drupal community. We made an animated gif to show you how.

  1. Log in to your Drupal.org profile <www.drupal.org/user>.
  2. Choose Edit.
  3. Scroll to the bottom, to the Subscribe to section.
  4. Check the box next to Drupal Weekly Newsletter.
  5. Hit the Save button.
Keep Up with the Drupal Community

The Drupal Newsletter is the easiest way to keep up with the Drupal community. Don’t already have a Drupal.org account? Create your profile today.

Oh, and two more things:

  1. Please add newsletter@drupal.org to your address book as an approved sender, so the newsletter doesn’t get lost in a pesky spam folder.
  2. Tell us what you think. Comment on this post, or send feedback to newsletter@drupal.org. We’d love to hear from you.
Personal blog tags: Drupal Newsletter
Categories: Elsewhere

Drupal @ Penn State: The year, is 2020.

Mon, 13/04/2015 - 18:46

The year is 2020.

Categories: Elsewhere

Drupal core announcements: Drupal core security release window on Wednesday, April 15

Mon, 13/04/2015 - 16:51
Start:  2015-04-15 (All day) America/New_York Online meeting (eg. IRC meeting) Organizers:  David_Rothstein

The monthly security release window for Drupal 6 and Drupal 7 core will take place on Wednesday, April 15.

This does not mean that a Drupal core security release will necessarily take place on that date for either the Drupal 6 or Drupal 7 branches, only that you should prepare to look out for one (and be ready to update your Drupal sites in the event that the Drupal security team decides to make a release).

There will be no bug fix/feature release on this date; the next window for a Drupal core bug fix/feature release is Wednesday, May 6.

For more information on Drupal core release windows, see the documentation on release timing and security releases, and the discussion that led to this policy being implemented.

Categories: Elsewhere

Darryl Norris's Blog: How To Replace The Title Field To a Term Of Reference (Taxonomies)?

Mon, 13/04/2015 - 16:15

How can you replace the title field to a term of reference (taxonomies)? This is very tricky because the title field is been hardcore written on a content type (in Drupal 7) and by default it cannot be easily replace. In this article I would explain you how I was able to use a term of reference as my title. But first why use a term of reference instead of a title?

These are the reasons why I need it to use term reference instead of title field:

  • Facets - I’m building a system with Search Api + Views + Facets. And I wanted to use the title field on one of the Facets. If you used the title field facets would recognize it as Full Text and it would display it very weird with lower cases and separate words.
  • Standardize – I was building a system where the title is
  • ...Read more
Categories: Elsewhere

Chuva Inc.: Advanced Metadata wrappers

Mon, 13/04/2015 - 15:46
Are you familiar with entity_metadata_wrappers? If you are, take these two tips for your life.
If you’re not read this article to get to know metadata wrappers. Tip 1: with list fields, quickly display what you really want to display

Now, to the juicy stuff.

Suppose you have a list field, named “field_shipping_type”, with two options:

exp|Express shipping regular|Regular shipping

If you use:

<?php print $node->field_shipping_type->value(); ?>

It will print the word “exp”. But I want to display the human-readable value. How to do that? Quick!

<?php print $node->field_shipping_type->label(); ?> Tip 2: with any kind of field, display its label

Suppose I’m again, with a bunch of fields, trying to display them in a page. I need the field’s label to show it. With the magical function ->info() of the wrappers, I can do just that:

<?php print $node->field_shipping_type->info()[‘label’]; ?>

Neat, uh? There are a few more things hidden in this ->info(), actually all the information concerning the field. You may find it useful someday. 

Image credits:  https://www.flickr.com/photos/danielygo/11377205686

Subtitle: Two tips for advanced Entity Metadata Wrapper usage
Categories: Elsewhere

Deeson: Drupal: Setting a higher value for a multi-value field

Mon, 13/04/2015 - 15:02

When setting up a multi-valued field in Drupal you have the option of either having unlimited values of a fixed nunber of values. For the fixed number, you only get the option of having between 1 and 10 values.

 

But what if you need to have a fixed value of items higher than 10?

Well there's a hook for that.

Using the hook 'hook_form_FORM_ID_alter' you can override this value for specify a higher range of values.

/** * Implements hook_form_FORM_ID_alter(). */ function MYMODULE_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) { $form['field']['cardinality']['#options'] = array(FIELD_CARDINALITY_UNLIMITED => t('Unlimited')) + drupal_map_assoc(range(1, 20)); }

Now you can select a value between 1 & 20 for any multi-valued fields on your site.

Categories: Elsewhere

Don't Panic: A blog about Drupal: Another 5 Drupal resources you might have missed

Mon, 13/04/2015 - 15:00

When classic Drupal-sites like GotDrupal, YadaDrop, NodeOne and DrupalDude aren't updating their Drupal resource sites and/or pages anymore, there are always new sites around the corner to help you in your Drupal quest. I've listed 5 of them earlier, and here's five more...

ModuleNotes

If you find the information for the different modules on drupal.org too long and hard to get a grip on, ModuleNotes might ease your pain. Written by users for users, in plain English - "this is what this module do, and it's awesome!".
Visit http://modulenotes.com/

Drupalstatus

Do you have a bunch of Drupal sites out there? Tired of getting email messages whenever there's an update available? A rather new, and free, way of keeping track is Drupalstatus.org. Through a module you connect your site to Drupalstatus and get an overview, and a weekly summary of what modules you should update, security information and such. Came along when Droptor was on the slope, and became the savior for all of us who looked for an alternative. (See related post here.)
Visit https://www.drupalstatus.org/

DrupalDump

Slightly older and not so updated anymore, but it still holds a lot of information and tips and tricks. Hundreds of knowledge snippets, sorted into different categories makes this a good place to collect good information about Drupal - at least for a couple of years.
Visit http://www.drupaldump.com/

DrushCommands

If you're an avid Drupal developer or just building one site, one time there's a lot to gain of using Drush. Drush is a bunch of terminal commands that speeds up development and/or theming Drupal. It's like an AddOn-pack for your favourite boardgame. With Drush, your terminal usage will increase but you will also spare a lot development time. Just clearing cache is a dream in Drush, and with that you can skip opening up the Performance page and clicking the button to clear your cache. Anyway, DrushCommands.com offers a comprehensive list of all different versions of Drush available to us as users and which commands that works in which version. Great to have around if you want to start using - or improve your usage of - Drush.
Visit http://www.drushcommands.com/

DrupalShowcase

"I've never heard of this Drupal, I don't like, I don't think anything is built with that Durpel thingamabob..." Ever heard something like that from a client, a friend (ex-friend!) or other. Well, if you want to stick it to them, and show them that there are many beautiful, clever and useful sites out there, running on Drupal - DrupalShowcase is a great way to start. Thousands of Drupal-sites are listed here - and you can easily add your own!
Visit http://www.drupalshowcase.com/

Categories: Elsewhere

Chris Hall on Drupal 8: Responsive Breakpoints in D8, the breakdown

Mon, 13/04/2015 - 14:00
Responsive Breakpoints in D8, the breakdown chrishu Mon, 04/13/2015 - 12:00
Categories: Elsewhere

Web Wash: How to Use WordPress Style Shortcodes in Drupal 7

Mon, 13/04/2015 - 13:02

If you've ever had to migrate a client from WordPress to Drupal, one of the first things they'll ask for is how to add shortcodes in Drupal.

Shortcodes in WordPress are macros that you can drop into content and have it render an object. For example, if you want to embed a gallery in WordPress you simply add [gallery id="123" size="medium"] into the content and when a post is displayed a gallery is rendered.

Implementing similar functionality in Drupal is very easy thanks to the Shortcode module. The module is not an exact copy of the Shortcode API but implements very similar functionality. If your clients are use to shortcodes in WordPress then they'll feel right at home using them in Drupal.

In this tutorial, you'll learn how to configure and use the Shortcode module in Drupal.

Now, you may be thinking to yourself, can't Token do this? The short answer is yes. You can implement similar functionality using Token Filter. The module implements a custom filter which can be added to text formats. If you add [site:name] into the body, it'll render the site name.

Categories: Elsewhere

YesCT: Identifying Mentors at Sprints (example: creative t-shirts at DrupalCon Latin America)

Mon, 13/04/2015 - 12:56
Identifying Mentors at Sprints (example: creative t-shirts at DrupalCon Latin America) DrupalCon Latin America Sprint was Big

DrupalCon Latin America took place in Bogotá, Columbia this past February. 270 people attended the conference. There was a training day, two days of sessions and the last day was the big sprint day. It is tradition at Drupal events (and many other Open Source events) for people to gather together and work to improve the software we use. We had lots of people from the conference attend the big sprint day, 101 people, 37% of conference attendees. It was the highest percentage wise ever at a DrupalCon.

As an event attendee: should you attend a sprint?

Yes. But.. Sometimes participating at Sprints can be intimidating especially if you have never been to one. Where do you start? How do you participate? Who can you ask for help? Sprint mentors! And your next question might be, "Great… where can I find one of those?"

As an event organizer: What can you do to help attendees have a good sprint experience?

Having a way for attendees to identify people there to assist them, improves the experience for everyone.

Identifying Sprint Mentors

One way to identify mentors is with sticker name tags. (Note for future sprints: Name tags that hang from lanyards often end up below the table edge, and then other people around the table cannot see the name tag.)

Another way is with bright colored mentor shirts. However, at DrupalCon Latin America, we unfortunately did not have pre-printed special color mentor shirts.

Making Mentor T-shirts that Standout T-shirts

Jared Smith (jsmith) had some black t-shirts with subtle bluehost branding on them, and positive messages people could identify with like: GEEK, and Helping OpenSource Projects Make an Impact. Some people were already wearing dark grey or black t-shirts.

Andres Yajamin (andrefy) mentoring while wearing a Helping OpenSource Projects Make an Impact t-shirt. Photo credit: jsmith

Tape

Carlos Ospina (camoa) bought some green easy release painters tape.

Sleeves

We decided to use the green tape on t-shirts sleeves. This helped people identify mentors from the front and side.

Joaquin Bravo (jackbravo ) mentoring while wearing black t-shirt with green stripes on the sleeves. Photo credit: dasjo

Some sleeves had a lot of detail.

Emma Karayiannis (emma.maria) had their name, username, green stripes and a transparent Drupal 8 sticker on their sleeves. Photo credit: jsmith

Back of the t-shirts

Mentors are often leaning over, sitting in a group at a table, ... or wandering around. So, we also put markings on the backs of our shirts.

Novella Chiechi (italiatina ) adding their name to the list of people sprinting, with a big visible exclamation mark on the back of their t-shirt. Photo credit: jthorson

Different Shapes

We helped each other, and put different shapes on the back of our shirts. Like balloons and a star trek insignia.

Mentors standing together. One has two balloons, another a star trek insignia made out of green tape. Photo credit: jthorson

We had a lot of creative ideas for shapes, like a smiley face with fangs. And it was really fun!

Back of a mentor t-shirt with a big smiley face, with fangs, made out of green tape. Photo credit: jsmith

In Action

The shirts were noticeable in a crowd.

James Wilson (jwilson3) mentoring at a table. Photo credit: dasjo

Mentors standing out in a crowd. Photo credit: jthorson

Lots of shirts!

I like having brightly colored unique mentor shirts at DrupalCons... but this was fun to tape up our own!

Back row: Novella Chiechi (italiatina ), Jared Smith (jsmith), Sebastian Ferrari ( sebas5384 ), Tess (socketwench), Cathy Theys (YesCT), Emma Karayiannis (emma.maria), Renato (revagomes), Darwin Betancourt (drw), Andres Yajamin (andrefy). Front row: Alina Mackenzie (alimac), Eric Aguayo (Ericmaster), Joaquín Bravo Contreras (jackbravo), James Wilson (jwilson3), Fernando Paredes García (develcuy). Photo credit: jsmith

More Photos

See even more mentor photos from DrupalCon Latin America. Please let me know of any I am missing.

Reusable mentor T-shirts

We have also been discussing having reusable mentor T-shirts.

Categories: Elsewhere

orkjerns blogg: Drupal and the Internet of Things

Mon, 13/04/2015 - 09:15
Drupal and the Internet of Things admin Mon, 04/13/2015 - 07:15

The Internet of Things (or IoT for short) is probably even more of a buzzword than "Headless Drupal", but maybe not so much in Drupal land. As I am a man of buzzwords, let’s try to combine these things in one article (Also, there will be video demos)

Or maybe a couple of articles. I feeI have so much to say about this, partly because many articles one can read on the subject IoT deals with having your "thing" on your local network and playing with it over the wifi. We are not going to do that here, as your local network is not the internet. Of course you could forward your router settings to actually put that "thing" on the internet. And then that thing would be available to all hackers that would want to access it. So we are not going to that either in this article. For a first article, I want to explain how I see Drupal and IoT connecting together, and explore the patterns for this.

When we refer to “The Internet of Things” we often refer to devices capable of networking. This could be a car, cell phone or something like a Raspberry Pi, Arduino or Tessel. In this article I will simply refer to a "thing". This means a device we want to extract data from, or interact with via Drupal.

A common scenario

First, let’s look at a common way of testing out Internet of Things at home. You have a Raspberry pi and you have a temperature sensor. Now, the raspberry pi probably runs a flavour of linux, so you can actually install apache, mysql, php and finally Drupal on it. Then maybe you find a python script that reads the temperature, and you create a node in Drupal with the php filter that will exec this python script and print it inside Drupal. That will work. Except it is not a good idea. For several reasons. Let’s go through them:

  • Your "thing" will both be a sensor and a webserver. Make it do one thing, and focus on that
  • Your Drupal site will run on your local network, and to access it from (for example) your office you would have to make it publicly available in some way.
  • Your Drupal site will have the php module installed. You don’t want that.
  • Your php code will be doing system calls. Please don’t do that

Now that I have got that rant out of the way, let me also just say that if you want to go down that road, it is of course a low entry barrier, and if you are restricting access to your local network, then the security concerns are looking a little better. And of course, the php in a node part is not strictly necessary, it just fits with my arguments. So, if you are looking for that kind of tutorial, there are plenty others on the internet.

Patterns for communication

As I now have been ranting a bit, let me just point out that this is not a canonical article about IoT best practices or some absolute truths. These are just my opinions on how one could approach this exciting buzzword. Continuing on, let’s look at some ways of interacting between a Drupal site and your "thing.

If we look at it as simply one "thing" and one Drupal site, you have two actors in this communication model. So to establish a two-way communcation, we would both want the "thing" talking to Drupal, and Drupal talking to the "thing". This "thing" may represent something physical in the world, like a temperature sensor or a relay switch. So basically it is an interaction between the physical world and your site, so let’s use that metaphor. This article will deal with the first and most simple concept of this interaction:

The physical world talking to Drupal

Isolated, the wording of that heading looks kind of poetic, doesn’t it?

When the physical world is talking to Drupal, I mean it as somewhat of a “push” mode for your "thing". Let’s say you are monitoring the temperature in your apartment (physical world) and want to communicate this to your Drupal site. A simple thing to do here is to define an endpoint in your Drupal site where your "thing" would just post updates, and the Drupal site would store the information (of course with some sort of authentication). A one-way communcation to push updates from the physical world to Drupal.

Another theoretical and more intricate form could be something like this:

Say you have a physical store that also is an online store (a typical use case for Drupal). And you are about to have a sale in both places. But you want visitors in the store to have the same oppurtunity as the online visitors to get the good deals. In this scenario you could make it so that the moment the lock on the door was opened, a request is sent to the online store enabling the "sale mode". And when you close in the afternoon, the online store "sale mode" automatically gets disabled. This way, the physical store (or more precisely, the lock on the physical store) actually dictates the state of the online store.

Granted, this is a theoretical example, so let’s look at practical and implemented examples instead. I have put together a few quirky demos with varying degrees of usefulness. All examples are actual Drupal 8 sites running on Pantheon, so there is no localhost Drupal instance to talk about. This is the physical world talking to the internet.

Remote controlled Drupal 8

The first one kind of reminds of the above example, although maybe not so useful. It is a remote control to "shut down" the Drupal site (put it in maintenence mode). Or more precise: I am turning off the site with my TV remote. If you are wondering why the site refreshes a couple of times, it is because since I used one hand to film and one hand to press the remote, I had the site just update itself every 2 seconds.

Temperature monitoring

The second one is a more common one. Presenting the current temperature at a path in Drupal. Here we are just polling for updates to make the video actually show that it works, but a more practical example is probably to post updates every 10 or 30 minutes. Also note that now we can view the temperature from anywhere in the world, while still having our device unreachable over the internet. If you are wondering why am using water, it is because this triggers temperature changes much faster. The glass contains cold water, the cup holds warm water.

And here is a third one. Since I felt like being silly. This one displays the temperature, draws a nice historical graph of the temperature, and changes the color of the header based on the temperature. I must admit that the last part is purely client side in the video, but could theoretically be expanded to actually do this through the color module. I also must admit that the actual hot/warm color calculation could use some tweaking (more than the 6 minutes used on it), but you probably get the picture

Drupal 8 as a "surveillance backend"

For the last example there is something a little more elaborate, and maybe even practical. It uses a sound sensor to listen for sound changes. When the sound trigger is triggered, it takes a picture with the webcam on my mac (you can see the light next to the camera after I snap my finger), posting it to my Drupal site, creating a node. A simple surveillance camera with Drupal as a backend. Also, a very concrete example of the physical world interacting with Drupal, as it is the snapping of my finger (very physical) that creates a node in Drupal.

This article is already getting pretty lengthy, so I'm going to end it here. And before you ask: No, the code for the examples are not yet available. And yes, it will be made available. As I said, all these examples were put together quickly on a sunday morning, and they are all very hardcoded and hackily put together. I will post an update here, and probably a code-dedicated blog post about just that.

Also, I will be following up with the next scenario: Interacting with the physical world from Drupal. If you have any questions, please feel free to ask them in the comments. And I would very much be delighted to hear about alternative ways of doing this, people doing similar things or other thoughts on the subject (rants or ideas).

The ending of this post will be a lo-fi gif describing what sceptics usually call the Internet of Things - The Internet of Lightbulbs. Have a nice week!

Thanks to my co-worker zaporylie for reading through the article

Tags: Comments
Categories: Elsewhere

more onion - devblog: Scalable filters and bulk-operations in campaignion

Mon, 13/04/2015 - 08:18

In the last weeks I did some work on optimizing queries for the "Manage Supporter"-Interface in campaignion (online campaigning / online fundraising distribution). The goal is to filter Redhen contacts and then apply bulk-operations on them. In our larger databases we have up to 500,000 contacts and millions of activities - and the queries are not that simple either. How do you get “All supporters that signed at least two petitions last year but never made a donation”?

Tags:
Categories: Elsewhere

Code Karate: Installing a Drupal Site and Database - 2 of 3

Mon, 13/04/2015 - 04:07
Episode Number: 201

In part 2 of the 3 part series, we are looking at how get a Drupal website and database setup and running. If you followed part one, you will remember we are doing this all on our local environment using MAMP. As the video will show, we begin by going to Drupal.org/project/drupal and downloading the newest version of Drupal. At the time of this DDoD, Drupal is at version 7.36.

Tags: DrupalInstallation ProfilesDrupal 7Drupal PlanetDeploymentServers
Categories: Elsewhere

Pixelite: How and why you should update PHP to PHP 5.5 with Drupal

Mon, 13/04/2015 - 02:00

This post is a follow up to my previous blog post on how to upgrade PHP to 5.4 to support Drupal 8.

Why you should upgrade PHP

If you are looking for reasons to ditch PHP 5.3, here are some:

Security

PHP 5.3 reached end of life in August 2014, this means that if you are running this version, you are running an insecure version of PHP that potentially has security holes in it. This is bad for obvious reasons.

Bundled opcode cache

PHP 5.5 is the first version that bundles an opcode cache with PHP, this means there is also no need to also run APC (unless you need userland caching in APCu).

Performance

PHP profiled the 5.4 release compared to 5.3 for Drupal, and that found that:

  • 7% more requests/second
  • 50% PHP memory reduction

PHP 5.5 offers more performance again, and there is a section at the bottom of this article that goes through a real life scenario.

Cool new features

Read through the list of new features, here are some neat things you are missing out on:

$array = [ "foo" => "bar", "bar" => "foo", ];
  • Function array dereferencing
$secondElement = getArray()[1];

And many others.

How to upgrade to PHP 5.5

There are a number of ways to update your server to PHP 5.5.

Upgrade to Ubuntu Trusty Tahr 14.04

Ubuntu Trusty Tahr 14.04 (which is an LTS version), which comes bundled with PHP 5.5.9. This is probably the best solution if you are managing your own Ubuntu box.

Install a PPA on Ubuntu Precise 12.04

If you are running the older Ubuntu Precise 12.04, you can add a PPA

sudo add-apt-repository ppa:ondrej/php5 sudo apt-get update sudo apt-get install php5 php5 -v

It would be worth considering a dist upgrade though, but this at least can buy you some time.

Acquia Cloud UI

If you use Acquia Cloud for hosting there is a convenient PHP version selector in the UI.

More information can be found in the documentation. Be aware, once you upgrade beyond PHP 5.3, you cannot downgrade, so ensure you test your code on a development server first ;)

Common coding issues

Although Drupal 7 core, and most popular contributed modules will already support PHP 5.5, it would pay to do a code audit on any custom code written to ensure you are not using things you should not be. Here are some links you should read:

Below are some of the most common issues I have found in sites:

Call time pass-by-reference

If you have this in your code, you will have a bad time, as this is now a PHP fatal.

foo(&$a); // Bad times. Only variables can be passed by reference

This will cause PHP to throw notices.

$ php -a Interactive shell php > ini_set('error_reporting', E_ALL); php > var_dump(reset(explode('|', 'Jim|Bob|Cat'))); PHP Strict Standards: Only variables should be passed by reference in php shell code on line 1 Strict Standards: Only variables should be passed by reference in php shell code on line 1 string(3) "Jim"

Where you will likely find this in Drupal in my experience is when manually rendering nodes:

This code works in PHP 5.3, but will throw notices in PHP 5.5:

$rendered = drupal_render(node_view(node_load(1), 'teaser'));

The fix is to simply use a temporary variable:

$view = node_view(node_load(1), 'teaser'); $rendered = drupal_render($view);

The reason being that drupal_render() expects a variable to be passed in (as it is passed by reference).

How do you find coding issues

Enable the syslog module, and tail that in your development environment, hunt down and fix as many notices and warnings as possible. The more noisy your logs are, the harder it is to find actual issues in them. While you are at it, turn off the dblog module, this is only helpful if you do not have access to your syslog (as it is a performance issue to be continually writing to the database).

Real world performance comparison

This was taken from a recent site that underwent a PHP 5.3 to 5.5 upgrade. Here are 2 New Relic overviews, taken with identical performance tests run against the same codebase. The first image is taken with PHP 5.3 running:

You can see PHP time is around 260ms of the request.

With an upgrade to PHP 5.5, the time spent in PHP drops to around 130ms. So this is around a a 50% reduction in PHP time. This not only makes your application faster, but also it means you can serve more traffic from the same hardware.

Comments

If you have gone through a recent PHP upgrade, I would be interested to hear how you found it, and what performance gains you managed to achieve.

Categories: Elsewhere

Drupal for Government: Tree cross pollination maps using Drupal! aka debugging drupalgap geofield with genymotion and gapdebug

Mon, 13/04/2015 - 01:27

DrupalGap continues to rock.  Today I wanted to test the geofield module and get some maps in my apps... duh... it came about as a result of meeting with Tom Cormons from Appalachian Voices. He mentioned a problem - you often need two trees to pollinate eachother, and only have space for one... an app might help neighborhoods coordinate healthy tree communities.  

Anyhow - my dev skills were amok.  I followed the instructions on Tyler Frankenstein's site however I wasn't getting the maps to show up on my phone.  They showed up fine on the web-app side of things (eg https://www.cvillecouncil.us/mobile-application/index.html#node_23 ) however after building and piping to my android phone I couldn't get the maps to show up on my kyocera hydro (c5170...) ... I needed a debug environment... enter gapdebug!  oh yeah... gapdebug only works with android 4.4... my ghetto phone is running android ice cream 4.04... enter genymotion!

Categories: Elsewhere

Dave Hall Consulting: Managing Variables in Drupal 7

Mon, 13/04/2015 - 01:02

A couple of times recently the issue of managing variables in Drupal 7 has come up in conversation with other developers. This post outlines the various ways of managing variables in Drupal sites. The three things this guide ensures:

  • Sensitive data is kept secure
  • Variables are correct in each environment
  • You are able to track your variables (and when they changed)
The Variables Table

The most common place you'll find configuration variables is in Drupal's variable table (aka {variable}). The values in this table are often managed via admin forms that use system_settings_form(). Users enter the values click "Save configuration" and the data is stored in the database.

If you prefer to manage your configuration via the command line and know the variable you wish to set you can use drush vset. This does exactly the same thing as admin form, without needing to click on a mouse.

$conf Array

While the variables table is great at storing our variables, there are times when you want to enforce a setting. This might be because you want to prevent users from changing it (accidentally or otherwise) or because you need it to be different in each environment. The $conf array in settings.php always overrides any values in the variable table.

Acquia, Pantheon and platform.sh all provide environment variables so you can use different values in your $conf array depending on the environment.

Exporting Variables

In Drupal 7, the common way to export your variables is by using Strongarm with Features. I'm not going to cover how to do this as there is loads of documentation already available on this topic.

If your variable changes on a per environment basis or if it calculated on the fly, then you won't want to use strongarm+features as the exported values are static. You will need to put them in settings.php.

Note to self: I should debug and reroll my patch for adding support in alter hooks strongarm.

My settings.php is Out of Control!

This is a common problem, especially on more complex sites. To avoid this I recommend creating sites/default/settings/settings.[env].php files. Your settings.php file should check for the environment in an environment variable and then include the appropriate settings.[env].php file.

What About Sensitive Data?

You can encrypt variables on a case by case basis using the encrypt module and some custom code similar to what I recently implemented in the Acquia SDK module (see on store and on read examples). Warning: This doesn't encrypt the data if you're using drush vset.

If you are storing sensitive data in your variables table I would recommend you implement hook_sql_sync_sanitize() which will delete the sensitive data from your db when drush sql-sanitize or drush sql-sync --sanitize are run.

How to Decide?

This little code snippet should help you decide.

<?php // Don't try using this code in your Drupal site. if (!using_version_control()) { // Seriously there is no point in doing this without version control. abandon_all_hope(); drupal_exit(); } if (is_data_sensitive($var)) { $var = encrypt_var($var); if (!we_use_drush_based_workflows()) { learn_and_implement_drush_based_workflows(); // I'm serious! } } implement_hook_sql_sync_sanitize($var); } if (is_unique_per_environment($var)) { store_conf_array($var); } else { store_in_db($var); if (!we_use_features_based_workflow()) { learn_and_implement_features_based_worflows(); // I'm serious! } export_using_strongarm($var); }
Categories: Elsewhere

DrupalOnWindows: Decent PDF generation in Drupal

Sun, 12/04/2015 - 02:29
Language English

Wether you like it or not PDF is a mainstream adopted format to exchange documents. Your customers will ask, sooner or later, to have some sort of content generated in PDF (be it an invoice, a report, etc...).

Doing a quick search these are the modules that offer some sort of PDF integration in Drupal:

More articles...
Categories: Elsewhere

Pages