diff --git a/application/bootstrap.php b/application/bootstrap.php index 280c1f1..e88b82f 100644 --- a/application/bootstrap.php +++ b/application/bootstrap.php @@ -82,7 +82,8 @@ if (isset($_SERVER['KOHANA_ENV'])) Kohana::init(array( 'base_url' => '/pta', 'index_file' => '', - 'caching' => TRUE, + 'caching' => TRUE, + 'cache_dir' => '/dev/shm/lnapp', )); /** diff --git a/application/classes/controller/lnapp/templatedefault.php b/application/classes/controller/lnapp/templatedefault.php index 6a77a43..83620d1 100644 --- a/application/classes/controller/lnapp/templatedefault.php +++ b/application/classes/controller/lnapp/templatedefault.php @@ -193,6 +193,9 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { } parent::after(); + + // Generate and check the ETag for this file + $this->response->check_cache(NULL,$this->request); } /** @@ -240,9 +243,6 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { * @return void */ final public function action_media() { - // Generate and check the ETag for this file - $this->response->check_cache(NULL,$this->request); - // Get the file path from the request $file = $this->request->param('file'); @@ -272,6 +272,9 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { $this->response->status(404); } + // Generate and check the ETag for this file + $this->response->check_cache(NULL,$this->request); + // Set the proper headers to allow caching $this->response->headers('Content-Type',File::mime_by_ext($ext)); $this->response->headers('Content-Length',(string)$this->response->content_length()); diff --git a/application/classes/controller/node.php b/application/classes/controller/node.php index e060f2f..8057ec1 100644 --- a/application/classes/controller/node.php +++ b/application/classes/controller/node.php @@ -18,7 +18,7 @@ class Controller_NODE extends Controller_TemplateDefault { $no = ORM::factory('node'); $output = ''; - $output .= sprintf(_('This server has %s defined nodes.'),$no->count_all()); + $output .= sprintf(_('This server has %s defined nodes.'),$no->cached(0)->count_all()); $output .= '
'; $output .= '
'; diff --git a/application/config/cache.php b/application/config/cache.php index fd40ebe..62ec8f0 100644 --- a/application/config/cache.php +++ b/application/config/cache.php @@ -16,7 +16,7 @@ return array 'file' => array ( 'driver' => 'file', - 'cache_dir' => '/dev/shm/lnapp', + 'cache_dir' => Kohana::$cache_dir ? Kohana::$cache_dir : '/dev/shm/lnapp', 'default_expire' => 3600, ) );