Fixed Zend OpCache related issues in extension modules installer.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 17 May 2015 16:54:38 +0000 (18:54 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 17 May 2015 16:57:03 +0000 (18:57 +0200)
admin/db/maintenance_db.inc
admin/inst_theme.php
includes/main.inc
includes/session.inc

index ad3a32782a2d0fe5ea6232698abe4cbc00dcfc04..5c81bcc694e9af867a125ee33b20eb5f4d07e506 100644 (file)
@@ -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
index 0d1987d5f8358c3f5d847fbdef459d138e882511..a2f260064f105d043c93669493deae743c4ba297 100644 (file)
 $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])
index 38ceaa1df9730e4c5ba5b5200b2893e10cf36035..d6a3453118731fe25034152e010727be21df1937 100644 (file)
@@ -403,3 +403,4 @@ if (!function_exists('array_fill_keys')) // since 5.2
                return array_combine($keys, array_fill(count($keys), $value));
        }
 }
+
index e8b4b1437259e9a210cb06ec7b243b0590df683e..e2a7fca2f2e65f1bcb11684265e942697bb22e33 100644 (file)
@@ -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.