MDL-35628 performance: Remove dirname() where possible.
dirname() is a slow function compared with __DIR__ and using '/../'. Moodle has a large number of legacy files that are included each time a page loads and is not able to use an autoloader as it is functional code. This allows those required includes to perform as best as possible in this situation.
This commit is contained in:
@@ -39,7 +39,7 @@ class core_string_manager_standard_testcase extends advanced_testcase {
|
||||
public function test_string_manager_instance() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$otherroot = dirname(__FILE__).'/fixtures/langtest';
|
||||
$otherroot = __DIR__.'/fixtures/langtest';
|
||||
$stringman = testable_core_string_manager::instance($otherroot);
|
||||
$this->assertInstanceOf('core_string_manager', $stringman);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ class core_string_manager_standard_testcase extends advanced_testcase {
|
||||
public function test_get_language_dependencies() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$otherroot = dirname(__FILE__).'/fixtures/langtest';
|
||||
$otherroot = __DIR__.'/fixtures/langtest';
|
||||
$stringman = testable_core_string_manager::instance($otherroot);
|
||||
|
||||
// There is no parent language for 'en'.
|
||||
|
||||
Reference in New Issue
Block a user