-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Expand file tree
/
Copy pathSetupHelper.php
More file actions
53 lines (43 loc) · 1.24 KB
/
SetupHelper.php
File metadata and controls
53 lines (43 loc) · 1.24 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
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Setup;
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\Forms\Setup\SetupFormList;
use function assert;
use function in_array;
final class SetupHelper
{
public static function createConfigFile(): ConfigFile
{
$configFile = new ConfigFile();
$configFile->setPersistKeys([
'DefaultLang',
'ServerDefault',
'UploadDir',
'SaveDir',
'Servers/1/verbose',
'Servers/1/host',
'Servers/1/port',
'Servers/1/socket',
'Servers/1/auth_type',
'Servers/1/user',
'Servers/1/password',
]);
return $configFile;
}
/** @return string[][] */
public static function getPages(): array
{
$ignored = ['Config', 'Servers'];
$pages = [];
foreach (SetupFormList::getAllFormNames() as $formset) {
if (in_array($formset, $ignored, true)) {
continue;
}
$formClass = SetupFormList::get($formset);
assert($formClass !== null);
$pages[$formset] = ['name' => $formClass::getName(), 'formset' => $formset];
}
return $pages;
}
}