summaryrefslogtreecommitdiff
path: root/kohana/core/Kohana.php
diff options
context:
space:
mode:
Diffstat (limited to 'kohana/core/Kohana.php')
-rw-r--r--kohana/core/Kohana.php32
1 files changed, 21 insertions, 11 deletions
diff --git a/kohana/core/Kohana.php b/kohana/core/Kohana.php
index 7f9b87da..0ee6f631 100644
--- a/kohana/core/Kohana.php
+++ b/kohana/core/Kohana.php
@@ -53,6 +53,7 @@ final class Kohana {
// Internal caches and write status
private static $internal_cache = array();
private static $write_cache;
+ private static $internal_cache_path;
/**
* Sets up the PHP environment. Adds error/exception handling, output
@@ -90,6 +91,12 @@ final class Kohana {
if (self::$cache_lifetime = self::config('core.internal_cache'))
{
+ // Set the directory to be used for the internal cache
+ if ( ! self::$internal_cache_path = self::config('core.internal_cache_path'))
+ {
+ self::$internal_cache_path = APPPATH.'cache/';
+ }
+
// Load cached configuration and language files
self::$internal_cache['configuration'] = self::cache('configuration', self::$cache_lifetime);
self::$internal_cache['language'] = self::cache('language', self::$cache_lifetime);
@@ -570,7 +577,7 @@ final class Kohana {
{
if ($lifetime > 0)
{
- $path = APPPATH.'cache/kohana_'.$name;
+ $path = self::$internal_cache_path.'kohana_'.$name;
if (is_file($path))
{
@@ -606,7 +613,7 @@ final class Kohana {
if ($lifetime < 1)
return FALSE;
- $path = APPPATH.'cache/kohana_'.$name;
+ $path = self::$internal_cache_path.'kohana_'.$name;
if ($data === NULL)
{
@@ -1139,18 +1146,21 @@ final class Kohana {
{
$items = (array) glob($path.'*');
- foreach ($items as $index => $item)
+ if ( ! empty($items))
{
- $files[] = $item = str_replace('\\', '/', $item);
-
- // Handle recursion
- if (is_dir($item) AND $recursive == TRUE)
+ foreach ($items as $index => $item)
{
- // Filename should only be the basename
- $item = pathinfo($item, PATHINFO_BASENAME);
+ $files[] = $item = str_replace('\\', '/', $item);
- // Append sub-directory search
- $files = array_merge($files, self::list_files($directory, TRUE, $path.$item));
+ // Handle recursion
+ if (is_dir($item) AND $recursive == TRUE)
+ {
+ // Filename should only be the basename
+ $item = pathinfo($item, PATHINFO_BASENAME);
+
+ // Append sub-directory search
+ $files = array_merge($files, self::list_files($directory, TRUE, $path.$item));
+ }
}
}
}