Skip to main content
Penyaskito Blog

Main navigation

  • Home
  • Contact
Language switcher
  • English
  • Español
User account menu
  • Log in

Breadcrumb

  1. Home

Drupal

By penyaskito, 1 May, 2021
Screenshot of XHGui, showing information from a WordPress request

Profiling Drupal, WordPress or any php application with DDEV, XHProf and XHGui

I've been a very late adopter of Docker containers. Probably because most of my work in the last years was not dependent on the PHP version, so I used the same PHP version and MySQL/MariaDB as RDBMS every time. For a server I managed I played with LXC as a container system, and served quite well, but I didn't really need to touch it often, and my friend Andrés helped most of the times. Docker seemed confusing to me and, hold my beer, I thought it wouldn't stay, so I didn't really want to learn it. You might say now that my career as seer is over.

Not easily but I got to understand it, and really embraced and loved tools like docker-compose on top of docker. And when I had to work on a Drupal site using Postgres, my best bet was DDEV, abstracting docker-compose complexities but with all the freedom to customize it for your needs.  So that's my platform of choice most of the times in terms of local environments now. And lucky us, it's open source.

And the implicit non-enforced well-citizen contract of opensource is that you have to contribute back if you get the chance to improve it*. In minor contributions I've done before I found the DDEV community really encouraging and welcoming, thanks Randy! So lately I was in the need of  detecting performance bottlenecks in a site, and I've been working on integrating the provided XHProf with XHGui into DDEV. I recently contributed the recipe so you can use it too in less than 5 minutes! See it here: XHGui integration in DDEV documentation. 

* Needed clarification: not saying that you have to give back, not everyone has the same privilege than I do. But *if you did accomplish it already, try to contribute it*. 

If you enable XHProf, already provided with DDEV, it already monitors your application, but you need to collect that profiling report and send it somewhere where you can explore it in a friendly way. That's where perftools/php-profiler comes into play. It has the ability to manage which data you want to profile, and send it to XHGui. XHGui will run on a separate container, will receive the data profiled, store the data in a mongodb database in another container, and render it to you on the browser, where you can see several listings, graphs and images that will help you understand what's going on on your application. You can also compare different requests to a same page, so you see how the performance evolves too. Interpretation of that data is a complex topic on its own, so I won't go deeper here.

So the good news is that you can integrate that now into any project you have with DDEV, in less than 5 minutes. The docs are specific for Drupal 8+ (a composer project) and WordPress (a non-composer project, kudos to roots/bedrock for changing that), so that probably covers examples for any PHP application out there.  Hope this helps!

As a bonus track, I also worked on a DDEV command for enabling/disabling xhprof without having to restart  your project, type a very long command or ssh into the container. That's on that DDEV-contrib page too, but it's probably going to be accepted upstream in DDEV soon too.

Thanks Randy "rfay" Fay, Andrey "andypost" Postnikov and Mateu "e0ipso" Aguiló for the feedback, help and inspiration on working on this! 

Tags

  • docker
  • docker-compose
  • php
  • XHProf
  • DDEV
  • XHGui
  • WordPress
  • Drupal
  • Drupal planet
By penyaskito, 26 April, 2021
Selenium IDE was used for deleting spam

A personal site upgrade from Drupal 7 to Drupal 9: some migration tips

Welcome to just another blog with complex infrastructure for just a few visits. It was about time.

This post was intended to be a detailed guide about how I used Drupal migrate tools for upgrading from D7 to D9, but, being fair, it was quite straight forward, so I will just share some tips. Take into account that my last attempt to blog lost its pace quite fast, so I could have been migrating it manually and probably had saved some time. But as someone who contributed to the migrate initiative and the Drupal to Drupal migrations, it's quite a shame that I never actually used it in a real project. 

My source site was a D7 site using the blog module, which has been removed from core in D8. I could just use the contributed version linked above, but I wanted to use an "article" content type from now on. Instead of creating a custom migration, I thought I would give a chance to the Drupal Migrate UI.

So even if we are not using a custom migration and we don't have to think about content mapping and such, there is basic cue that you need to take into account: upgrading your site is the best time for taking the trash out.

Upgrading your site is the best time for taking the trash out. E.g. delete spam.

So first steps would be removing spam. I had used a free Mollom account in the past (RIP, thanks for your service), but I didn't rethink my spam prevention strategy when it was discontinued. Thousands of comments and registered users were in my database, and that was slowing down a lot my first attempts to migrate. I hacked Drupal 7 so the comment and user forms filtered data that I was sure it was spam by altering their queries, and allowing me to delete more content at once. Then I recorded with Selenium IDE some automation for deleting those, as even if scripting or some SQL queries might be faster, sometimes I just enjoy watching the browser do stuff for me.

