Posts

Showing posts from July, 2016

Debug Drupal query using query_alter

Add your query probably in your custom hook_init() function mymodule_hook_init() { $query = new EntityFieldQuery();   $result = $query->entityCondition('entity_type', 'node')       ->entityCondition('bundle', 'mybundle')       ->propertyCondition('status', 1)       ->propertyOrderBy('created', 'DESC')       ->fieldCondition('field_news_type', 'tid', '282', '=')       ->addTag('efq_debug')       ->range(0, 10)       ->execute(); } In the custom module add this function mymodule_query_alter($query) {   if ($query->hasTag('efq_debug')) {     $sql = (string) $query;     $connection = Database::getConnection();     foreach ((array) $query->arguments() as $key => $val) {       $quoted[$key] = $connection->quote($val);     }     $sql = strtr($sql, $quoted)...

Drupal service (service module) examples

Call a drupal service (service module) using curl example: curl -i http://localhost/voc/taxonomy_vocabulary/getTree --header 'Content-Type: application/json' --header 'Accept: application/json' --data '{"vid":"yourvid"}' You should be using 'operations' in services module for the post. Post examples; curl -H 'Content-type: application/json' -X POST -d '"param1":"value1","param2": [{"value":"test"}]' [{"value":"test"}] is a array GET examples; http://localhost/gopi/taxonomy_term?page=0&fields=name,weight&options[orderby][name]=desc q = endpoint / taxonomy_term . json & fields = tid , name & parameters [ name ] = % foo % & options [ parameters_op ] [ name ] = like & options [ orderby ] [ name ] = asc

Find who is running apache

ps aux | egrep '(apache|httpd)' If you can't find which user or group Apache is running as, perhaps try opening the httpd.conf file. There should be an entry there for "User" and "Group". Not only can you see which user Apache is supposed to be running as, but you can change it if you feel the need to do so.