From 9145a040396e901eda3fa154dcfaaa66004e568c Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sun, 17 May 2015 18:54:38 +0200 Subject: [PATCH] Fixed Zend OpCache related issues in extension modules installer. --- admin/db/maintenance_db.inc | 3 +++ admin/inst_theme.php | 8 +++----- includes/main.inc | 1 + includes/session.inc | 12 +++++++++++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/admin/db/maintenance_db.inc b/admin/db/maintenance_db.inc index ad3a3278..5c81bcc6 100644 --- a/admin/db/maintenance_db.inc +++ b/admin/db/maintenance_db.inc @@ -105,6 +105,7 @@ function write_config_db($new = false) } // Close file fclose($zp); + cache_invalidate($filename); } } else @@ -164,6 +165,7 @@ function write_extensions($extensions=null, $company = -1) } // Close file fclose($zp); + cache_invalidate($filename); } return true; } @@ -243,6 +245,7 @@ function write_lang() } // Close file fclose($zp); + cache_invalidate($filename); } } else diff --git a/admin/inst_theme.php b/admin/inst_theme.php index 0d1987d5..a2f26006 100644 --- a/admin/inst_theme.php +++ b/admin/inst_theme.php @@ -12,18 +12,16 @@ $page_security = 'SA_CREATEMODULES'; $path_to_root=".."; include_once($path_to_root . "/includes/session.inc"); + include_once($path_to_root."/includes/packages.inc"); +include_once($path_to_root . "/admin/db/maintenance_db.inc"); +include_once($path_to_root . "/includes/ui.inc"); if ($SysPrefs->use_popup_windows) { $js = get_js_open_window(900, 500); } page(_($help_context = "Install Themes"), false, false, '', $js); -include_once($path_to_root . "/includes/date_functions.inc"); -include_once($path_to_root . "/admin/db/company_db.inc"); -include_once($path_to_root . "/admin/db/maintenance_db.inc"); -include_once($path_to_root . "/includes/ui.inc"); - //--------------------------------------------------------------------------------------------- if (($id = find_submit('Delete', false)) && isset($installed_extensions[$id]) diff --git a/includes/main.inc b/includes/main.inc index 38ceaa1d..d6a34531 100644 --- a/includes/main.inc +++ b/includes/main.inc @@ -403,3 +403,4 @@ if (!function_exists('array_fill_keys')) // since 5.2 return array_combine($keys, array_fill(count($keys), $value)); } } + diff --git a/includes/session.inc b/includes/session.inc index e8b4b143..e2a7fca2 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -184,6 +184,16 @@ function check_faillog() return false; } + +/* + Ensure file is re-read on next request if php caching is active +*/ +function cache_invalidate($filename) +{ + if (function_exists('opcache_invalidate')) // OpCode extension + opcache_invalidate($filename); +} + /* Simple brute force attack detection is performed before connection to company database is open. Therefore access counters have to be stored in file. Login attempts counter is created for every new user IP, which partialy prevent DOS attacks. @@ -222,6 +232,7 @@ function write_login_filelog($login, $result) if ((!file_exists($filename) && is_writable($path_to_root.'/tmp')) || is_writable($filename)) { file_put_contents($filename, $msg); + cache_invalidate($filename); } } @@ -408,7 +419,6 @@ if ($SysPrefs->error_logfile != '') { ini_set("log_errors", "On"); } - /* Uncomment the setting below when using FA on shared hosting to avoid unexpeced session timeouts. -- 2.30.2