After that, the process was mostly straightforward. Install Drupal Migrate UI and its dependencies, follow the process and complete. But your content after the migration needs to be audited, so you didn't miss content or config in the process. Specially since the Drupal upgrade process doesn't support rollbacks yet (don't worry if you have your custom migrations, in that case it's supported).

Audit your content after your migration. You might have missed something.

In my case, I had to restart again as my multilingual content was not being migrated. I quickly figured out that the settings must be in place before your content is migrated. Install the multilingual modules if that's your case, and review your translation strategy and the related content translation settings before migrating, e.g. content types and taxonomies. 

If you have multilingual content, review your strategy and according settings before upgrading.

In my case, I had used tags in Spanish and English, and those were not mapped to each other when they were the same concept in the source site. From now on, and thanks to the vast improvements in multilingual support from D8 on, I wanted to change that. I did those mappings by hand, and here we are. 

I picked the new experimental Olivero theme and the new experimental Claro admin theme because they look great, but also because testing them is a good way of helping out them move forward.

I leave for another moment my choice of contrib modules for the site, some issues I needed to workaround by a small custom module, and my infrastructure setup based in docker containers. I promise that I will make that happen before another ton of years pass.

Tags

  • multilingual
  • migration
  • hello-world
  • Drupal
  • Drupal planet
By penyaskito, 10 November, 2012

Drupalcamp Spain 2012

On October 20th and 21st took place in Madrid the 3rd edition of the biggest Drupal event in Spain, Drupalcamp Spain 2012. On Saturday I participated on a panel with Pedro Cambra, Ramon Vilar, Juampy Novillo and José Reyero about how to contribute to Drupal, with modules, themes, translations, documentation, marketing, events... The slides we used as guide are available on Slideshare:

Contribuir en Drupal: Por dónde empiezo? from Christian Lopez

On Sunday, I made a session where I tried to explain the changes in multilanguage between Drupal 7 and Drupal 8, that will be a reality hopefully on August 2013. The slides are also available in Slideshare:

Multilenguaje en Drupal 8 from Christian Lopez

The videos of every session will be available soon at the Vimeo channel of the Spanish Drupal Association.

That weekend took place the first Assembly of the Spanish Drupal Association, where I was nominated as a Board Member. I hope to contribute with them spreading Drupal use in Spain.

And after a very busy weekend, a plane to Frankfurt. But that's part of another story.

Post image: Some rights reserved by Pedro Lozano

Tags

  • Drupal
  • Drupalcamp
  • Drupalcamp Spain
  • AED
  • multilingual
  • contributing
  • sessions
  • slideshare
  • Drupal planet
By penyaskito, 24 September, 2012

Git workflow with submodules for Drupal deployment

Maybe you've seen the great article on Drupal Deployment with Git Submodules, by Randy Fay. I manage this site using that strategy, but some times I forget how every operation is done. So here I'm collecting them for my own reference.

For fetching all the new info from submodules: 

git submodule foreach git fetch origin

Now we go into each module folder and use:

git pull 

If we wanted to switch to a different branch, we should use:

git branch -a # we see the available branches 
git checkout 7.x-2.x # the different branch 

For committing it, we go back to the contrib folder and do:

git add contrib-module-name 

Then, we use:

drush updb --debug -y 

Maybe we see some warnings because of unresolved dependencies. In that case, add the new submodule:

git submodule add --branch 7.x-1.x git://git.drupal.org/project/entity.git sites/all/modules/contrib/entity 

Finally, updating core:

git merge drupal/7.x drush updb --debug -y 

Ok, so we've done this on our DEVELOPMENT site. If everything is OK, now it's time to update the server, after doing a backup:

git pull
git submodule update --init 
drush updb --debug -y

Tags

  • git
  • git submodules
  • workflow
  • Drupal
By penyaskito, 17 August, 2012

Remoting for the Drupalcon Munich D8MI Sprint

After participating on the Drupal Developer Days D8MI Sprint, I was very sad I couldn't assist to the Munich Drupalcon one, but I decided to participate remotely.

I asked for people who wanted to join me on the Sevilla Drupal Group, and Jesús Balsera (jsbalsera) and Juan Fernández (@Maxtorete) joined me.

We'll start today and will be sprinting until next Sunday, if everything goes well and nobody leaves (hope so). 

The focus on D8MI is set, and these are some notes I took about some issues that I'd like we collaborate with:

  • http://drupal.org/node/1733746 => D8 installer is broken if selecting a non-English language on installation => Drupal core, install system, normal, needs work, 3 comments, 1 IRC mention
