diff options
author | cash <cash.costello@gmail.com> | 2012-02-01 18:57:00 -0500 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2012-02-01 18:57:00 -0500 |
commit | 06ba6ccfb8bb5a8da8464d8f86454b468744c9cc (patch) | |
tree | 1043b2b610bdf87b651b149b57eb5219b25b4e1f /engine/lib | |
parent | df535f87fbf6641bcadc2ffaa01846cad4cd9524 (diff) | |
download | elgg-06ba6ccfb8bb5a8da8464d8f86454b468744c9cc.tar.gz elgg-06ba6ccfb8bb5a8da8464d8f86454b468744c9cc.tar.bz2 |
fixed logic that caused plugin language files to not be loaded
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/languages.php | 35 | ||||
-rw-r--r-- | engine/lib/plugins.php | 3 |
2 files changed, 19 insertions, 19 deletions
diff --git a/engine/lib/languages.php b/engine/lib/languages.php index c6e2fc152..bf6829a39 100644 --- a/engine/lib/languages.php +++ b/engine/lib/languages.php @@ -145,9 +145,16 @@ function elgg_echo($message_key, $args = array(), $language = "") { function register_translations($path, $load_all = false) { global $CONFIG; + static $load_from_cache; + static $cache_loaded_langs; + if (!isset($load_from_cache)) { + $load_from_cache = $CONFIG->system_cache_enabled; + $cache_loaded_langs = array(); + } + $path = sanitise_filepath($path); - // Make a note of this path just incase we need to register this language later + // Make a note of this path just in case we need to register this language later if (!isset($CONFIG->language_paths)) { $CONFIG->language_paths = array(); } @@ -164,36 +171,29 @@ function register_translations($path, $load_all = false) { $load_language_files = array_unique($load_language_files); - if ($CONFIG->system_cache_enabled && !$load_all) { + if ($load_from_cache && !$load_all) { // load language files from cache $data = array(); - $anything_loaded = false; - $missing_cache = false; foreach ($load_language_files as $lang_file) { $lang = substr($lang_file, 0, strpos($lang_file, '.')); - // only load if this language isn't already loaded - if (!isset($CONFIG->translations) || !isset($CONFIG->translations[$lang])) { + if (!isset($cache_loaded_langs[$lang])) { $data[$lang] = elgg_load_system_cache($lang_file); - if (!$data[$lang]) { - $missing_cache = true; - break; + if ($data[$lang]) { + $cache_loaded_langs[$lang] = true; } else { - $anything_loaded = true; + // this language file not cached yet + $load_from_cache = false; } } } - // did we load all requested languages from the cache - if (!$missing_cache && $anything_loaded) { + // are we still suppose to load from cache + if ($load_from_cache) { foreach ($data as $lang => $map) { add_translation($lang, unserialize($map)); } - $CONFIG->i18n_loaded_from_cache = true; return true; - } else if (!$missing_cache && !$anything_loaded) { - // everything previously loaded from cache - return true; } } @@ -220,6 +220,9 @@ function register_translations($path, $load_all = false) { elgg_log("Translations loaded from: $path"); + // make sure caching code saves language data if system cache is on + $CONFIG->i18n_loaded_from_cache = false; + return $return; } diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 488387ba7..07b21d276 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -303,9 +303,6 @@ function elgg_load_plugins() { if (elgg_get_config('system_cache_loaded')) { $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS; - if ($CONFIG->i18n_loaded_from_cache) { - $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_LANGUAGES; - } } $return = true; |