[ingo] Using multiple servers with different backends

Davide Bianchi davide.bianchi at diala.greenpeace.org
Fri Mar 17 06:09:03 PST 2006


We have the problem of having multiple servers (about an hundreds) with
different backends: some servers are using Sieve, some others have
vanilla procmail scripts. The problem seems that Ingo does not support
multiple backends, even when configured to use more than one the
comparison done when the backend is loaded is done agains the name of
the HTTP server and not of the server that is selected by the user.

I've modified the php script to load the correct backend depending on
the server selected.

Patch file:

<BEGIN PATCH FILE>
*** Ingo.php	Mon Feb 20 22:03:19 2006
--- /var/www/htdocs/horde/ingo/lib/Ingo.php	Fri Mar 17 14:20:16 2006
***************
*** 210,233 ****
              Horde::fatal(PEAR::raiseError(_("No backends configured in
backends.php")), __FILE__, __LINE__);
          }

          foreach ($backends as $temp) {
              if (!isset($backend)) {
                  $backend = $temp;
              } elseif (!empty($temp['preferred'])) {
                  if (is_array($temp['preferred'])) {
                      foreach ($temp['preferred'] as $val) {
!                         if (($val == $_SERVER['SERVER_NAME']) ||
!                             ($val == $_SERVER['HTTP_HOST'])) {
                              $backend = $temp;
                          }
                      }
!                 } elseif (($temp['preferred'] ==
$_SERVER['SERVER_NAME']) ||
!                           ($temp['preferred'] == $_SERVER['HTTP_HOST'])) {
                      $backend = $temp;
                  }
              }
          }

          /* Check for valid backend configuration. */
          if (!isset($backend)) {
              Horde::fatal(PEAR::raiseError(_("No backend configured for
this host")), __FILE__, __LINE__);
--- 210,239 ----
              Horde::fatal(PEAR::raiseError(_("No backends configured in
backends.php")), __FILE__, __LINE__);
          }

+
          foreach ($backends as $temp) {
+
              if (!isset($backend)) {
                  $backend = $temp;
              } elseif (!empty($temp['preferred'])) {
                  if (is_array($temp['preferred'])) {
                      foreach ($temp['preferred'] as $val) {
!                         if (($val == $_SESSION['imp']['server']) ||
!                             ($val == $_SERVER['SERVER_NAME'])) {
                              $backend = $temp;
                          }
                      }
!                 } elseif (($temp['preferred'] ==
$_SESSION['imp']['server']) ||
!                           ($temp['preferred'] ==
$_SERVER['SERVER_NAME'])) {
                      $backend = $temp;
                  }
              }
          }

+         Horde::logMessage(
+ 			"Loading backend " . $backend['driver'],
+ 			__FILE__, __LINE__, PEAR_LOG_NOTICE);
+
          /* Check for valid backend configuration. */
          if (!isset($backend)) {
              Horde::fatal(PEAR::raiseError(_("No backend configured for
this host")), __FILE__, __LINE__);
<END PATCH FILE>

Davide


-- 
========================
Davide Bianchi
Greenpeace International
Amsterdam, Holland
Phone: +31- 20 718 21 31
========================
PGP Sign: 52A6 1964 E234
9165 81E5 5CCC 9331 9C71
0434 2E21
========================


More information about the ingo mailing list