At the top of advuser.module there is a t() defined in a define(). This can not work and has huge performance issues.

define('ADVUSER_SUBSTITUTION_TEXT', t('<strong>Substitution variables</strong> available in subject and email body<br/><em> %user_name, %user_email, %user_status, %user_created, %user_theme, %user_timezone, %user_language, %user_signature, %site, %uri, %google_user (search google for user email), %yahoo_user (search yahoo for user email)</em>'));

In function locale() the global $locale isn't set yet when the define function runs. This way the locale cache is rebuilt on every page request (locale_refresh_cache). On a site with a lot of t() calls this means a huge cache_set (in our case 500kb).

function locale($string) {
  global $locale;
  static $locale_t;

  // Store database cached translations in a static var.
  if (!isset($locale_t)) {
    $cache = cache_get("locale:$locale", 'cache');

    if (!$cache) {
      locale_refresh_cache();
      $cache = cache_get("locale:$locale", 'cache');
    }
  }

The attached patch takes the t() away from the define() and puts a t() around each instance of the constant.

CommentFileSizeAuthor
advuser.module.patch1.74 KBdavyvdb

Comments

Anonymous’s picture

Does this affect Drupal 5?

davyvdb’s picture

Yes, this was tested in Drupal 5.

Anonymous’s picture

Version: master » 5.x-2.x-dev
Anonymous’s picture

Status: Needs review » Fixed

Committed patch to HEAD, 5.x-2.x-dev and 6.x-2.x-dev

Status: Fixed » Closed (fixed)

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