This is a problem when installing D8 in another language. A patch is attached, but needs some work.
@penyaskito did the initial work.
@jsbalsera managed to fix the requested changes and use drupal_classloader_register instead of include_once. Other sprinters did more tweaks and it was committed :-)
http://drupalcode.org/project/drupal.git/commit/3f92626
 
  • http://drupal.org/node/1738178 => Javascript library localisation vs localization => Drupal core, locale.module, normal, fixed, 5 comments, 5 IRC mentions
Minor string fix, reported by @penyaskito.
http://drupalcode.org/project/drupal.git/commit/428226c
 
  • http://drupal.org/node/1392208 => Impossible to install Drupal in a non-English language when following the provided instructions => Drupal core, install system, normal, needs review, 12 comments, 2 IRC mentions
@Gabor & @penyaskito.
http://drupalcode.org/project/drupal.git/commit/ea5de2e
 
  • http://drupal.org/node/1637348 => Import Gettext .po files in progressive batches to avoid time limits => Drupal core, language system, normal, fixed, 28 comments, 15 IRC mentions
@penyaskito worked on this at Barcelona and has been completed now.
http://drupalcode.org/project/drupal.git/commit/7e79095
 
  • http://drupal.org/node/1658842 => Introduce a translations:// stream wrapper to access the .po file directory => Drupal core, language system, normal, needs work, 12 comments, 3 IRC mentions
@penyaskito working on it. NW.
 
  • http://drupal.org/node/1738330 => Confusing Language negotiation when accessing / => Drupal core, language.module, normal, active, 0 comments, 2 IRC mentions
@jsbalsera working on it
 
  • http://drupal.org/node/253157 => Add a new user permission "Translate own nodes" => Drupal core, translation.module, normal, needs work, 31 comments, 3 IRC mentions
Needs rerolling, functionality tests and upgrade tests.
@penyaskito rerolled it.
@maxtorete is writing functional tests. NW
 
  • http://drupal.org/node/1189184 => OOP & PSR-0-ify gettext .po file parsing and generation => Drupal core, locale.module, normal, needs work, 256 comments, 70 IRC mentions
Properly test this.
Minor follow-ups.
 
  • http://drupal.org/node/1632384 => Import available language data and translations form translation server => Drupal core, locale.module, normal, needs review, 13 comments, 5 IRC mentions
 
 
  • http://drupal.org/node/1627006 => Collect project information for translation update => Drupal core, locale.module, normal, needs review, 23 comments, 5 IRC mentions
Work started
 
  • http://drupal.org/node/1191488 => META: Integrate l10n_update functionality in core => Drupal core, locale.module, normal, active, 12 comments, 4 IRC mentions
This is a major issue broken into smaller pieces. Those ones needs care. Doesn't look specially easy.
 

Let's see what we can afford.

 

Tags

  • sprint
  • Munich DrupalCon
  • D8MI
  • contributing
  • Drupal
  • Drupal Core
By penyaskito, 5 August, 2012

Drupal Sevilla Talk: Contributing to Drupal

On last Wednesday, I participated at the August Sevilla Drupal Group monthly meeting, talking about my experience contributing to Drupal.

We walked through how to contribute translations, the modules and themes contribution approval process, how to report issues, how to contribute a patch and how you could become involved in the on progress Drupal Initiatives. We also did a quick review on what we can expect of Drupal 8.

The slides I used are based on Webchick's "One Drupal 8 Slide Deck To Rule Them All". For the reference, they are available on Slideshare: Contributing to drupal from Christian Lopez

I saved on Del.icio.us too a collection of the links we looked at.

Tags

  • Drupal
  • talks
  • contributing
  • Sevilla
By penyaskito, 5 August, 2012

OOP & PSR-0-ify gettext .po file parsing and generation

One year ago, a refactoring at the Gettext .po file parsing and generation started.

Finally, that issue has been fixed. I were working with Sutharsan, ClemensTolboom, GaborHojtsy and Attiks on this issue at the Drupal Developer Days sprint, and after the sprint we finally (well, mostly Gábor...) pushed forward to its completion.

The new design is something like this:

Gettext design

(Diagram by Gábor Hojtsy)

I'm very grateful for their help on being started on contributing to the D8MI Initiative, and hopefully I'll be working on more things into the D8MI sprint. Any help is welcome!

Tags

  • D8MI
  • Drupal Core
  • Drupal
  • contributing
  • commit
  • multilingual
By penyaskito, 14 June, 2012

Drupal D8MI Sprint: Day 3

So third day of the Sprint, with Peter, Clemens and I working on Gettext. It would be the last day for Clemens, so we expected to do great advances :-)

Day started great, and I don't get stuck like previous days with obvious things. We kept with the refactoring and finally core/includes/gettext.inc could be removed. w00t!

