Projects
Kolab:16:Testing
roundcubemail-selfcontained
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 78
View file
migrateconfig.sh
Changed
@@ -20,13 +20,13 @@ return; } - if (preg_match("~\\\$config\\'default_host'\\ = '(^'+)'~", $line, $matches)) { + if (preg_match("~\\\$config\\'default_host'\\\s*=\s*'\"?(^'\";*)'\"?~", $line, $matches)) { $imap_host = $matches1; - } elseif (preg_match("~\\\$config\\'default_port'\\ = '?(0-9+)'?~", $line, $matches)) { + } elseif (preg_match("~\\\$config\\'default_port'\\\s*=\s*'\"?(^'\";*)'\"?~", $line, $matches)) { $imap_port = trim($matches1, "'"); - } elseif (preg_match("~\\\$config\\'smtp_server'\\ = '(^'+)'~", $line, $matches)) { + } elseif (preg_match("~\\\$config\\'smtp_server'\\\s*=\s*'\"?(^'\";*)'\"?~", $line, $matches)) { $smtp_host = $matches1; - } elseif (preg_match("~\\\$config\\'smtp_port'\\ = '?(0-9+)'?~", $line, $matches)) { + } elseif (preg_match("~\\\$config\\'smtp_port'\\\s*=\s*'\"?(^'\";*)'\"?~", $line, $matches)) { $smtp_port = trim($matches1, "'"); } } @@ -38,10 +38,6 @@ if (strpos($imap_host, '://') === false) { switch ($imap_port) { - case 143: - case 9143: - $imap_host = 'tls://' . $imap_host; - break; case 993: case 9993: $imap_host = 'ssl://' . $imap_host; @@ -70,30 +66,6 @@ // TODO: removed `port` option from `ldap_public` array (non-standard port can be set via `host`) // TODO: removed `use_tls` option from `ldap_public` array (use tls:// prefix in `host`) -// For Kolab v4 we can just replace strings as we have a "constant" content -$replace = - "\$config'default_host' = (getenv('IMAP_TLS') == \"true\" ? \"ssl://\" : \"\") . getenv('IMAP_HOST');" - => "\$config'imap_host' = (getenv('IMAP_TLS') == \"true\" ? \"ssl://\" : \"\") . getenv('IMAP_HOST') . ':' . getenv('IMAP_PORT');", - "\$config'default_port' = getenv('IMAP_PORT');" => '', - "\$config'smtp_server' = \"tls://\" . getenv('SUBMISSION_HOST');" - => "\$config'smtp_host' = \"tls://\" . getenv('SUBMISSION_HOST') . ':' . getenv('SUBMISSION_PORT');", - "\$config'smtp_server' = getenv('SUBMISSION_HOST');" - => "\$config'smtp_host' = getenv('SUBMISSION_HOST') . ':' . getenv('SUBMISSION_PORT');", - "\$config'smtp_port' = getenv('SUBMISSION_PORT');" => '', -; - -$content = ''; -foreach (file("{$home}/config.inc.php") as $line) { - $line = str_replace(array_keys($replace), array_values($replace), $line); - if ($imap_host && strpos($line, "\$config'default_host'") !== false) { - $content .= "\$config'imap_host' = '{$imap_host}';\n"; - } elseif ($smtp_host && strpos($line, "\$config'smtp_server'") !== false) { - $content .= "\$config'smtp_host' = '{$smtp_host}';\n"; - } elseif (!preg_match("~\\\$config\\'(default_port|smtp_port)'\\~", $line)) { - $content .= $line; - } -} - file_put_contents("{$home}/config.inc.php", $content); // managesieve_usetls/managesieve_port @@ -101,11 +73,11 @@ $sieve_host = null; foreach (file("{$home}/managesieve.inc.php") as $line) { - if (preg_match("~\\\$config\\'managesieve_host'\\ = '(^'+)'~", $line, $matches)) { + if (preg_match("~\\\$config\\'managesieve_host'\\\s*=\s*'\"?(^'\";*)'\"?~", $line, $matches)) { $sieve_host = $matches1; - } elseif (preg_match("~\\\$config\\'managesieve_port'\\ = '?(0-9+)'?~", $line, $matches)) { + } elseif (preg_match("~\\\$config\\'managesieve_port'\\\s*=\s*'\"?(^'\";*)'\"?~", $line, $matches)) { $sieve_port = trim($matches1, "'"); - } elseif (preg_match("~\\\$config\\'managesieve_usetls'\\ = true~", $line, $matches)) { + } elseif (preg_match("~\\\$config\\'managesieve_usetls'\\\s*=\s*true~", $line, $matches)) { $sieve_tls = true; } }
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.