/** * 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); } if (is_object($this->smtp)) { $this->smtp->disconnect(); } foreach ($this->address_books as $book) { if (is_object($book) && is_a($book, 'rcube_addressbook')) { $book->close(); } } foreach ($this->caches as $cache) { if (is_object($cache)) { $cache->close(); } } if (is_object($this->storage)) { if ($this->expunge_cache) { $this->storage->expunge_cache(); } $this->storage->close(); } // before closing the database connection, write session data if ($_SERVER['REMOTE_ADDR'] && is_object($this->session)) { session_write_close(); } // write performance stats to logs/console if ($this->config->get('devel_mode')) { if (function_exists('memory_get_usage')) { $mem = show_bytes(memory_get_usage()); } if (function_exists('memory_get_peak_usage')) { $mem .= '/' . show_bytes(memory_get_peak_usage()); } $log = $this->task . ($this->action ? '/' . $this->action : '') . ($mem ? " [{$mem}]" : ''); if (defined('RCMAIL_START')) { rcube_print_time(RCMAIL_START, $log); } else { console($log); } } }
/** * 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); } if (is_object($this->smtp)) { $this->smtp->disconnect(); } foreach ($this->caches as $cache) { if (is_object($cache)) { $cache->close(); } } if (is_object($this->storage)) { if ($this->expunge_cache) { $this->storage->expunge_cache(); } $this->storage->close(); } }