Fixed Apache working directory bug by applying the working directory at shutdown

This commit is contained in:
Abel Hoogeveen 2016-01-15 13:45:13 +01:00
parent ba9cfce1a9
commit c5eae9823c
1 changed files with 19 additions and 0 deletions

View File

@ -53,6 +53,14 @@ class Core {
*/
private static $loaded = false;
/**
* Working directory of the Framework
*
* This is required to make the shutdown function working under Apache webservers
* @var String $cwd
*/
public static $cwd;
/**
* Initializes the core
*
@ -94,6 +102,9 @@ class Core {
if ($event->isCancelled()) {
return true;
}
// Set the CWD for usage in the shutdown function+
self::$cwd = getcwd();
}
/**
@ -136,9 +147,17 @@ class Core {
* Stop FuzeWorks and run all shutdown functions.
*
* Afterwards run the Logger shutdown function in order to possibly display the log
* @access public
* @return void
*/
public static function shutdown() {
// Fix Apache bug where CWD is changed upon shutdown
chdir(self::$cwd);
// Fire the Shutdown event
Events::fireEvent('coreShutdownEvent');
// And end the logger
Logger::shutdown();
}