PiensaBlogs, la prensa del futuro se lee en internet    


Drupal slow when saving nodes (content, comments, admin ...)? Maybe the problem is really simple, try to deactivate some modules that you don't use. It is common to test modules that you finally don't use in your production server. Search for them and deactivate, they take a lot of memory, even if you think you are not using them.

 

 

 



Installing Varnish is really simple and easy to perform, and is very unlikely to give you problems with your server that any other more complex methods could give you, like using light servers or so. Probably you cannot compare both performances, but to start improving you Drupal server is a good point from where start.

Let's go:

1. Install Varnish. In Ubuntu / Debian is as easy as:

sudo apt-get install varnish

2. Install Varnish module in your Drupal:



Tipical mistake installing varnish accelerator:

* Not starting HTTP accelerator varnishd

Solution? so simple, edit /etc/default/varnish and look for the line:

START=no

change to

START=yes

and restart:

* Starting HTTP accelerator varnishd 

Nice :-)

 

 



seguro que más de una vez os habéis encontrado con este "problema". La solución, muy fácil, aunque seguro que usando el camino que probablemente habíais escogido no.

Olvida ls, para este problema necesitas la potencia de find:

find . -name 'nombreFichero.extension'

ejemplo:

find . -name 'fichero.php'

o bien, con "wildcards"

find . -name '*.php'

De nada ;-)



 

DELETE FROM `bbdd`.`table` WHERE `crucero`.`agencia` = "AGENCIA";

 



 

Añadimos una nueva entidad en CruiseHunter/CrucerosBundle/Entity/Naviera.php

actualizamos los datos:

- php app/console doctrine:generate:entities CruiseHunter/CrucerosBundle/Entity/Naviera

 

- php app/console doctrine:generate:entities CruiseHunter/CrucerosBundle/Entity/Naviera

 

Cuidado. si creamos el fichero en minúsculas, al hacer el doctrine:generate nos va a generar uno en mayúsculas, y nos dará el dichoso error de que no se puede crear dos veces una clase con el mismo nombre.



Error al subir una aplicación al sevidor en el que va a estar en producción:

symfony ErrorException: Warning: file_exists(): open_basedir restriction in effect

Después de estrujarme mucho los sesos, hize un

rm -rf app/cache/* 

y "evoilá" :-).

Después pueden salir algunos errores como:

UnexpectedValueException: The stream or file "/var/www/vhosts/*/app/logs/prod.log" could not be opened; it may be invalid or not writable.



Drupal es fantástico, es rápido levantar una aplicación con él, es muy muy flexible... casi como un framework de programación en si mismo... Quien diga que no se puede hacer algo en Drupal es simplemente porque no conoce la herramienta o porque no sabe programar sobre ella.

El problema? Es muy pesado... Esta es la única razón por la que algunos proyectos los estoy haciendo en Symfony :-(.



Tipycal scenario. Imagine you need to know which variables yo need in a concret place of your site, say /blog, a node or a view. Very easy, simple add a block, for example at your foot if available in your theme, with php input availabe, and this code:

<?php  print '<pre>';  var_dump(get_defined_vars());  print '</pre>';?>

Now, make it only available for your role, for example, and place it where you prefer (foot for example).



Has ever need to insert a custom title in your drupal views? Or need to use meta tags in this so important for your project, views results?

A extremeley flexible solution can go throug creating your own custom views templateviews-view.tpl.php (or views-view--NAME-OF-VIEW.tpl.php). Then you can use the Drupal api to insert whatever you want, title, meta tags, ...

Example:

<code>drupal_set_title('bodas');

</code>

or even more flexible: