Why decoupling Drupal
Amongst other things, I hear this quite a lot on my conversations around the subject, why decoupling Drupal, is not like you are giving away what Drupal is and overkilling with something you could do with other tools? What's the point?
Executing memcached in Travis
So, I heard you need Drupal and memcached running in Travis, right? But you have this "little" issue that Travis/Drupal cannot connect to memcached, something like:
WD memcache: You must enable the PHP memcache (recommended) or [error] memcached extension to use memcache.inc. WD memcache: Failed to connect to memcache server: 127.0.0.1:11211 [error]
Before you jump into docs and tutorials on how to install memcached in Travis, probably it's already there, you just have to enable.
Parse error: syntax error, unexpected ':', expecting ';' or '{' in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php on line 50
Easy error to fix, once you know what's going on (is not always the case?).
Just upgrade your system from php 5 to php7. Drupal8 requirement.
In BLT, just edit your box/config.yml and change this line
php_version: "5.6"
to this:
php_version: "7.2"
Good old vagrant provision should do the rest of the trick. You are welcome :-)
Ansistrano, deploying Drupal with Ansible
Last months have been pretty busy here at BBC Worldwide with some of the projects we've been involved in.
In my case, one of the main areas I’ve been trying to improve (apart of the daily busy routine) is our devops / CI approach. The previous approach was using Chef, but it was not really adopted by the developers (which meant that after some months, the system was broken) and we were lacking some fundamental things (like integration with the production system, a real CI flow, etc…).
Changing Short project name in a Drupal.org project
Typical problem, you have just gained your full project permissions role in Drupal.org, and you make your first mess... you have promoted your so loved first project without changing the Short project name.
Well, you have a problem, but not too big. Drupal.org will not allow you to rename your Short project name, so you will have to create a new one if you don't want to have an ugly url like that: https://drupal.org/project/2062343
Fortunately git can help. You will simply have to:
Drupal form api select elements returning integers instead of string
I always have the same problem when using select forms, and I always forget the solution.
Instead of returning an array, like: return $competitions; you have to return a drupal_map_assoc, like this: return drupal_map_assoc($competitions);
Otherwise, when selecting the form in hook_submit you will get a number, instead of a human readable string.
[gist:5920064]
Customize a webform with
- Read more about Customize a webform with
- Log in or register to post comments
Convert dates from UNIXTIME in mysql
Reading a date in mysql can be frustrating, unless your brain is able to convert Dates from UNIXTIME formats. Let's see for example this scenario in Drupal:
SELECT * FROM `node` ORDER BY `node`.`created` DESC LIMIT 0 , 30
If you need to fetch, for example, when it was the last time that a node was created, this format doesn't help too much.
The solution is quite simple, FROM_UNIXTIME( field_with_date )
For example:
SELECT * , FROM_UNIXTIME( created ) FROM `node` ORDER BY `node`.`created` DESC LIMIT 0 , 30
- Read more about Convert dates from UNIXTIME in mysql
- Log in or register to post comments
Deploying Drupal projects: git + capistrano
removing some folders from git, file .gitignore with these contents:
# Ignore paths that contain generated content.
cache/
files/
sites/*/files
sites/*/private
Using symbolic links for /files directory:
namespace:custom do
task:symlink do
run "ln -s /var/www/crucerista/sites/crucerista.net/files/ /var/www/crsta/current/sites/crucerista.net/"
run "echo 'finished'"
end
end
after "deploy","custom:symlink"
- Read more about Deploying Drupal projects: git + capistrano
- Log in or register to post comments
Optimizing a Drupal database: improving the performance
That is what you have when you don't optimize and maintenance properly your Drupal projects. A 4GB database which hits hugely the server performance. Just a couple of "magic tricks" and .... 194MB.
Magic? Not at all. If you have a problem with your server, with hangs up and things going very sloooow, check the cache. sessions and watchdog tables, and clear them.
It works like a charm :-)