mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Performance imporvement to i18n::include_by_locale
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84166 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a74129b5a6
commit
08844f66b0
@ -1732,13 +1732,14 @@ class i18n extends Object {
|
|||||||
* @param string $locale All resources from any module in locale $locale will be loaded
|
* @param string $locale All resources from any module in locale $locale will be loaded
|
||||||
*/
|
*/
|
||||||
static function include_by_locale($locale) {
|
static function include_by_locale($locale) {
|
||||||
$topLevel = scandir(Director::baseFolder());
|
$base = Director::baseFolder();
|
||||||
|
$topLevel = scandir($base);
|
||||||
foreach($topLevel as $module) {
|
foreach($topLevel as $module) {
|
||||||
//$topLevel is the website root, some server is configurated not to allow excess website root's parent level
|
//$topLevel is the website root, some server is configurated not to allow excess website root's parent level
|
||||||
//and we don't need to check website root's parent level and websit root level for its lang folder, so we skip these 2 levels checking.
|
//and we don't need to check website root's parent level and websit root level for its lang folder, so we skip these 2 levels checking.
|
||||||
if($module[0] == '.') continue;
|
if($module[0] == '.') continue;
|
||||||
if (file_exists(Director::getAbsFile("$module/_config.php")) &&
|
if (file_exists("$base/$module/_config.php") &&
|
||||||
file_exists($file = Director::getAbsFile("$module/lang/$locale.php"))) {
|
file_exists($file = "$base/$module/lang/$locale.php")) {
|
||||||
include_once($file);
|
include_once($file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user