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:
@@ -26,8 +26,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/locallib.php'); // workshop internal API
|
||||
require_once(__DIR__ . '/../lib.php'); // interface definition
|
||||
require_once(__DIR__ . '/../../locallib.php'); // workshop internal API
|
||||
|
||||
/**
|
||||
* Allows users to allocate submissions for review manually
|
||||
|
||||
@@ -28,9 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG; // access to global variables during unit test
|
||||
|
||||
require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/locallib.php'); // workshop internal API
|
||||
require_once(dirname(__FILE__) . '/settings_form.php'); // settings form
|
||||
require_once(__DIR__ . '/../lib.php'); // interface definition
|
||||
require_once(__DIR__ . '/../../locallib.php'); // workshop internal API
|
||||
require_once(__DIR__ . '/settings_form.php'); // settings form
|
||||
|
||||
/**
|
||||
* Allocates the submissions randomly
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(dirname(__FILE__) . '/lib.php');
|
||||
require_once(__DIR__ . '/lib.php');
|
||||
|
||||
$settings->add(new admin_setting_configselect('workshopallocation_random/numofreviews',
|
||||
get_string('numofreviews', 'workshopallocation_random'),
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/locallib.php'); // workshop internal API
|
||||
require_once(dirname(dirname(__FILE__)) . '/random/lib.php'); // random allocator
|
||||
require_once(dirname(__FILE__) . '/settings_form.php'); // our settings form
|
||||
require_once(__DIR__ . '/../lib.php'); // interface definition
|
||||
require_once(__DIR__ . '/../../locallib.php'); // workshop internal API
|
||||
require_once(__DIR__ . '/../random/lib.php'); // random allocator
|
||||
require_once(__DIR__ . '/settings_form.php'); // our settings form
|
||||
|
||||
/**
|
||||
* Allocates the submissions randomly in a cronjob task
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot.'/lib/formslib.php');
|
||||
require_once(dirname(dirname(__FILE__)) . '/random/settings_form.php'); // parent form
|
||||
require_once(__DIR__ . '/../random/settings_form.php'); // parent form
|
||||
|
||||
/**
|
||||
* Allocator settings form
|
||||
|
||||
Reference in New Issue
Block a user