-
-
Notifications
You must be signed in to change notification settings - Fork 247
/
Database.php
112 lines (106 loc) · 3.02 KB
/
Database.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
<?php
if ( strpos( wfHostname(), 'test' ) === 0 ) {
// Mirabeta database configuration
$wgLBFactoryConf = [
'class' => \Wikimedia\Rdbms\LBFactoryMulti::class,
'secret' => $wgSecretKey,
'sectionsByDB' => $wi->wikiDBClusters,
'sectionLoads' => [
'DEFAULT' => [
'db172' => 0,
],
'c1' => [
'db172' => 0,
],
],
'serverTemplate' => [
'dbname' => $wgDBname,
'user' => $wgDBuser,
'password' => $wgDBpassword,
'type' => 'mysql',
'flags' => DBO_DEFAULT | ( MW_ENTRY_POINT === 'cli' ? DBO_DEBUG : 0 ),
'variables' => [
// https://mariadb.com/docs/reference/mdb/system-variables/innodb_lock_wait_timeout
'innodb_lock_wait_timeout' => 120,
],
],
'hostsByName' => [
'db172' => '10.0.17.158',
],
'externalLoads' => [
'beta' => [
/** where the metawikibeta database is located */
'db172' => 0,
],
],
'readOnlyBySection' => [
// 'DEFAULT' => 'Maintenance is in progress. Please try again in a few minutes.',
// 'c1' => 'Maintenance is in progress. Please try again in a few minutes.',
],
];
} else {
// Production database configuration
$wgLBFactoryConf = [
'class' => \Wikimedia\Rdbms\LBFactoryMulti::class,
'secret' => $wgSecretKey,
'sectionsByDB' => $wi->wikiDBClusters,
'sectionLoads' => [
'DEFAULT' => [
'db171' => 0,
],
'c1' => [
'db151' => 0,
],
'c2' => [
'db161' => 0,
],
'c3' => [
'db171' => 0,
],
'c4' => [
'db181' => 0,
],
],
'serverTemplate' => [
'dbname' => $wgDBname,
'user' => $wgDBuser,
'password' => $wgDBpassword,
'type' => 'mysql',
'flags' => DBO_DEFAULT | ( MW_ENTRY_POINT === 'cli' ? DBO_DEBUG : 0 ),
'variables' => [
// https://mariadb.com/docs/reference/mdb/system-variables/innodb_lock_wait_timeout
'innodb_lock_wait_timeout' => 120,
],
],
'hostsByName' => [
'db151' => '10.0.15.110',
'db161' => '10.0.16.128',
'db171' => '10.0.17.119',
'db181' => '10.0.18.102',
],
'externalLoads' => [
'echo' => [
/** where the metawiki database is located */
'db171' => 0,
],
],
'readOnlyBySection' => [
// 'DEFAULT' => 'Maintenance is in progress. Please try again in a few minutes.',
// 'c1' => 'Maintenance is in progress. Please try again in a few minutes.',
// 'c2' => 'Maintenance is in progress. Please try again in a few minutes.',
// 'c3' => 'Maintenance is in progress. Please try again in a few minutes.',
// 'c4' => 'Maintenance is in progress. Please try again in a few minutes.',
// 's1' => 'Maintenance is in progress. Please try again in a few minutes.',
],
];
}
// Disable LoadMonitor in CLI, it doesn't provide much value in CLI.
if ( PHP_SAPI === 'cli' ) {
$wgLBFactoryConf['loadMonitorClass'] = \Wikimedia\Rdbms\LoadMonitorNull::class;
}
// Disallow web request database transactions that are slower than 10 seconds
$wgMaxUserDBWriteDuration = 10;
// Max execution time for expensive queries of special pages (in milliseconds)
$wgMaxExecutionTimeForExpensiveQueries = 30000;
$wgMiserMode = true;
$wgSQLMode = null;