Exemplo n.º 1
0
 /**
  * Function to be executed in script shutdown
  * Registered with register_shutdown_function()
  */
 public function shutdown()
 {
     if (is_object($this->imap)) {
         $this->imap->close();
     }
     if (is_object($this->smtp)) {
         $this->smtp->disconnect();
     }
     if (is_object($this->contacts)) {
         $this->contacts->close();
     }
     // before closing the database connection, write session data
     if ($_SERVER['REMOTE_ADDR']) {
         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}]" : '');
         rcube_print_time(RCMAIL_START, $log);
     }
 }
Exemplo n.º 2
0
 /**
  * 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->imap)) {
         $this->imap->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);
         }
     }
 }