public static function cache($save = FALSE, $append = FALSE)
{
if ( ! Route::cache())
{
Route::set('admin', 'admin')
->defaults(array(
'directory' => 'admin',
'controller' => 'main',
'action' => 'index',
));
Route::set('admin_categories', 'admin/categories/(<action>(/<category_id>))',
array(
'action' => 'view|add',
'category_id' => '\d+')
)
->defaults(array(
'directory' => 'admin',
'controller' => 'category',
'action' => 'view'
));
Route::set('admin_articles', 'admin/articles/(<action>(/<category_id>(/<article_id>)))',
array(
'action' => 'view|add',
'category_id' => '\d+',
'article_id' => '\d+')
)
->defaults(array(
'directory' => 'admin',
'controller' => 'article',
'action' => 'view'
));
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'main',
'action' => 'index',
));
// Cache the routes in production
Route::cache(Kohana::$environment === Kohana::PRODUCTION);
}
if ($save === TRUE)
{
try
{
// Cache all defined routes
Kohana::cache('Route::cache()', Route::$_routes);
}
catch (Exception $e)
{
// We most likely have a lambda in a route, which cannot be cached
throw new Kohana_Exception('One or more routes could not be cached (:message)', array(
':message' => $e->getMessage(),
), 0, $e);
}
}
else
{
if ($routes = Kohana::cache('Route::cache()'))
{
if ($append)
{
// Append cached routes
Route::$_routes += $routes;
}
else
{
// Replace existing routes
Route::$_routes = $routes;
}
// Routes were cached
return Route::$cache = TRUE;
}
else
{
// Routes were not cached
return Route::$cache = FALSE;
}
}
}
вот мой обновленный метод. Но ошибка на хостинге не проходит.