By alexmoreno, 22 January, 2013

Debugging cron issues and errors is one of the most tricky things in Drupal. If you are dealing with a big site, with people adding nodes, inserting content which you can't allways force to be commited in the right way, and things like that, it is not unusual to find a cron broken by some "misterious" node.

Well, it is quite easy to find this "misterious" offender, just logging the cron activity. How, very easy, with my new module "cron_killing_finder".

It is published in my "Drupal SandBox": http://drupal.org/sandbox/programadoresweb/1895746

By alexmoreno, 22 January, 2013

The error is quite enoying:

warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'GMT/0.0/no DST' instead

But it is quite simple to correct. It is not a drupal problem, but a linux/apache. Just go to your php.ini, for example /etc/php.ini in CentOS and add this line:

date.timezone = Europe/London

By alexmoreno, 22 January, 2013

 

Sometimes you need to upload files to, for example, validate an affiliate with whom you want to start to work.

The problem, is that these affiliate files need to be "clean", no template, no theme, just the code or validation string which they send.

The solution can be very complicated, like creating a new theme just for a group or a contect of pages... or as simple as creating a node with the string which we need and executing a php code with an exit command. Something like this:

 

valicationStringLikeUZasdBNf6asdfT2asdfafjpdadf===58QYg==

<?php

By alexmoreno, 21 January, 2013

If you try to mount a shared folder in centos, runing under a virtual box, you'll probably have problems trying to fix this directory, mounting automatically each time the system reboots.

In any other distribution, like ubuntu, you just have to go to your /etc/fstab and add this line:

varhtml                 /var/www/html   vboxsf  defaults        0 0

The problem is centos is that when the system arrives to this line, the vboxsf module has not been loaded yet.

By alexmoreno, 9 January, 2013

 

Sometimes in Drupal you need to get the fields for a particular content types. 

"$type = 'mytype';

$fields = content_fields();

$type_fields = array();

foreach ($fields as $field_name => $field_data)

{

  if ($field_data['type_name'] == $type)

  {

    $type_fields[$field_name] = $field_data;

  }

}"

 

in drupal7 is easier, since we have a direct function:

field_info_instances($entity_type = NULL, $bundle_name = NULL)

 

 

By alexmoreno, 9 January, 2013

very simple:

        global $theme_key;

      echo $theme_key;

 

if we need more information, we can use this:

       $themes = list_themes();

       $theme_object = $themes[$theme_key];

 

        // print all the object fields

       var_dump($theme_object);

 

via http://drupal.org/node/46961#comment-88354

By alexmoreno, 6 January, 2013

Sometimes you need to change some parameters to your apache virtual host. Then, when you need to check the changes, in plesk you'd probably will have to execute the next command to see the changes:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain exampledomain.com

Otherwise, restarting apache (/etc/init/apache2 restart) could not make the trick.

I allways forgot this little trick... never more, because Programadores Web will remind it me :-).

By alexmoreno, 5 January, 2013

De verdad que España me parece cada vez más lejana. Estoy viendo una oferta de trabajo y de verdad que los sueldos son "tercermundistas".

El país no va a salir de la economía agro-inmobiliaria en la que se ha basado hasta ahora si se está ofreciendo por un senior lo que en Londres se ofrece para un junior de cualquier tecnología. Menciono Londres por poner un ejemplo que conozco bien (porque vivo y trabajo en Londres), pero en el resto de Europa ocurre exactamente igual.

By alexmoreno, 21 December, 2012

Download the apachesolr module from drupal.org, and put it in sites/all/modules:

http://drupal.org/project/apachesolr

download solr-php-client, version 22

http://code.google.com/p/solr-php-client/downloads/list

and uncompress it in the apachesolr module directory.

Ready to activate the module, but we will did not installed the Apache server, so the module will not work.

Now, as you guessed, it's time to install the apache solr server. Download one of the latests releases:

http://www.apache.org/dyn/closer.cgi/lucene/solr/