Setting up Varnish for Drupal on CentOS 6

Varnish has an offical repository so let’s add it to Yum as outlined on https://www.varnish-cache.org/installation/redhat sudo rpm –nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm sudo yum install varnish Set Varnish to start on system boot sudo chkconfig varnish on Setup DAEMON_OPTS in /etc/sysconfig/varnish, something like below. It will be commented out by default: DAEMON_OPTS=”-a :80 \ -T localhost:8080 \ -u varnish -g… Continue reading Setting up Varnish for Drupal on CentOS 6

Setting up memcached with Drupal 7 on Centos 6

Firstly get access to RPMForge repositories. Next install memcached: sudo yum install memcached sudo service memcached start memcached -h Check memcache stats: echo “stats settings” | nc localhost 11211 watch “echo stats | nc 127.0.0.1 11211” Configure memcache: sudo vi /etc/sysconfig/memcached Configuration details for memcache can be found here Install the PECL memcached extension for… Continue reading Setting up memcached with Drupal 7 on Centos 6

Regenerating Path Aliases Programatically in Drupal 7

It should look something like this: /** * Update path aliases for taxonomy terms and nodes. */ function gateway_controller_update_7057() { module_load_include(‘inc’, ‘pathauto’); module_load_include(‘inc’, ‘pathauto.pathauto’); // Delete the existing node aliases. db_delete(‘url_alias’) ->condition(‘source’, ‘node/%’, ‘LIKE’) ->execute(); // Regenerate the node aliases. $nids = db_query(“SELECT nid FROM {node}”)->fetchCol(); pathauto_node_update_alias_multiple($nids, ‘bulkupdate’); // Delete the topics taxonomy aliases. db_delete(‘url_alias’)… Continue reading Regenerating Path Aliases Programatically in Drupal 7

Published
Categorized as Drupal7

Drupal 7 – Programatically update a media module file display image style

I needed to push a change to a file display’s image style through to production, and Features didn’t seem to want to take it so I needed to push it via an update hook. Using code from file_entity_file_display_form_submit() and media_install() i came up with this, which worked: $display_name = ‘video__preview__media_youtube_image’; $image_style = ‘media_thumbnail’; $display = array(… Continue reading Drupal 7 – Programatically update a media module file display image style

Published
Categorized as Drupal7