When running l10n_update_batch_multiple() the function _l10n_update_locale_import_po() is called for every file.
This in turn executes this code:

  // Clear cache and force refresh of JavaScript translations.
  _locale_invalidate_js($langcode);
  cache_clear_all('locale:', 'cache', TRUE);

  // Rebuild the menu, strings may have changed.
  menu_rebuild();

I have around 115 .po files to import frequently (on site [re]install) so you can imagine that this takes a long time. Especially rebuilding the rather large menu over a hundred times.

How can we change this so that these caches are only rebuild once, at the end of the batch?

Comments

sutharsan’s picture

Status: Active » Needs work

Good point. We can set a flag to invalidate this, perhaps there is an existing flag we can re-use. This would be my preferred method. Alternatively the invalidation and cache clear could be done in the batch finish function.

slurpee’s picture

Issue summary: View changes

Hello from Drupal's GSoC 2014 team. Google Summer of Code (GSoC)? - an annual contest for university students organized by Google with projects managed by open source organization mentors such as us (Drupal!).

We're currently browsing the issue queue looking for projects. Do you think this issue/project is worth a student spending a summer on it and being paid by Google? If so, are you interested in mentoring the student? Learn more about Summer of Code and how to get involved at links below. We're submitting our Summer of Code application to Google in just over 24 hours and looking for last minute ideas. Please respond quickly if you're interested.

Group to join - https://groups.drupal.org/google-summer-code

Ideas for projects for Summer of Code 2014 - https://groups.drupal.org/node/404778

GSoC Homepage http://www.google-melange.com/gsoc/homepage/google/gsoc2014

Google's Summer of Code 2014 Announcement - http://google-opensource.blogspot.com/2014/02/mentoring-organization-app...

sutharsan’s picture

@Slurpee, Thanks for the reminder. But the 7.x-2.x branch of this module should be able to solve this problem (and other performance problems of this module). A full summer project would be over the top to get this branch working properly.

sutharsan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.69 KB

Please check and test this patch.

sutharsan’s picture

Status: Needs review » Fixed

Patch committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.