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:
Russell Smith
2016-06-10 08:06:49 +10:00
parent 4ee8ef5d41
commit 1fcf0ca8a5
352 changed files with 499 additions and 499 deletions
+2 -2
View File
@@ -1005,7 +1005,7 @@ function print_badge_image(badge $badge, stdClass $context, $size = 'small') {
*/
function badges_bake($hash, $badgeid, $userid = 0, $pathhash = false) {
global $CFG, $USER;
require_once(dirname(dirname(__FILE__)) . '/badges/lib/bakerlib.php');
require_once(__DIR__ . '/../badges/lib/bakerlib.php');
$badge = new badge($badgeid);
$badge_context = $badge->get_context();
@@ -1066,7 +1066,7 @@ function badges_bake($hash, $badgeid, $userid = 0, $pathhash = false) {
*/
function get_backpack_settings($userid, $refresh = false) {
global $DB;
require_once(dirname(dirname(__FILE__)) . '/badges/lib/backpacklib.php');
require_once(__DIR__ . '/../badges/lib/backpacklib.php');
// Try to get badges from cache first.
$badgescache = cache::make('core', 'externalbadges');