Upstream Patch: Enable SYSMODS to hold upstream modules

This commit is contained in:
Deon George 2010-08-21 15:18:16 +10:00
parent d2fc6d4d47
commit 6fb7d0035a
3 changed files with 33 additions and 12 deletions

View File

@ -67,16 +67,16 @@ Kohana::$config->attach(new Kohana_Config_File);
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
// 'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
// 'database' => MODPATH.'database', // Database access
// 'image' => MODPATH.'image', // Image manipulation
// 'orm' => MODPATH.'orm', // Object Relationship Mapping
// 'oauth' => MODPATH.'oauth', // OAuth authentication
// 'pagination' => MODPATH.'pagination', // Paging of results
// 'unittest' => MODPATH.'unittest', // Unit testing
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
// 'auth' => SMDPATH.'auth', // Basic authentication
// 'cache' => SMDPATH.'cache', // Caching with multiple backends
// 'codebench' => SMDPATH.'codebench', // Benchmarking tool
// 'database' => SMDPATH.'database', // Database access
// 'image' => SMDPATH.'image', // Image manipulation
// 'orm' => SMDPATH.'orm', // Object Relationship Mapping
// 'oauth' => SMDPATH.'oauth', // OAuth authentication
// 'pagination' => SMDPATH.'pagination', // Paging of results
// 'unittest' => SMDPATH.'unittest', // Unit testing
// 'userguide' => SMDPATH.'userguide', // User guide and API documentation
));
/**

View File

@ -570,6 +570,13 @@ class Kohana_Core {
}
// Add the module to include paths
$paths[] = realpath(MODPATH.$path).DIRECTORY_SEPARATOR;
// Add our system modules path
}
if (is_dir(SMDPATH.$path))
{
// Add the module to include paths
$paths[] = realpath(SMDPATH.$path).DIRECTORY_SEPARATOR;
}
}
@ -1383,11 +1390,15 @@ class Kohana_Core {
{
$file = 'SYSPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(SYSPATH));
}
elseif (strpos($file, SMDPATH) === 0)
{
$file = 'SMDPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(SMDPATH));
}
elseif (strpos($file, MODPATH) === 0)
{
$file = 'MODPATH'.DIRECTORY_SEPARATOR.substr($file, strlen(MODPATH));
}
elseif (strpos($file, OVERPATH) === 0)
elseif (OVERPATH AND strpos($file, OVERPATH) === 0)
{
$file = 'OVERPATH/'.substr($file, strlen(OVERPATH));
}

12
kh.php
View File

@ -15,6 +15,11 @@ $application = 'application';
*/
$modules = 'modules';
/**
* The directory in which upstream Kohana resources (modules) are located.
*/
$sysmodules = 'includes/kohana/modules';
/**
* The directory in which the Kohana resources are located. The system
* directory must contain the classes/kohana.php file.
@ -70,6 +75,10 @@ if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules;
// Make the system relative to the docroot
if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
$sysmodules = DOCROOT.$sysmodules;
// Make the system relative to the docroot
if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
$system = DOCROOT.$system;
@ -81,6 +90,7 @@ if ( ! is_dir($override) AND is_dir(DOCROOT.$override))
// Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
if (is_dir(realpath($override)))
@ -89,7 +99,7 @@ else
define('OVERPATH', '');
// Clean up the configuration vars
unset($application, $modules, $system, $override);
unset($application, $modules, $sysmodules, $system, $override);
if (file_exists('install'.EXT))
{