Respect you yourself should (Joomla Critique #1)Respetarte tu mismo debes, (Crítica a Joomla #1)

Mientras trabaja por volver a levantar un sitio que antiguamente usaba joomla 1.0, tuve un pequeña molestia en el panel de control del nuevo 1.5, debido a que me salía un mensaje de error.

Afortunadamente no era fatal, ya que igualmente podía modificar los parámetros del sitio sin mayor inconveniente. Pero es molesto ver que algo no está bien, menos en un sistema grande como lo es Joomla.

El error me indicaba que había un archivo XML que no se estaba «parseando» adecuadamente, pero no me decía cual archivo ni cual error tenía.

Entonces decidí bajar una copia de seguridad del sitio completo, y replicarlo en mi máquina local para averiguar el error. Recordé que en linux existen miles de aplicaciones por consola, lo suficientemente poderosas para parsear y validar los XML’s de mi sitio.

Ya tuve una experiencia grata con el comando find. Pero me faltaba el comando para validar un archivo xml. Buscando encontré que posiblemente el comando xmllint me podría servir. Aunque finalmente no me ayudó, revelé un pequeño detalle que no me esperaba.

xmllint tiene una opción para validar, pero para realizar ese trabajo, requiere que 1) el archivo XML defina un DTD o 2) se le pase por parámetro. Probando sin usar un DTD por parámetro: probé lo siguiente:

find . -name "*.xml" -exec xmllint --noout --valid "{}" \;

Lamentablemente, el resultado no fue lo que esperaba. TODOS los XML salvo uno, eran inválidos, debido a que NO TENÍAN definido el DTD. Gracias a ese archivo que sí lo tenía, descubrí que joomla TIENE en su sitio un archivo DTD para que los desarrolladores lo incluyan en sus XML de configuración. De esta forma, el desarrollador obliga a que sus archivos XML tengan la estructura que el sistema requiere.

Lo peor… ese único archivo válido, era de un plugin de terceros y no de los desarrolladores oficiales. Es decir, los desarrolladores oficiales de joomla NO RESPETAN sus propias reglas al escribir el código.

Finalmente, xmllint no era lo que estaba buscando, ya que solo debía comprobar cual era el o los archivos mal formados (etiquetas mal cerradas, mal anidadas, …). Como no sabía, consulte en una lista de correo (una de las que tengo en la lista de comunidades), donde me dieron la solución: xmlwf.

Simplemente cambié el comando anterior por el siguiente y asunto arreglado:

find . -name "*.xml" -exec xmlwf "{}" \;

Encontré los culpables (eran 2), los corregí y di por terminado el asunto.
Pero me quedé con el sabor amargo de la despreocupación que los desarrolladores de Joomla han tenido en un detalle tan simple. ¿Que confianza me dan para cuando aparezca una nueva actualización del sistema?While working to re-build a site formerly used joomla 1.0, I had a little trouble in the control panel of the new 1.5, because I was leaving an error message.

Fortunately it was not fatal, since it could also modify the site parameters without much inconvenience. But it is not comfortable to see that something is not right, except for a large system such as Joomla.

The error indicated that I had an XML file that was not being parsed properly, but it’s not saying which file or which was wrong.

Then I downloaded a backup of the site, and replicate it on my local machine to find out the error. I remembered that there are thousands of Linux applications for console enough powerful to parse and validate the XML’s from my site.

I had an enjoyable experience with the find command. But I was missing the command to validate an xml file. Searching the web, I found that possibly the command xmllint I could. But ultimately did not help, this reveals a small unexpected detail.

xmllint has an option to validate, but to do this work, requires that 1) the XML file using a defined DTD or 2) it passes a DTD as a parameter. Testing without using a DTD by parameter, I tried the following:

find. -name "*.xml" -exec xmllint --noout --valid "{}" \;

Unfortunately, the result was not what I expected. ALL XML files except one, were invalid because they didn’t have defined the DTD. Thanks to that file that it was, I found that joomla has on its site a DTD file so that developers include it in yours XML configuration files. In this way, the developer requires that your XML files have the structure that the system requires.

The worst… that single valid file, was a third-party plugin and not the official developers. That is, the official joomla developers do not respect their own rules when writing code.

Finally, xmllint was not what I was looking for, and only had to check the file was malformed (bad labels closed nested bad …). As I did not know, see on a mailing list (the one I have in the list of FOSS Communities), where I got the solution: xmlwf.

Just change the above command with the following matter and fixed:

find. -name "*.xml"-exec xmlwf "{}" \;

I found the causers (they were 2), which I fixed and gave the matter ended.
But I stayed with the bitter taste of the disregard that the Joomla developers as a mere detail. What gives me confidence for when a new system update?