Import multiple redirects from file

Hi sometimes we need quickly import a lot of redirects. We can just put file with redirects in format:

source/dummypage,redirect/destination-page

source/dummypage,redirect/destination-page

source/dummypage,redirect/destination-page

Then read line by line and create redirect if it is unique.

We can easilly do all this using code given below.

Tags: 

drupal 7 xhprof php profiling results example

Sometimes we need to provide php profiling to find bottlenecks inside our site. Xhprof extension is one of the best solutions. Here is example of found small issue and given graphs before and after chnages.

Graph before changes

xhprof profiling result before changes

After changes (I just added module_load_include into condition to call it not so often).

Disable drupal 7 css and js compression for some roles

If we need to disable drupal js or css compression for some roles we can use code below. Moreover we can change here ary settings from global $conf variable. For example you can change cache life time for certain roles or block caching. Any setting from this page http://yoursite.com/admin/config/development/performance can be changed in code given below. 

Thank you for reading! Continue doing drupal!

Disable drupal default search when use apache solr

In some projects, highly loaded ones, we need to optimize search work. Default drupal search is a bottleneck it takes a lot of resources and give slow responses. Even when apache solr module is installed and properly configured we need to leave default search enabled. It means that on any cron run default drupal search ndex will be rebuilded, it will take disk space and dozens of Mb in data base search_index table. To prevent this we need to execute one update_hook which will disable search index update during cron run and will make empty search_index and other search related tables.

Pages

Subscribe to drupaller.com.ua RSS