Mike's communication and delivery seriously exceeded my expectations - I hope to have more Drupal and responsive theme work in the future so I can work with him again! Highly recommend him.
Clients said :-
Drupalcamp at Davos!
I was very happy to attend the Drupal Mountain Camp at Davos, 7 - 10 March. ZehnPlus was represented full house at the event. I presented a Flexible method for producing complex reports with Views and also co-presented Commerce payments and invoicing on any payment gaetway (made easy) and Build a CRM system based on Drupal Commerce with my co-workers. Additional sessions by ZehnPlus were the Setup and managing Drupal 8 with composer, git and drush and the workshop Git from zero to hero. It was nice to you all there again!
Speeding up your Drupal website with cloudflare
Cloudflare claims that can boost the speed of a website. But how much benefit can a site get? I am using Cloudflare for some drupal sites, but I never had a clear picture of how much the speed improvement really is. In this post I will present some data that I collected. The site I tested is a drupal site, but similar results can be expected for any other CMS like wordpress or joomla.
Running Drupal in Docker
In the simplest sentence, Docker allows to package software in an image that can run anywhere. Like virtual machines, Docker guarantees that the software that comes with the image will always run the same, regardless of the underlying environment.
Now, lets run Drupal in Docker!
Drush pro for the lazy: Aliases
Drush aliases allow us to execute commands on a remote site from the local console. It is the perfect tool for the lazy drupal developer. With drush aliases I rarely login to a remote server, I execute all the drush commands from my local console. It is also a great for workflow automation. Continue reading to help you set up your aliases.
Do you have a backup strategy? 3 tools to save your day
For drupal we have a number of different methods to backup the database. Having a backup strategy is one of the easiest things to do but is often overlooked. Perform regular backups to keep your sanity when disaster hits. Implement a backup strategy for daily weekly and monthly backups and look cool to the client. I am going to discuss about 3 different tools to backup your database. Read on so you have no excuse.
What is the features module?
Some time ago, a client asked me about the features module. He wanted to know what the features module is about and how it can help him with his project. Their set up was a pretty complex e-commerce application involving multiple content types and integration with 3rd party services. Yet, they were not using features and would manually replicate any changes from the developer's machine to the server. He was concerned about maintaining the site and how he could add some new functionality without breaking the existing configuration. My recommendation was that they start using features. He had not idea what it was so I wrote him an email explaining. Read on my full reply.
Use drush to add a component to a feature like a drupal pro
Features is one of those modules we can not do without. One annoying issue with features is that it is slow. The bigger the drupal site, the slower the features UI pages load. And waiting for the page to load is one of the most disturbing things during drupal development.
Adding a new component to a feature is a multistep process: Go the features page, add the component to the feature, download the feature, remove the old feature and extract the new one. And repeat many times during the day.
Fortunately, we can speed this process quite a bit. Drush to the rescue again! This post is going to explain how to use drush to add new components to a feature.
How to use the Feeds api
Feeds (http://drupal.org/project/feeds) is a very popular module. From the project page, we get a nice description of the module:
Import or aggregate data as nodes, users, taxonomy terms or simple database records.
The basic idea is that you throw a csv file to it and it creates drupal content. As simple as that. The input format can be more than just a csv, check the project page for more details.
We can use the feeds api http://drupalcode.org/project/feeds.git/blob/HEAD:/feeds.api.php if we want more functionality than the standard.
I am going to describe 3 different uses of the the feeds api:
- Perform an operation after a feed source has been parsed, before it will be processed
- Perform pre-save operations
- Add additional target options to the mapping form
How to write drush commands and hooks
I clearly remember the moment of excitement and joy couple of years ago when I discovered drush. Interacting with drupal from the command line? Wow! This was definitely something new to me, never seen it before in any cms.
Digging more, I discovered the wp-cli for the wordpress, but it seems that this in no way as mature as drush.
I use drush on a daily basis. For simple tasks such as clearing the caches or updating a feature to more complex stuff like in a deployment process or as an interactive php shell.
As with drupal, drush can also be extended. It is just a matter of writing the proper hook in the proper file. It is really simple and everyone can write their own drush commands.
As an example, I am going to show you how you to trigger a node save.
Automatically setup a vhost
Setting up an apache vhost is a boring task. This is why most of the times, I use the h*tp://localhost/project subdirectory for my development work.
This is perfectly ok for most cases, however in some occasions you may wish to create a virtual host so that your project is accessible like: h*tp://project
To do this, you need to create a file in the the sites-available directory of your apache instance, set up a link in the sites-enabled directory, add an entry in the /etc/hosts file and finally restart apache.
Too much work. Fortunately we can automate it:
Create a template file (you can copy from an old project) in the sites-available directory. Replace every reference of your old project name and directory name with 'TEMPLATE'. Name this template file also 'TEMPLATE'
Then, create a shell script and add the following lines:
Find and export variables with drush or features
Features is a must have tool for deploying drupal sites. Features can be used for storing the website configuration in files, instead of the database. It can for example allow you to store a view in a file. You can then commit this code to your repo as usual.
Must of the site's configuration is stored in variables. Features, when used with strongarm, can be used to also export those variables from your staging env to your production. You can always find the name of the variable, by inspecting the html code. I use another trick to easily locate the variable name:
You can use
to get the value of variable. For example,
drush vget cache
will return 1 or 0, depending on the value of the caching parameter set in admin/config/development/performance. If you dont know exactly the name of the variable, you can for example do a
Copy a remote database or backup with drush
I use drush a lot during development. A common task is to restore the database or copy the database from the stg server to my local machine.
A lot of people use Backup and migrate to do this which works fine but is just too many steps for me. With drush, this can be as long as a single command:
drush sql-sync @site-dev @self --sanitize
This command will copy the db from the dev server to the local machine.
The --sanitize switch will sanitize the email addresses and the passwords of the users. This way, you will be sure that there will no email accidentally sent from the devel machine.
Be carefull, not to switch the order of @site-dev and @self or you will copy the local db to the dev server.
It is usually good to do a:
before running the sql-sync command. This will drop the local db and it will likely save you some time troubleshooting.