From 662e34291a2d5d8997ea9835701fb9a8a7ec244c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 28 Jan 2013 21:19:13 +0200 Subject: Some micro-optimization to the Driver library loader --- system/libraries/Driver.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 4b35dce73..382420db0 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -80,8 +80,7 @@ class CI_Driver_Library { public function load_driver($child) { // Get CodeIgniter instance and subclass prefix - $CI = get_instance(); - $prefix = (string) $CI->config->item('subclass_prefix'); + $prefix = config_item('subclass_prefix'); if ( ! isset($this->lib_name)) { @@ -102,11 +101,12 @@ class CI_Driver_Library { } // Get package paths and filename case variations to search + $CI = get_instance(); $paths = $CI->load->get_package_paths(TRUE); // Is there an extension? $class_name = $prefix.$child_name; - $found = class_exists($class_name); + $found = class_exists($class_name, FALSE); if ( ! $found) { // Check for subclass file @@ -126,8 +126,8 @@ class CI_Driver_Library { } // Include both sources and mark found - include($basepath); - include($file); + include_once($basepath); + include_once($file); $found = TRUE; break; } @@ -139,8 +139,7 @@ class CI_Driver_Library { { // Use standard class name $class_name = 'CI_'.$child_name; - $found = class_exists($class_name); - if ( ! $found) + if ( ! class_exists($class_name, FALSE)) { // Check package paths foreach ($paths as $path) @@ -150,7 +149,7 @@ class CI_Driver_Library { if (file_exists($file)) { // Include source - include($file); + include_once($file); break; } } @@ -158,9 +157,9 @@ class CI_Driver_Library { } // Did we finally find the class? - if ( ! class_exists($class_name)) + if ( ! class_exists($class_name, FALSE)) { - if (class_exists($child_name)) + if (class_exists($child_name, FALSE)) { $class_name = $child_name; } -- cgit v1.2.3-24-g4f1b