-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.php
More file actions
1655 lines (1424 loc) · 76.2 KB
/
install.php
File metadata and controls
1655 lines (1424 loc) · 76.2 KB
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
declare(strict_types=1);
session_start();
const MINI_CMS_INSTALLER_VERSION = '0.2.0-beta';
$projectRoot = @realpath(__DIR__) ?: __DIR__;
$publicPath = $projectRoot.DIRECTORY_SEPARATOR.'public';
$lockPath = $projectRoot.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'installed.lock';
$rootInstallerPath = $projectRoot.DIRECTORY_SEPARATOR.'install.php';
$publicInstallerPath = $publicPath.DIRECTORY_SEPARATOR.'install.php';
$installerSupportPath = $projectRoot.DIRECTORY_SEPARATOR.'installer'.DIRECTORY_SEPARATOR.'InstallerUrl.php';
$installerSupportDir = $projectRoot.DIRECTORY_SEPARATOR.'installer';
require_once $installerSupportPath;
if (! isset($_SESSION['mini_cms_installer_token'])) {
$_SESSION['mini_cms_installer_token'] = bin2hex(random_bytes(24));
}
$token = $_SESSION['mini_cms_installer_token'];
$action = (string) ($_POST['action'] ?? $_GET['action'] ?? '');
$state = installer_state($projectRoot, $publicPath, $lockPath);
if ($action === 'delete_installer') {
verify_token($token);
render_delete_result(delete_installer_files([$rootInstallerPath, $publicInstallerPath, $installerSupportPath], [$installerSupportDir]), $state);
exit;
}
if ($action === 'emergency_protection') {
verify_token($token);
render_emergency_protection_result(write_emergency_htaccess($projectRoot), $state);
exit;
}
if ($action === 'diagnostics') {
render_diagnostics($state, $token);
exit;
}
if (is_file($lockPath)) {
render_already_installed($state, $token);
exit;
}
if ($action === 'install') {
verify_token($token);
render_install_result(handle_install($projectRoot, $publicPath, $lockPath, $state), $state, $token);
exit;
}
render_wizard($state, $token);
function verify_token(string $token): void
{
if (! hash_equals($token, (string) ($_POST['_token'] ?? ''))) {
render_page('Security check failed', '<div class="alert danger">The installer session token is invalid. Refresh the installer and try again.</div>');
exit;
}
}
function installer_state(string $projectRoot, string $publicPath, string $lockPath): array
{
$docRoot = @realpath((string) ($_SERVER['DOCUMENT_ROOT'] ?? '')) ?: '';
$scriptFile = @realpath((string) ($_SERVER['SCRIPT_FILENAME'] ?? '')) ?: '';
$defaultDbPath = $projectRoot.DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'database.sqlite';
$requiredExtensions = ['pdo', 'pdo_sqlite', 'sqlite3', 'mbstring', 'openssl', 'tokenizer', 'xml', 'ctype', 'json', 'fileinfo'];
$optionalExtensions = ['curl', 'zip'];
$envPath = $projectRoot.DIRECTORY_SEPARATOR.'.env';
$envContent = is_file($envPath) ? (string) file_get_contents($envPath) : '';
$appKeyPresent = env_value($envContent, 'APP_KEY') !== '';
$requiredLaravelPaths = required_laravel_paths($projectRoot, $publicPath, $defaultDbPath);
$openBasedir = (string) ini_get('open_basedir');
$openBasedirDiagnostics = open_basedir_diagnostics($requiredLaravelPaths, $openBasedir);
$publicExposure = public_exposure_checks(guessed_app_url());
$hestia = hestia_context($projectRoot, $publicPath, $docRoot);
$composerAvailable = shell_command_available('composer');
$checks = [];
$checks[] = check_item('PHP version', version_compare(PHP_VERSION, '8.3.0', '>='), 'Current: '.PHP_VERSION, 'PHP 8.3 or newer is required.');
foreach ($requiredExtensions as $extension) {
$checks[] = check_item("PHP extension: {$extension}", extension_loaded($extension), extension_loaded($extension) ? 'Enabled' : 'Missing', "Ask your host to enable {$extension}.");
}
foreach ($optionalExtensions as $extension) {
$checks[] = check_item("Optional PHP extension: {$extension}", extension_loaded($extension), extension_loaded($extension) ? 'Enabled' : 'Optional but recommended', "{$extension} is useful on some hosts but not required for the default SQLite install.", false);
}
foreach (writable_install_paths($projectRoot, $publicPath) as $label => $path) {
$checks[] = check_item("Writable: {$label}", path_writable($path), path_writable($path) ? 'Writable' : 'Not writable', "Set permissions to 775/755 as appropriate or ask hosting support to make {$label} writable.");
}
$vendorExists = is_file($projectRoot.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php');
$checks[] = check_item(
'vendor/autoload.php',
$vendorExists || $composerAvailable,
$vendorExists ? 'Required file exists' : ($composerAvailable ? 'Missing, but Composer command appears available' : 'Missing and Composer not available'),
'Use the installable ZIP with vendor included, or run composer install before using the installer.',
! $vendorExists && ! $composerAvailable,
);
$checks[] = check_item('artisan', is_file($projectRoot.DIRECTORY_SEPARATOR.'artisan'), 'Laravel console entry exists', 'The project upload appears incomplete.');
$checks[] = check_item('public/build/manifest.json', is_file($publicPath.DIRECTORY_SEPARATOR.'build'.DIRECTORY_SEPARATOR.'manifest.json'), 'Built frontend assets found', 'Use the installable ZIP, or run npm ci && npm run build before production install.');
$checks[] = check_item('public/index.php', is_file($publicPath.DIRECTORY_SEPARATOR.'index.php'), 'Laravel public front controller found', 'The public directory appears incomplete.');
$checks[] = check_item('database/migrations', is_dir($projectRoot.DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'migrations'), 'Migration files are present', 'The release package is incomplete. Upload the full project package.');
$checks[] = check_item('APP_KEY', $appKeyPresent, $appKeyPresent ? 'Present' : 'Missing; installer will generate it', 'The installer can generate APP_KEY during setup.', false);
$checks[] = check_item('SQLite database outside public', ! path_inside($defaultDbPath, $publicPath), 'Default database path is safe', 'Move database.sqlite outside the public web root.');
$checks[] = check_item('Installer lock', ! is_file($lockPath), 'Not installed yet', 'Installer is locked because the CMS is already installed.');
foreach ($openBasedirDiagnostics as $diagnostic) {
if (! $diagnostic['inside']) {
$checks[] = check_item(
'open_basedir: '.$diagnostic['label'],
false,
'Blocked by PHP open_basedir',
'Ask hosting support to add the Laravel project root to open_basedir, not only public/.',
);
}
}
foreach ($publicExposure as $exposure) {
if ($exposure['dangerous']) {
$checks[] = check_item(
'Public exposure: '.$exposure['path'],
false,
'HTTP '.$exposure['status'].' exposes a private file',
'Set the document root to public/ and use Emergency Protection until the server is fixed.',
);
}
}
$docRootLooksPublic = same_path($docRoot, $publicPath);
$docRootLooksProject = same_path($docRoot, $projectRoot);
$detectedBasePath = MiniCmsInstallerUrl::scriptBasePath((string) ($_SERVER['SCRIPT_NAME'] ?? $_SERVER['PHP_SELF'] ?? ''));
$docRootWarning = $docRootLooksPublic
? 'Your site appears to be served from Laravel /public.'
: 'Your hosting does not appear to use Laravel /public as the document root. The full project root may be web-accessible, including .env or database files if the server is not configured to block them. Recommended fix: point the domain document root to project/public.';
return [
'project_root' => $projectRoot,
'public_path' => $publicPath,
'lock_path' => $lockPath,
'default_db_path' => $defaultDbPath,
'doc_root' => $docRoot,
'script_file' => $scriptFile,
'doc_root_is_public' => $docRootLooksPublic,
'doc_root_is_project' => $docRootLooksProject,
'doc_root_warning' => $docRootWarning,
'detected_base_path' => $detectedBasePath === '' ? '/' : $detectedBasePath,
'shell_available' => shell_available(),
'composer_available' => $composerAvailable,
'can_bootstrap_laravel' => is_file($projectRoot.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php') && is_file($projectRoot.DIRECTORY_SEPARATOR.'bootstrap'.DIRECTORY_SEPARATOR.'app.php'),
'has_build' => is_file($publicPath.DIRECTORY_SEPARATOR.'build'.DIRECTORY_SEPARATOR.'manifest.json'),
'open_basedir' => $openBasedir,
'open_basedir_diagnostics' => $openBasedirDiagnostics,
'public_exposure' => $publicExposure,
'hestia' => $hestia,
'app_key_present' => $appKeyPresent,
'writable_paths' => writable_install_paths($projectRoot, $publicPath),
'required_paths' => $requiredLaravelPaths,
'checks' => $checks,
'critical_ok' => ! in_array(false, array_map(fn (array $check): bool => $check['ok'] || ! $check['critical'], $checks), true),
];
}
function check_item(string $label, bool $ok, string $detail, string $fix, bool $critical = true): array
{
return compact('label', 'ok', 'detail', 'fix', 'critical');
}
function writable_install_paths(string $projectRoot, string $publicPath): array
{
return [
'.env or project root' => is_file($projectRoot.DIRECTORY_SEPARATOR.'.env') ? $projectRoot.DIRECTORY_SEPARATOR.'.env' : $projectRoot,
'database/' => $projectRoot.DIRECTORY_SEPARATOR.'database',
'storage/' => $projectRoot.DIRECTORY_SEPARATOR.'storage',
'storage/app/' => $projectRoot.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'app',
'storage/app/public/' => $projectRoot.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public',
'storage/framework/' => $projectRoot.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'framework',
'storage/logs/' => $projectRoot.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'logs',
'bootstrap/cache/' => $projectRoot.DIRECTORY_SEPARATOR.'bootstrap'.DIRECTORY_SEPARATOR.'cache',
'public/' => $publicPath,
];
}
function required_laravel_paths(string $projectRoot, string $publicPath, string $defaultDbPath): array
{
return [
'project root' => $projectRoot,
'vendor/autoload.php' => $projectRoot.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php',
'storage/' => $projectRoot.DIRECTORY_SEPARATOR.'storage',
'bootstrap/cache/' => $projectRoot.DIRECTORY_SEPARATOR.'bootstrap'.DIRECTORY_SEPARATOR.'cache',
'database/' => $projectRoot.DIRECTORY_SEPARATOR.'database',
'public/' => $publicPath,
'.env' => $projectRoot.DIRECTORY_SEPARATOR.'.env',
'database/database.sqlite' => $defaultDbPath,
];
}
function open_basedir_diagnostics(array $paths, string $openBasedir): array
{
$allowed = open_basedir_paths($openBasedir);
return collect_array($paths, function (string $path, string $label) use ($allowed, $openBasedir): array {
$exists = @file_exists($path);
$inside = $openBasedir === '' || path_allowed_by_open_basedir($path, $allowed);
$writable = path_writable($path);
$status = $inside
? ($openBasedir === '' ? 'No open_basedir restriction' : 'Allowed')
: 'Blocked by open_basedir';
return compact('label', 'path', 'exists', 'inside', 'writable', 'status');
});
}
function open_basedir_paths(string $openBasedir): array
{
if (trim($openBasedir) === '') {
return [];
}
return array_values(array_filter(array_map(
fn (string $path): string => rtrim(normalize_path($path), '/'),
explode(PATH_SEPARATOR, $openBasedir),
)));
}
function path_allowed_by_open_basedir(string $path, array $allowedPaths): bool
{
$normalized = normalize_path($path);
foreach ($allowedPaths as $allowed) {
if ($allowed === '') {
continue;
}
if ($normalized === $allowed || str_starts_with($normalized, rtrim($allowed, '/').'/')) {
return true;
}
}
return false;
}
function public_exposure_checks(string $appUrl): array
{
$paths = [
'/.env',
'/composer.json',
'/composer.lock',
'/database/database.sqlite',
'/vendor/autoload.php',
'/storage/logs/laravel.log',
'/storage/logs/cms.log',
];
return array_map(function (string $path) use ($appUrl): array {
$url = MiniCmsInstallerUrl::appendPath($appUrl, ltrim($path, '/'));
$status = http_status_for_url($url);
$dangerous = in_array($status, [200, 206], true);
$safe = in_array($status, [403, 404], true);
return [
'path' => $path,
'url' => $url,
'status' => $status,
'dangerous' => $dangerous,
'safe' => $safe,
'status_text' => $status === 0 ? 'Not reachable / not checked' : (string) $status,
];
}, $paths);
}
function http_status_for_url(string $url): int
{
if (! filter_var($url, FILTER_VALIDATE_URL) || ! (bool) ini_get('allow_url_fopen')) {
return 0;
}
$context = stream_context_create([
'http' => [
'method' => 'HEAD',
'ignore_errors' => true,
'timeout' => 2,
'follow_location' => 0,
'user_agent' => 'MiniCMS-Installer-Diagnostics',
],
'ssl' => [
'verify_peer' => true,
'verify_peer_name' => true,
],
]);
$headers = @get_headers($url, false, $context);
if (! is_array($headers) || $headers === []) {
$context = stream_context_create([
'http' => [
'method' => 'GET',
'ignore_errors' => true,
'timeout' => 2,
'follow_location' => 0,
'user_agent' => 'MiniCMS-Installer-Diagnostics',
],
]);
$headers = @get_headers($url, false, $context);
}
if (! is_array($headers) || ! isset($headers[0])) {
return 0;
}
return preg_match('/\s(\d{3})\s/', (string) $headers[0], $matches) ? (int) $matches[1] : 0;
}
function hestia_context(string $projectRoot, string $publicPath, string $docRoot): array
{
$path = str_replace('\\', '/', $projectRoot);
$isHestiaPath = preg_match('#^/home/([^/]+)/web/([^/]+)/#', $path, $matches) === 1;
$user = $isHestiaPath ? $matches[1] : 'USER';
$domain = $isHestiaPath ? $matches[2] : 'DOMAIN';
$domainRoot = "/home/{$user}/web/{$domain}";
$hestiaBin = '/usr/local/hestia/bin';
$domainConf = "/home/{$user}/conf/web/{$domain}";
$phpMinor = PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;
$backendTemplate = 'PHP-'.PHP_MAJOR_VERSION.'_'.PHP_MINOR_VERSION;
$socketMatches = glob("/run/php/*{$domain}*.sock") ?: [];
return [
'likely' => $isHestiaPath || is_dir($hestiaBin) || is_dir($domainConf),
'user' => $user,
'domain' => $domain,
'project_root' => $projectRoot,
'public_path' => $publicPath,
'document_root' => $docRoot,
'domain_root' => $domainRoot,
'hestia_bin' => $hestiaBin,
'domain_conf' => $domainConf,
'custom_document_root' => 'public',
'backend_template' => $backendTemplate,
'php_version' => $phpMinor,
'suggested_socket_check' => "ls -la /run/php | grep {$domain}",
'socket_status' => $socketMatches !== [] ? 'Socket candidate found: '.implode(', ', $socketMatches) : 'Socket not detected from PHP; verify with SSH if the site returns 503',
'apache_error_log' => "/var/log/apache2/domains/{$domain}.error.log",
'laravel_logs' => 'storage/logs/cms.log or storage/logs/laravel.log',
'suggested_open_basedir' => "/home/{$user}/.composer:{$projectRoot}:{$domainRoot}/private:{$domainRoot}/public_shtml:/home/{$user}/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt",
'add_php_command' => "/usr/local/hestia/bin/v-add-web-php {$phpMinor}",
'change_backend_command' => "/usr/local/hestia/bin/v-change-web-domain-backend-tpl {$user} {$domain} {$backendTemplate} yes",
'reload_commands' => "systemctl reload apache2\nsystemctl reload nginx\nsystemctl restart php{$phpMinor}-fpm",
];
}
function shell_command_available(string $command): bool
{
if (! shell_available()) {
return false;
}
$probe = PHP_OS_FAMILY === 'Windows'
? 'where '.escapeshellarg($command).' 2>NUL'
: 'command -v '.escapeshellarg($command).' 2>/dev/null';
$result = @shell_exec($probe);
return is_string($result) && trim($result) !== '';
}
function collect_array(array $items, callable $callback): array
{
$result = [];
foreach ($items as $key => $value) {
$result[] = $callback($value, (string) $key);
}
return $result;
}
function handle_install(string $projectRoot, string $publicPath, string $lockPath, array $state): array
{
$logs = [];
$warnings = [];
$errors = [];
$manualCommands = [
'composer install --no-dev --optimize-autoloader',
'npm ci',
'npm run build',
'php artisan key:generate --force',
'php artisan migrate --force',
'php artisan db:seed --force',
'php artisan storage:link',
'php artisan sitemap:generate',
'php artisan optimize',
];
$siteName = trim((string) ($_POST['site_name'] ?? 'Mini CMS'));
$appUrl = MiniCmsInstallerUrl::normalizeAppUrl((string) ($_POST['app_url'] ?? ''));
$assetUrl = MiniCmsInstallerUrl::assetUrl($appUrl);
$basePath = MiniCmsInstallerUrl::basePath($appUrl);
$adminEmail = trim((string) ($_POST['admin_email'] ?? ''));
$adminPassword = (string) ($_POST['admin_password'] ?? '');
$adminPasswordConfirmation = (string) ($_POST['admin_password_confirmation'] ?? '');
$defaultLocale = (string) ($_POST['default_locale'] ?? 'en');
$demoContent = isset($_POST['demo_content']);
$generateSitemap = isset($_POST['generate_sitemap']);
$storageStrategy = (string) ($_POST['storage_strategy'] ?? 'symlink');
$appEnv = (string) ($_POST['app_env'] ?? 'production');
$appDebug = isset($_POST['app_debug']) ? 'true' : 'false';
$dbPath = trim((string) ($_POST['db_path'] ?? $state['default_db_path']));
$acknowledgedRootRisk = isset($_POST['acknowledge_document_root']);
$updateExistingAdmin = isset($_POST['update_existing_admin']);
if (! $state['critical_ok']) {
$errors[] = 'Installation is blocked because one or more critical hosting checks failed.';
foreach ($state['checks'] as $check) {
if (! $check['ok'] && $check['critical']) {
$errors[] = $check['label'].': '.$check['fix'];
}
}
return install_result(false, $errors, $warnings, $logs, $manualCommands);
}
if ($siteName === '') {
$errors[] = 'Site name is required.';
}
if (! MiniCmsInstallerUrl::isValidAppUrl($appUrl)) {
$errors[] = 'APP_URL is invalid. Use a full URL such as https://example.com or https://example.com/cms, without query strings or fragments.';
}
if (! filter_var($adminEmail, FILTER_VALIDATE_EMAIL)) {
$errors[] = 'Admin email is invalid.';
}
if (strlen($adminPassword) < 12) {
$errors[] = 'Admin password must be at least 12 characters.';
}
if ($adminPassword !== $adminPasswordConfirmation) {
$errors[] = 'Admin password confirmation does not match.';
}
if (! in_array($defaultLocale, ['en', 'fa', 'ar'], true)) {
$errors[] = 'Default locale must be en, fa, or ar.';
}
if (! in_array($appEnv, ['production', 'local', 'staging'], true)) {
$errors[] = 'APP_ENV must be production, local, or staging.';
}
$dbPath = normalize_install_path($dbPath, $projectRoot);
if (path_inside($dbPath, $publicPath)) {
$errors[] = 'The SQLite database path is under public/. Move it outside the public web root.';
}
if (($state['doc_root_is_project'] || ! $state['doc_root_is_public']) && ! $acknowledgedRootRisk) {
$errors[] = 'Your hosting document root does not appear to point to /public. Confirm the risk or fix the document root before installing.';
}
if ($errors !== []) {
return install_result(false, $errors, $warnings, $logs, $manualCommands);
}
try {
ensure_directory(dirname($dbPath));
ensure_directory($projectRoot.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public');
ensure_directory($projectRoot.DIRECTORY_SEPARATOR.'bootstrap'.DIRECTORY_SEPARATOR.'cache');
if (! is_file($dbPath)) {
touch($dbPath);
$logs[] = 'Created SQLite database file.';
}
$envPath = $projectRoot.DIRECTORY_SEPARATOR.'.env';
$envContent = is_file($envPath)
? (string) file_get_contents($envPath)
: (is_file($projectRoot.DIRECTORY_SEPARATOR.'.env.example') ? (string) file_get_contents($projectRoot.DIRECTORY_SEPARATOR.'.env.example') : minimal_env());
$appKey = env_value($envContent, 'APP_KEY');
if ($appKey === '') {
$appKey = 'base64:'.base64_encode(random_bytes(32));
$logs[] = 'Generated APP_KEY.';
}
$envContent = update_env_values($envContent, [
'APP_NAME' => $siteName,
'APP_ENV' => $appEnv,
'APP_DEBUG' => $appDebug,
'APP_URL' => $appUrl,
'ASSET_URL' => $assetUrl,
'APP_KEY' => $appKey,
'APP_LOCALE' => $defaultLocale,
'APP_FALLBACK_LOCALE' => 'en',
'DB_CONNECTION' => 'sqlite',
'DB_DATABASE' => $dbPath,
'FILESYSTEM_DISK' => 'public',
'CACHE_STORE' => 'file',
'SESSION_DRIVER' => 'file',
'QUEUE_CONNECTION' => 'sync',
'CMS_ADMIN_NAME' => 'Admin',
'CMS_ADMIN_EMAIL' => $adminEmail,
'CMS_ADMIN_PASSWORD' => '',
'SQLITE_BUSY_TIMEOUT' => '5000',
'SQLITE_JOURNAL_MODE' => 'WAL',
'SQLITE_SYNCHRONOUS' => 'NORMAL',
]);
if (file_put_contents($envPath, $envContent, LOCK_EX) === false) {
throw new RuntimeException('Could not write .env. Check project root permissions.');
}
$logs[] = 'Wrote .env without storing the admin password.';
if (! $state['can_bootstrap_laravel']) {
$warnings[] = 'vendor/autoload.php is missing. The installer created .env and SQLite, but Composer dependencies are required before automatic finalization.';
return install_result(false, [], $warnings, $logs, $manualCommands, true);
}
$artisan = new InstallerArtisan($projectRoot);
$artisan->call('optimize:clear');
$logs[] = 'Cleared Laravel caches.';
$artisan->call('migrate', ['--force' => true]);
$logs[] = 'Ran database migrations.';
if ($demoContent) {
$artisan->call('db:seed', ['--force' => true]);
$logs[] = 'Seeded demo content.';
}
ensure_admin_user($adminEmail, $adminPassword, $updateExistingAdmin);
$logs[] = 'Created or updated administrator account.';
$storageStatus = setup_storage($projectRoot, $publicPath, $storageStrategy, $artisan, $warnings);
$logs[] = $storageStatus;
if ($generateSitemap && artisan_command_exists($artisan, 'sitemap:generate')) {
$artisan->call('sitemap:generate');
$logs[] = 'Generated sitemap.';
}
$artisan->call('optimize:clear');
$artisan->call('optimize');
$logs[] = 'Optimized Laravel caches.';
if (artisan_command_exists($artisan, 'sqlite:health')) {
$artisan->call('sqlite:health');
$logs[] = 'SQLite health check completed.';
}
if (artisan_command_exists($artisan, 'storage:health')) {
try {
$artisan->call('storage:health');
$logs[] = 'Storage health check completed.';
} catch (Throwable $exception) {
$warnings[] = 'Storage health check reported a problem: '.human_error($exception->getMessage());
}
}
$postInstallChecks = post_install_checks($projectRoot, $publicPath, $appUrl, $appEnv, $appDebug, $generateSitemap);
$failedPostInstallChecks = array_values(array_filter($postInstallChecks, fn (array $check): bool => $check['status'] === 'fail'));
if ($failedPostInstallChecks !== []) {
foreach ($failedPostInstallChecks as $check) {
$errors[] = $check['label'].': '.$check['fix'];
}
return install_result(false, $errors, $warnings, $logs, $manualCommands, false, [
'post_install_checks' => $postInstallChecks,
]);
}
ensure_directory(dirname($lockPath));
file_put_contents($lockPath, json_encode([
'installed_at' => gmdate('c'),
'app_url' => $appUrl,
'base_path' => $basePath,
'installer_version' => MINI_CMS_INSTALLER_VERSION,
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), LOCK_EX);
$logs[] = 'Created installer lock file.';
return install_result(true, [], $warnings, $logs, [], false, [
'site_url' => $appUrl,
'admin_url' => MiniCmsInstallerUrl::appendPath($appUrl, 'admin'),
'base_path' => $basePath === '' ? '/' : $basePath,
'asset_url' => $assetUrl === '' ? '(not set for root install)' : $assetUrl,
'admin_email' => $adminEmail,
'storage_status' => $storageStatus,
'sitemap_status' => $generateSitemap ? 'Requested' : 'Skipped',
'post_install_checks' => [
...$postInstallChecks,
['label' => 'Installer lock', 'status' => 'pass', 'detail' => 'storage/app/installed.lock was created.', 'fix' => ''],
],
]);
} catch (Throwable $exception) {
$errors[] = human_error($exception->getMessage());
return install_result(false, $errors, $warnings, $logs, $manualCommands);
}
}
function ensure_admin_user(string $email, string $password, bool $updateExistingAdmin): void
{
$roleClass = '\\App\\Models\\Role';
$userClass = '\\App\\Models\\User';
$hashClass = '\\Illuminate\\Support\\Facades\\Hash';
$administrator = $roleClass::query()->updateOrCreate(
['slug' => 'administrator'],
['name' => 'Administrator', 'description' => 'Full CMS access', 'permissions' => $roleClass::allPermissions(), 'is_system' => true]
);
$roleClass::query()->updateOrCreate(
['slug' => 'editor'],
['name' => 'Editor', 'description' => 'Content editing access', 'permissions' => $roleClass::editorPermissions(), 'is_system' => true]
);
$user = $userClass::query()->firstOrNew(['email' => $email]);
if ($user->exists && ! $updateExistingAdmin) {
throw new RuntimeException('An admin user with this email already exists. Confirm password update and run Install again.');
}
$user->fill([
'role_id' => $administrator->id,
'name' => 'Admin',
'password' => $hashClass::make($password),
]);
$user->save();
}
function setup_storage(string $projectRoot, string $publicPath, string $strategy, InstallerArtisan $artisan, array &$warnings): string
{
try {
$artisan->call('storage:link');
} catch (Throwable $exception) {
$warnings[] = 'storage:link failed. Symlink may be disabled on this host.';
}
$publicStorage = $publicPath.DIRECTORY_SEPARATOR.'storage';
if (is_link($publicStorage) || is_dir($publicStorage)) {
return verify_public_storage_mapping($projectRoot, $publicPath, $warnings)
? 'Public storage path exists and test file is reachable through public/storage.'
: 'Public storage path exists, but the test file was not reachable through public/storage.';
}
if ($strategy === 'copy') {
ensure_directory($publicStorage);
copy_directory($projectRoot.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public', $publicStorage);
$warnings[] = 'Storage copy fallback was used. Future uploads may need manual sync if symlinks remain disabled.';
return verify_public_storage_mapping($projectRoot, $publicPath, $warnings)
? 'Storage copy fallback created public/storage and test file is reachable.'
: 'Storage copy fallback created public/storage, but future upload reachability could not be verified.';
}
$warnings[] = 'Public storage is not linked. Ask your host to enable symlinks or rerun with copy fallback.';
return 'Storage link not verified.';
}
function verify_public_storage_mapping(string $projectRoot, string $publicPath, array &$warnings): bool
{
$storagePublic = $projectRoot.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public';
$publicStorage = $publicPath.DIRECTORY_SEPARATOR.'storage';
$relative = 'mini-cms-storage-health.txt';
$source = $storagePublic.DIRECTORY_SEPARATOR.$relative;
$public = $publicStorage.DIRECTORY_SEPARATOR.$relative;
try {
ensure_directory($storagePublic);
file_put_contents($source, 'mini-cms-storage-health', LOCK_EX);
$ok = is_file($public);
} catch (Throwable $exception) {
$warnings[] = 'Storage test file could not be written: '.$exception->getMessage();
$ok = false;
} finally {
if (is_file($source)) {
@unlink($source);
}
}
if (! $ok) {
$warnings[] = 'Uploaded files may return 404 because public/storage is not mapped to storage/app/public. Run php artisan storage:link or fix the hosting symlink/open_basedir permissions.';
}
return $ok;
}
function artisan_command_exists(InstallerArtisan $artisan, string $command): bool
{
try {
$artisan->call('list', ['namespace' => explode(':', $command)[0]]);
return str_contains($artisan->lastOutput(), $command);
} catch (Throwable) {
return false;
}
}
function install_result(bool $success, array $errors, array $warnings, array $logs, array $manualCommands = [], bool $manual = false, array $summary = []): array
{
return compact('success', 'errors', 'warnings', 'logs', 'manualCommands', 'manual', 'summary');
}
function post_install_checks(string $projectRoot, string $publicPath, string $appUrl, string $appEnv, string $appDebug, bool $generateSitemap): array
{
$warnings = [];
$checks = [
post_install_check('APP_ENV', $appEnv === 'production' ? 'pass' : 'warning', "APP_ENV={$appEnv}", 'Use APP_ENV=production for production installs.'),
post_install_check('APP_DEBUG', $appDebug === 'false' ? 'pass' : 'fail', "APP_DEBUG={$appDebug}", 'Set APP_DEBUG=false before public launch.'),
post_install_check('APP_URL', preg_match('/^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?(\/|$)/i', $appUrl) === 1 ? 'fail' : 'pass', $appUrl, 'Set APP_URL to the real production domain before finishing install.'),
post_install_check('SQLite database file', is_file($projectRoot.DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'database.sqlite') ? 'pass' : 'fail', 'database/database.sqlite', 'Create the SQLite file and run migrations.'),
post_install_check('Storage URL mapping', verify_public_storage_mapping($projectRoot, $publicPath, $warnings) ? 'pass' : 'fail', 'storage/app/public -> public/storage', 'Run php artisan storage:link or fix the public/storage symlink so uploaded files do not return 404.'),
post_install_check('Sitemap', ! $generateSitemap || is_file($publicPath.DIRECTORY_SEPARATOR.'sitemap.xml') ? 'pass' : 'warning', $generateSitemap ? 'Requested' : 'Skipped', 'Run php artisan sitemap:generate after APP_URL is final.'),
];
foreach ($warnings as $warning) {
$checks[] = post_install_check('Storage warning', 'fail', $warning, 'Fix public/storage before using uploads or galleries.');
}
foreach (public_exposure_checks($appUrl) as $exposure) {
if ($exposure['dangerous']) {
$checks[] = post_install_check('Public exposure: '.$exposure['path'], 'fail', 'HTTP '.$exposure['status'], 'Set document root to public and block private files before launch.');
}
}
foreach (open_basedir_diagnostics(required_laravel_paths($projectRoot, $publicPath, $projectRoot.DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'database.sqlite'), (string) ini_get('open_basedir')) as $diagnostic) {
if (! $diagnostic['inside']) {
$checks[] = post_install_check('open_basedir: '.$diagnostic['label'], 'fail', 'Blocked', 'Add the Laravel project root to open_basedir.');
}
}
return $checks;
}
function post_install_check(string $label, string $status, string $detail, string $fix): array
{
return compact('label', 'status', 'detail', 'fix');
}
final class InstallerArtisan
{
private mixed $app = null;
private string $output = '';
public function __construct(private readonly string $projectRoot)
{
require_once $this->projectRoot.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
$this->app = require $this->projectRoot.DIRECTORY_SEPARATOR.'bootstrap'.DIRECTORY_SEPARATOR.'app.php';
$this->app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
}
public function call(string $command, array $parameters = []): void
{
$exitCode = \Illuminate\Support\Facades\Artisan::call($command, $parameters);
$this->output = \Illuminate\Support\Facades\Artisan::output();
if ($exitCode !== 0) {
$details = trim($this->output);
throw new RuntimeException("Command failed: php artisan {$command}".($details !== '' ? "\n{$details}" : ''));
}
}
public function lastOutput(): string
{
return $this->output;
}
}
function render_wizard(array $state, string $token): void
{
$checksHtml = render_checks($state);
$appUrl = e(guessed_app_url());
$dbPath = e($state['default_db_path']);
$docRootWarning = e($state['doc_root_warning']);
$riskBox = ! $state['doc_root_is_public'] ? '<label class="check"><input type="checkbox" name="acknowledge_document_root" value="1"> I understand this host should point the domain document root to /public. Continue only if I cannot change it yet.</label>' : '';
$disabled = $state['critical_ok'] ? '' : ' disabled';
$docRootAlertClass = $state['doc_root_is_public'] ? 'success' : 'warning';
$detectedBasePath = e($state['detected_base_path'] ?? '/');
$diagnosticsUrl = e((string) ($_SERVER['SCRIPT_NAME'] ?? 'install.php')).'?action=diagnostics';
$hestiaGuidance = $state['hestia']['detected']
? render_hestia_guidance($state['hestia'])
: '<div class="alert success">No Hestia path pattern was detected. If this is cPanel/shared hosting, the same Laravel rule applies: document root must point to <code>public</code> and PHP must access the project root.</div>';
$unsafeSummary = $state['critical_ok']
? '<div class="alert success">No critical installer blocker was detected.</div>'
: '<div class="alert danger">Installation is blocked until critical hosting problems are fixed. Open Diagnostics for exact details.</div>';
$errorSummary = $state['critical_ok']
? ''
: '<section class="alert danger"><strong>Fix these blockers before installing:</strong><ul class="compact-list">'.implode('', array_map(
fn (array $check): string => ! $check['ok'] && $check['critical'] ? '<li>'.e($check['label']).' - '.e($check['fix']).'</li>' : '',
$state['checks']
)).'</ul></section>';
$body = <<<HTML
{$errorSummary}
<form method="post" data-wizard>
<input type="hidden" name="_token" value="{$token}">
<input type="hidden" name="action" value="install">
<div class="steps" data-wizard-steps>
<button type="button" class="active" data-step-button="0">1. Welcome</button>
<button type="button" data-step-button="1">2. Environment</button>
<button type="button" data-step-button="2">3. Hosting</button>
<button type="button" data-step-button="3">4. App settings</button>
<button type="button" data-step-button="4">5. Admin</button>
<button type="button" data-step-button="5">6. SQLite</button>
<button type="button" data-step-button="6">7. Install</button>
<span>8. Finish</span>
</div>
<section class="card" data-step-panel>
<h2>Welcome</h2>
<p class="muted">This wizard prepares Mini CMS for production hosting with Laravel, SQLite, public storage, and admin access. It will not continue while critical hosting risks are detected.</p>
<div class="alert {$docRootAlertClass}">Detected URL base path: <code>{$detectedBasePath}</code>. For HestiaCP, set Custom document root to <code>public</code>. For subdirectory installs, enter the full URL such as <code>https://example.com/cms</code>.</div>
<div class="wizard-nav"><button type="button" class="button primary" data-next-step>Next</button></div>
</section>
<section class="card" data-step-panel>
<h2>Environment checks</h2>
<p class="muted">PHP, SQLite extensions, write permissions, release package mode, APP_KEY status, and public exposure are checked before setup.</p>
{$checksHtml}
<div class="wizard-nav"><button type="button" class="button secondary" data-prev-step>Back</button><a class="button primary" href="">Re-check</a><button type="button" class="button primary" data-next-step>Next</button></div>
</section>
<section class="card" data-step-panel>
<h2>Hosting and Hestia checks</h2>
<div class="alert {$docRootAlertClass}">{$docRootWarning}</div>
{$unsafeSummary}
{$hestiaGuidance}
<details class="advanced">
<summary>Advanced diagnostics</summary>
<p><a class="button primary" href="{$diagnosticsUrl}">Open diagnostics</a></p>
<p class="muted">Emergency .htaccess protection is available from the diagnostics page when public exposure is detected.</p>
</details>
<div class="wizard-nav"><button type="button" class="button secondary" data-prev-step>Back</button><button type="button" class="button primary" data-next-step>Next</button></div>
</section>
<section class="card" data-step-panel>
<h2>App settings</h2>
<div class="grid">
<label>Site name<input name="site_name" value="Mini CMS" required></label>
<label>Installation URL<input name="app_url" value="{$appUrl}" placeholder="https://example.com or https://example.com/cms" required><small>Stored without a trailing slash. If it includes a folder, ASSET_URL is set to the same URL.</small></label>
<label>Default locale<select name="default_locale"><option value="en">English</option><option value="fa">فارسی</option><option value="ar">العربية</option></select></label>
</div>
<div class="options">
<label class="check"><input type="checkbox" name="demo_content" value="1" checked> Enable demo content</label>
<label class="check"><input type="checkbox" name="generate_sitemap" value="1" checked> Generate sitemap after install</label>
{$riskBox}
</div>
<div class="wizard-nav"><button type="button" class="button secondary" data-prev-step>Back</button><button type="button" class="button primary" data-next-step>Next</button></div>
</section>
<section class="card" data-step-panel>
<h2>Admin account</h2>
<p class="muted">Use a real email and a strong password. The installer never writes the admin password to .env.</p>
<div class="grid">
<label>Admin email<input type="email" name="admin_email" value="admin@example.com" required></label>
<label>Admin password<input type="password" name="admin_password" minlength="12" required></label>
<label>Confirm password<input type="password" name="admin_password_confirmation" minlength="12" required></label>
</div>
<div class="options">
<label class="check"><input type="checkbox" name="update_existing_admin" value="1"> Update password if admin email already exists</label>
</div>
<div class="wizard-nav"><button type="button" class="button secondary" data-prev-step>Back</button><button type="button" class="button primary" data-next-step>Next</button></div>
</section>
<section class="card" data-step-panel>
<h2>Database and storage</h2>
<p class="muted">SQLite is stored outside public/. Uploaded files go to <code>storage/app/public</code> and must be served through <code>/storage</code>.</p>
<div class="grid">
<label>Storage strategy<select name="storage_strategy"><option value="symlink">Prefer symlink</option><option value="copy">Copy fallback if symlink fails</option></select><small>Symlink is recommended. Copy fallback is only a hosting workaround.</small></label>
<label class="full">SQLite DB path<input name="db_path" value="{$dbPath}"></label>
</div>
<details class="advanced">
<summary>Advanced environment</summary>
<div class="grid">
<label>APP_ENV<select name="app_env"><option value="production">production</option><option value="staging">staging</option><option value="local">local</option></select></label>
<label class="check"><input type="checkbox" name="app_debug" value="1"> Enable APP_DEBUG</label>
</div>
</details>
<div class="wizard-nav"><button type="button" class="button secondary" data-prev-step>Back</button><button type="button" class="button primary" data-next-step>Next</button></div>
</section>
<section class="card" data-step-panel>
<h2>Install</h2>
<p class="muted">The installer will write .env, create SQLite, run migrations, create the admin user, verify storage, optionally generate sitemap, optimize Laravel, and create <code>storage/app/installed.lock</code>.</p>
{$unsafeSummary}
<button class="button primary"{$disabled}>Install Mini CMS</button>
<p class="muted">Do not run this installer on an already configured local project unless you are using a disposable copy.</p>
<div class="wizard-nav"><button type="button" class="button secondary" data-prev-step>Back</button></div>
</section>
</form>
HTML;
render_page('Mini CMS Installer', $body);
}
function render_install_result(array $result, array $state, string $token): void
{
$alerts = '';
foreach ($result['errors'] as $error) {
$alerts .= '<div class="alert danger">'.e($error).'</div>';
}
foreach ($result['warnings'] as $warning) {
$alerts .= '<div class="alert warning">'.e($warning).'</div>';
}
$logs = '';
foreach ($result['logs'] as $log) {
$logs .= '<li>'.e(redact_log($log, $state['project_root'])).'</li>';
}
if ($result['manual']) {
$commands = implode("\n", array_map('e', $result['manualCommands']));
$body = <<<HTML
<div class="steps"><span class="done">1. Check</span><span class="done">2. Settings</span><span class="active">3. Manual finalization</span></div>
{$alerts}
<section class="card">
<h2>Manual finalization required</h2>
<p>The installer created the basic files it could, but Laravel dependencies are missing or unavailable. Run these commands after installing dependencies:</p>
<pre>{$commands}</pre>
</section>
<section class="card"><h2>Installer log</h2><ul>{$logs}</ul></section>
HTML;
render_page('Manual finalization required', $body);
return;
}
if (! $result['success']) {
$commands = implode("\n", array_map('e', $result['manualCommands']));
$body = <<<HTML
<div class="steps"><span class="done">1. Check</span><span class="done">2. Settings</span><span class="active">3. Needs attention</span></div>
{$alerts}
<section class="card"><h2>Installer log</h2><ul>{$logs}</ul></section>
<section class="card"><h2>Manual commands if needed</h2><pre>{$commands}</pre></section>
HTML;
render_page('Installation needs attention', $body);
return;
}
$summary = $result['summary'];
$siteUrl = e((string) ($summary['site_url'] ?? ''));
$adminUrl = e((string) ($summary['admin_url'] ?? ''));
$adminEmail = e((string) ($summary['admin_email'] ?? ''));
$basePath = e((string) ($summary['base_path'] ?? '/'));
$assetUrl = e((string) ($summary['asset_url'] ?? '(not set for root install)'));
$storageStatus = e((string) ($summary['storage_status'] ?? 'Unknown'));
$sitemapStatus = e((string) ($summary['sitemap_status'] ?? 'Unknown'));
$postInstallChecklist = render_post_install_checks($summary['post_install_checks'] ?? []);
$body = <<<HTML
<div class="steps"><span class="done">1. Check</span><span class="done">2. Settings</span><span class="done">3. Installed</span></div>
{$alerts}
<section class="card success-card">
<h2>Mini CMS is installed</h2>
<dl class="summary">
<dt>Site URL</dt><dd><a href="{$siteUrl}">{$siteUrl}</a></dd>
<dt>Admin URL</dt><dd><a href="{$adminUrl}">{$adminUrl}</a></dd>
<dt>Base path detected</dt><dd>{$basePath}</dd>
<dt>ASSET_URL</dt><dd>{$assetUrl}</dd>
<dt>Admin email</dt><dd>{$adminEmail}</dd>
<dt>Database</dt><dd>SQLite</dd>
<dt>Storage</dt><dd>{$storageStatus}</dd>
<dt>Sitemap</dt><dd>{$sitemapStatus}</dd>
</dl>
<div class="alert danger"><strong>Delete the installer immediately.</strong> Leaving install.php online is unsafe.</div>
<form method="post">
<input type="hidden" name="_token" value="{$token}">
<input type="hidden" name="action" value="delete_installer">
<button class="button danger">Delete installer securely</button>
</form>
</section>
<section class="card">
<h2>Post-install checklist</h2>
{$postInstallChecklist}
</section>
<section class="card">
<h2>Next steps</h2>
<ol>
<li>Delete installer.</li>
<li>Log in to admin.</li>
<li>Change site settings.</li>
<li>Upload logo.</li>
<li>Test media upload.</li>
<li>Back up database and storage.</li>
</ol>
</section>
<section class="card"><h2>Installer log</h2><ul>{$logs}</ul></section>