/** * Function to be executed in script shutdown * Registered with register_shutdown_function() */ public function shutdown() { foreach ($this->shutdown_functions as $function) { call_user_func($function); } // write session data as soon as possible and before // closing database connection, don't do this before // registered shutdown functions, they may need the session // Note: this will run registered gc handlers (ie. cache gc) if ($_SERVER['REMOTE_ADDR'] && is_object($this->session)) { $this->session->write_close(); } if (is_object($this->smtp)) { $this->smtp->disconnect(); } foreach ($this->caches as $cache) { if (is_object($cache)) { $cache->close(); } } if (is_object($this->storage)) { $this->storage->close(); } if ($this->config->get('log_driver') == 'syslog') { closelog(); } }
/** * Wrapper for session_write_close() */ public function write_close() { $_SESSION['__IP'] = $this->ip; $_SESSION['__MTIME'] = time(); parent::write_close(); }