Overview
Comment: | Improve handling of cases where URI or HOST cannot be found |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
2dd6d2e7cef3064961a80f0e6e9ba78c |
User & Date: | bohwaz on 2020-11-11 19:08:09 |
Other Links: | branch diff | manifest | tags |
Context
2020-11-11
| ||
19:08 | Implement sending of reminders check-in: a77f4d0ca3 user: bohwaz tags: dev | |
19:08 | Improve handling of cases where URI or HOST cannot be found check-in: 2dd6d2e7ce user: bohwaz tags: dev | |
17:01 | Implement file removal from accounting check-in: 0e3b549c27 user: bohwaz tags: dev | |
Changes
Modified src/include/init.php from [2803d7a09e] to [9ac1ae130d].
︙ | ︙ | |||
95 96 97 98 99 100 101 | if (!defined('Garradin\WWW_URI')) { try { $uri = \KD2\HTTP::getRootURI(ROOT); } catch (\UnexpectedValueException $e) { | < < | | | > > | > > > > > > > > > > > > > > > > | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | if (!defined('Garradin\WWW_URI')) { try { $uri = \KD2\HTTP::getRootURI(ROOT); } catch (\UnexpectedValueException $e) { $uri = null; } if ($uri == '/www/') { $uri = '/'; } elseif ($uri !== null) { readfile(ROOT . '/sous-domaine.html'); exit; } define('Garradin\WWW_URI', $uri); unset($uri); } if (!defined('Garradin\WWW_URL')) { $host = \KD2\HTTP::getHost(); } if (WWW_URI === null || (!empty($host) && $host == 'host.unknown')) { $title = 'Impossible de détecter automatiquement l\'URL du site web.'; $info = 'Consulter l\'aide pour configurer manuellement l\'URL avec la directive WWW_URL et WWW_URI.'; $url ='https://fossil.kd2.org/garradin/wiki?name=Installation'; if (PHP_SAPI == 'cli') { printf("\n/!\\ %s\n%s\n-> %s\n\n", $title, $info, $url); } else { printf('<h2 style="color: red">%s</h2><p><a href="%s">%s</a></p>', $title, $url, $info); } exit(1); } if (!defined('Garradin\WWW_URL')) { define('Garradin\WWW_URL', \KD2\HTTP::getScheme() . '://' . $host . WWW_URI); } static $default_config = [ 'CACHE_ROOT' => DATA_ROOT . '/cache', 'DB_FILE' => DATA_ROOT . '/association.sqlite', 'DB_SCHEMA' => ROOT . '/include/data/schema.sql', 'PLUGINS_ROOT' => DATA_ROOT . '/plugins', |
︙ | ︙ |