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.
Comments
Comment #1
Anonymous (not verified) commentedDoes this affect Drupal 5?
Comment #2
davyvdb commentedYes, this was tested in Drupal 5.
Comment #3
Anonymous (not verified) commentedComment #4
Anonymous (not verified) commentedCommitted patch to HEAD, 5.x-2.x-dev and 6.x-2.x-dev