Thanks to Gábor's explanation we understood what was expected for the batch API part of this, so we are able of advancing on that, but maybe on another issue context. This one became too big and splitting it could be of help. Peter wrote some more integration tests, and I finished fixing plurals handling and cleaning up some methods. Thanks Clemens for your patience, and hope that we can advance without you in the next days!

Tags

  • Drupal
  • D8MI
  • contributing
  • sprint
  • Barcelona
  • initiatives
  • Drupal Core
  • i18n
  • patches
By penyaskito, 14 June, 2012

Drupal D8MI Sprint: Day 2

Ok, so I failed on Tuesday on updating the blog, but a quick summary.

Clemens and I kept working on the Gettext component on D8MI sandbox. I got a little lost and we had an Skype call in the morning were he explained me what he was expecting. We did some clean up and kept working on it. Some commits got into the sandbox, but lot of works still remaining. Fortunately, in the afternoon Attiks joined us, so more hands (and brain) on code!

Tags

  • Drupal
  • D8MI
  • contributing
  • sprint
  • Barcelona
  • initiatives
  • Drupal Core
  • i18n
  • patches
By penyaskito, 12 June, 2012

Drupal D8MI Sprint: Day 1

Today, the D8MI sprint started. Met the assistants.

At 10 am, Gábor introduced the multilanguage architecture for Drupal 8. It's composed of four layers, with the locale module at the base, and on top of it the UI, the content translation and the config translation. He presented the people responsible of each so we know who we need to talk for anything, and how we could work on his D8MI sandbox. After this, the presentation round where everyone exposed the areas he was interested.

As planned, I started helping out Clemens with the Gettext .po file generation.  The morning has been quite frustrating. I catched up with the comments, and saw that it was not an easy thing. Clemens and Erik have most of the issue already working, but some problems appeared when I tried to test it, and Clemens helped out to find the causes. We updated the summary accordingly. After that, I headed with some errors because of inconsistent naming of classes and its references, an issue that was not happening on Clemens' Mac computer. Fixing this was my first commit to the sandbox :D 

After dinner, work started to happen smoothly. Clemens was working with plurals and we discussed how the responsability of formatting those should be out of the PoItem object, and with his change on this implementation the tests went back to green :-)

After some silly issues that I had generating a git patch, I started to feel more confident. While Clemens update the issue summary for showing up the change of scope it had through the comments, I started to think on how to refactor PoDatabaseWriter. This should continue tomorrow.

Gábor is reporting the progress at this document: D8MI sprint report. The global balance of the 1st day is only one commit to 8.x, but it seems that code will flow better on next days. By now, it's being an awesome experience working with these folks.

Tags

  • Drupal
  • D8MI
  • contributing
  • sprint
  • Barcelona
  • initiatives
  • Drupal Core
  • i18n
  • patches

Pagination

  • 1
  • Next page
Drupal

Monthly archive

  • December 2021 (1)
  • May 2021 (2)
  • April 2021 (1)
  • September 2014 (1)
  • November 2012 (1)
  • September 2012 (2)
  • August 2012 (3)
  • June 2012 (6)

Recent content

Rewriting history on a git repository for editing author and email on past commits
1 year 3 months ago
A Drupal JavaScript behavior for marking edited line items in the cart
1 year 10 months ago
Profiling Drupal, WordPress or any php application with DDEV, XHProf and XHGui
1 year 10 months ago
A personal site upgrade from Drupal 7 to Drupal 9: some migration tips
1 year 11 months ago
Salesforce: generating Excel files from VisualForce APEX pages
8 years 6 months ago
Drupalcamp Spain 2012
10 years 4 months ago
Non-interactive performance tests and reporting with JMeter
10 years 6 months ago
Git workflow with submodules for Drupal deployment
10 years 6 months ago
Remoting for the Drupalcon Munich D8MI Sprint
10 years 7 months ago
Drupal Sevilla Talk: Contributing to Drupal
10 years 7 months ago

Recent comments

Thanks for the comment
1 year 10 months ago
Thanks for sharing this…
1 year 10 months ago
Looking good!
1 year 11 months ago
lopd
8 years 11 months ago
LOPD
9 years ago
Gridinit
10 years 5 months ago
Ya la tiene
10 years 6 months ago
Debería :-P
10 years 6 months ago
Ei! tiene buena pinta...
10 years 6 months ago
Buenas Fco Antonio,
10 years 6 months ago

Blogs I follow

Mateu Aguiló "e0ipso"
Gábor Hojtsy
Pedro Cambra
The Russian Lullaby, davidjguru
Can It Be All So Simple
Maria Arias de Reyna "Délawen"
Matt Glaman
Josef Ottosson (dotnet)
Daniel Wehner
Jacob Rockowitz
Syndicate

Footer

  • Contact
  • Drupal.org
  • LinkedIn
  • GitHub
  • Twitter
Powered by Drupal