From: Michael M Slusarz Date: Thu, 30 Sep 2010 20:50:06 +0000 (-0600) Subject: Ticket #7422: Improve session close/open in DIMP AJAX actions X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=22f33b1be19a3b3db62911f7b4ae4a93384ad135;p=horde.git Ticket #7422: Improve session close/open in DIMP AJAX actions --- diff --git a/imp/lib/Ajax/Application.php b/imp/lib/Ajax/Application.php index 073a46309..5738c3cc0 100644 --- a/imp/lib/Ajax/Application.php +++ b/imp/lib/Ajax/Application.php @@ -282,6 +282,12 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application public function listMailboxes() { $imptree = $GLOBALS['injector']->getInstance('IMP_Imap_Tree'); + + /* This might be a long running operation. */ + if ($vars->initial) { + session_write_close(); + } + $initreload = ($this->_vars->initial || $this->_vars->reload); $result = new stdClass; @@ -355,6 +361,10 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application $result->quota = $quota; } + if ($vars->initial) { + session_start(); + } + return $result; } @@ -580,8 +590,16 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application } elseif ($changed || $this->_vars->rangeslice || !$this->_vars->checkcache) { + /* Ticket #7422: Listing messages may be a long-running operation, + * so close the session while we are doing it to prevent + * deadlocks. */ + session_write_close(); + $result = new stdClass; $result->ViewPort = $this->_viewPortData($changed); + + /* Reopen the session. */ + session_start(); } else { $result = false; } @@ -1935,10 +1953,6 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application */ protected function _viewPortData($change) { - // Ticket #7422: Listing messages may be a long-running operation, - // so close the session while we are doing it to prevent deadlocks. - session_write_close(); - $args = array( 'applyfilter' => $this->_vars->applyfilter, 'cache' => $this->_vars->cache, @@ -1979,12 +1993,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application } $list_msg = new IMP_Views_ListMessages(); - $msgs = $list_msg->listMessages($args); - - // Reopen the session. - session_start(); - - return $msgs; + return $list_msg->listMessages($args); } /**