Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Twig in degraded mode if cache is not available. #13227

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -11,6 +11,7 @@ phpMyAdmin - ChangeLog
- issue #13119 No database selected error when adding foreign key
- issue #12388 Improved database search to allow search for exact phrase match
- issue #13099 Report error when trying to copy database to same name
- issue #13225 Run Twig in degraded mode if cache is not available

4.7.1 (not yet released)
- issue #13132 Always execute tracking queries as controluser
Expand Down
3 changes: 2 additions & 1 deletion libraries/Template.php
Expand Up @@ -58,9 +58,10 @@ protected function __construct($name, $data = array(), $helperFunctions = array(
$this->helperFunctions = $helperFunctions;

$loader = new Twig_Loader_Filesystem(static::BASE_PATH);
$cache_dir = CACHE_DIR . 'twig';
$this->twig = new Twig_Environment($loader, array(
'auto_reload' => true,
'cache' => CACHE_DIR . 'twig',
'cache' => is_writable($cache_dir) ? $cache_dir : false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail if the directory does not exist (what it always true on first run). It's probably better to try to create the dir if it does not exist (Twig would try to create it).

'debug' => false,
));
$this->twig->addExtension(new I18nExtension());
Expand Down