From 9a311fd3c45faadb7081a48b068f07c0f44b9e5e Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 15 Dec 2010 10:50:15 +0000 Subject: Package paths can now be auto-loaded in autoload.php. --- application/config/autoload.php | 25 +++++++++++++++++++------ system/core/Loader.php | 9 +++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/application/config/autoload.php b/application/config/autoload.php index 5e9740844..90b1a808f 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -18,14 +18,28 @@ | | These are the things you can load automatically: | -| 1. Libraries -| 2. Helper files -| 3. Custom config files -| 4. Language files -| 5. Models +| 1. Packages +| 2. Libraries +| 3. Helper files +| 4. Custom config files +| 5. Language files +| 6. Models | */ +/* +| ------------------------------------------------------------------- +| Auto-load Packges +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared'); +| +*/ + +$autoload['packages'] = array(APPPATH.'third_party'); + + /* | ------------------------------------------------------------------- | Auto-load Libraries @@ -98,6 +112,5 @@ $autoload['language'] = array(); $autoload['model'] = array(); - /* End of file autoload.php */ /* Location: ./application/config/autoload.php */ \ No newline at end of file diff --git a/system/core/Loader.php b/system/core/Loader.php index 4b6b19eea..afbae6175 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -942,6 +942,15 @@ class CI_Loader { return FALSE; } + // Autoload packages + if (isset($autoload['packages'])) + { + foreach ($autoload['packages'] as $package_path) + { + $this->add_package_path($package_path); + } + } + // Load any custom config file if (count($autoload['config']) > 0) { -- cgit v1.2.3-24-g4f1b