Overview
Comment: | Update installer |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
96935a0512a50c45004c3f6964445a80 |
User & Date: | bohwaz on 2021-11-24 00:00:19 |
Other Links: | manifest | tags |
Context
2021-11-24
| ||
13:01 | Add a target "all users except ones in a hidden category" to mass mailing check-in: c66a74f59a user: bohwaz tags: trunk, stable | |
00:10 | Merge with trunk check-in: d28abcc7f9 user: bohwaz tags: emails | |
00:00 | Update installer check-in: 96935a0512 user: bohwaz tags: trunk | |
2021-11-23
| ||
23:41 | Make sure the value is iterable check-in: efca0d5bfa user: bohwaz tags: trunk, stable | |
Changes
Modified tools/make_installer.php from [dfcbeea0b6] to [e16af43e44].
1 2 | <?php | | > | | | > > < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > > | | | > > > > > > > > > > > | | | | > > > | | | | | | | | | | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | <?php $includes = [ '##KD2' => [ __DIR__ . '/../src/include/lib/KD2/Security.php', __DIR__ . '/../src/include/lib/KD2/HTTP.php', __DIR__ . '/../src/include/lib/KD2/FossilInstaller.php', ], ]; $template = <<<'EOF' <?php // Copier ce fichier dans un nouveau répertoire vide // Et s'y rendre avec un navigateur web :-) namespace KD2 { ##KD2 } namespace { const WEBSITE = 'https://fossil.kd2.org/garradin/'; const INSTALL_DIR = __DIR__ . '/.install'; echo ' <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <style type="text/css"> body { font-family: sans-serif; } h2, p { margin: 0; margin-bottom: 1rem; } div { position: relative; border: 1px solid #999; max-width: 500px; padding: 1em; border-radius: .5em; } .spinner h2::after { display: block; content: " "; margin: 1rem auto; width: 50px; height: 50px; border: 5px solid #000; border-radius: 50%; border-top-color: #999; animation: spin 1s ease-in-out infinite; } @keyframes spin { to { transform: rotate(360deg); } } </style>'; function exception_error_handler($severity, $message, $file, $line) { if (!(error_reporting() & $severity)) { return; } throw new ErrorException($message, 0, $severity, $file, $line); } function mini_exception_handler($e) { printf(' <div style="padding: 1rem; background: #fee; border: 2px solid darkred;"><h2>%s</h2> <h3>in %s:%d</h3> <pre>%s</pre> </div>', $e->getMessage(), $e->getFile(), $e->getLine(), (string) $e); } set_error_handler("exception_error_handler"); set_exception_handler('mini_exception_handler'); if (!version_compare(phpversion(), '7.4', '>=')) { throw new \Exception('PHP 7.4 ou supérieur requis. PHP version ' . phpversion() . ' installée.'); } if (!class_exists('SQLite3')) { throw new \Exception('Le module de base de données SQLite3 n\'est pas disponible.'); } $v = \SQLite3::version(); if (!version_compare($v['versionString'], '3.16', '>=')) { throw new \Exception('SQLite3 version 3.16 ou supérieur requise. Version installée : ' . $v['versionString']); } $step = $_GET['step'] ?? null; @mkdir(INSTALL_DIR); $i = new KD2\FossilInstaller(WEBSITE, __DIR__, INSTALL_DIR, '!^garradin-(.*)\.tar\.gz$!'); if ($step == 'download') { $i->download($i->latest()); $next = 'install'; } elseif ($step == 'install') { $i->install($i->latest()); $i->clean($i->latest()); $next = null; } else { $next = 'download'; } echo $next ? '<meta http-equiv="refresh" content="0;url=?step='.$next.'" />' : ''; echo ' </head>'; if ($step == 'download') { echo ' <div class="spinner"> <h2>Décompression en cours…</h2> </div>'; } elseif ($step == 'install') { echo '<div> <h2>Installation réussie</h2> <p>Configurez désormais votre sous-domaine pour pointer sur le sous-répertoire <strong>www</strong> de cette installation.</p> <p><a href="' . WEBSITE . '">Consultez la documentation pour plus d\'infos</a></p> </div>'; } else { echo ' <div class="spinner"> <h2>Téléchargement en cours…</h2> </div>'; } echo ' </body> </html> '; if ($step == 'install') { $i->prune(0); @rmdir(INSTALL_DIR); @unlink(__FILE__); } } ?> EOF; foreach ($includes as $tag => $files) { $source = []; foreach ($files as $file) { $content = file_get_contents($file); $content = preg_replace('!^(?:<\?php|namespace |use ).*$!m', '', $content); $content = preg_replace("!^!m", "\t$0", $content); $content = preg_replace("!^\t$!m", '', $content); $content = trim($content); $source[] = $content; } $source = implode("\n\n", $source); $template = str_replace($tag, $source, $template); } echo $template; |