Failed Conditions
Push — multiproject/domainsettings ( c67fcc )
by Simon
04:29
created

config.inc.php (3 issues)

1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 *                                                                            *
5
 * All code in this file is released into the public domain by the ACC        *
6
 * Development Team. Please see team.json for a list of contributors.         *
7
 ******************************************************************************/
8
9
/**************************************************************************
10
 **********                   IMPORTANT NOTICE                    **********
11
 ***************************************************************************
12
 ** YOU MUST OVERRIDE THE CONFIGURATION IN THIS FILE WITH A LOCAL COPY!!! **
13
 ** IT IS VERY IMPORTANT THAT THAT FILE IS CALLED config.local.inc.php    **
14
 ***************************************************************************/
15
16
/*********************************
17
 * Databases and stuff
18
 */
19
20
// Main database location and access details.
21
$toolserver_username = "";
22
$toolserver_password = "";
23
$toolserver_host = "";
24
$toolserver_database = "";
25
26
// The antispoof configuration.
27
$antispoof_equivset = "equivset.php";
28
$antispoof_host = "sql-s1";
29
$antispoof_db = "enwiki_p";
30
$antispoof_table = "spoofuser";
31
32
/**********************************
33
 * File paths etc
34
 */
35
36
$mediawikiWebServiceEndpoint = "https://en.wikipedia.org/w/api.php";
37
$mediawikiScriptPath = "https://en.wikipedia.org/w/index.php";
38
$metaWikimediaWebServiceEndpoint = "https://meta.wikimedia.org/w/api.php";
39
40
// URL of the current copy of the tool.
41
$baseurl = "https://accounts.wmflabs.org";
42
43
// Pathname to the local installation of Peachy.
44
$peachyPath = "";
45
46
// Location outside web directory to place temporary files.
47
$varfilepath = "/projects/acc/";
48
49
// Set up cookies and session information.
50
$cookiepath = '/acc/';
51
$sessionname = 'ACC';
52
53
$xff_trusted_hosts_file = '../TrustedXFF/trusted-hosts.txt';
54
/************************************
55
 * Tool downtime
56
 */
57
58
$dontUseDb = 0; // Disable the tool completely.
59
$dontUseWikiDb = 0; // Disable access to the Wiki database.
60
$dontUseDbReason = ""; // Reason for disabling the tool.
61
$dontUseDbCulprit = ""; // Your name, or the person who broke the tool.
62
63
/**************************************
64
 * ACCBot IRC bot
65
 */
66
67
$ircBotDaemonise = true; // Run the IRC bot as a daemon, detached from the terminal.
68
69
$ircBotNickServPassword = ""; // Password for ACCBot's Nickserv account.
70
$ircBotCommunicationKey = ""; // Key used to communicate with the ACCBot.
71
$ircBotNetworkHost = "chat.freenode.net"; // The host to use for connecting.
72
$ircBotNetworkPort = 6667; // The port on the particular host.
73
$ircBotChannel = "#wikipedia-en-accounts"; // The channel in which the discussions are.
74
$ircBotNickname = "ACCBot"; // The nickname of the ACCBot.
75
$ircBotCommandTrigger = '!'; // The ACCBot's command trigger.
76
77
$ircBotNotificationRoutingKey = 1; // Helpmebot's notification type ID.
78
$ircBotNotificationsEnabled = 1; // Enable Helpmebot's notifications.
79
// Name of this instance of the tool.
80
// This name would be used by the bot as reference point.
81
$whichami = 'Live';
82
83
// AMQP configuration for notifications.
84
$amqpConfiguration = ['host' => 'localhost', 'port' => 5672, 'user' => 'guest', 'password' => 'guest', 'vhost' => '/', 'exchange' => '', 'tls' => false];
85
86
/***************************************
87
 * Email confirmation
88
 */
89
90
// Enable request email confirmation.
91
$enableEmailConfirm = 1;
92
// Number of days that are given for a requestor to confirm their email address.
93
$emailConfirmationExpiryDays = 7;
94
95
/**************************************
96
 * Interface registration, interface users, etc.
97
 */
98
99
$allowRegistration = true;
100
101
// Parameters for performing a newbie check on tool registration.
102
$onRegistrationNewbieCheck = true; // Enable the newbie checking.
103
$onRegistrationNewbieCheckEditCount = 20; // Minimum amount of edits on Wikipedia.
104
$onRegistrationNewbieCheckAge = 5184000; // Account age on Wikipedia in seconds.
105
106
// Force identification to the foundation
107
$forceIdentification = true;
108
109
// Time to cache positive automatic identification results, as a MySQL time interval
110
$identificationCacheExpiry = "1 DAY";
111
112
// minimum password version
113
//   0 = hashed
114
//   1 = hashed, salted
115
$minimumPasswordVersion = 0;
116
117
$communityUsername = "[Community]";
118
119
/***********************************
120
 * Reservations
121
 */
122
123
// Reserve requests to a specific user by default.
124
// Adapted from livehack by st - use the userid, zero for unreserved.
125
$defaultReserver = 0;
126
127
/************************************
128
 * OAuth Configuration
129
 */
130
131
$oauthConsumerToken = "";
132
$oauthSecretToken = "";
133
134
// Formerly-used OAuth tokens to permit reading identities from
135
$oauthLegacyTokens = [];
136
137
// path to Special:OAuth on target wiki.
138
// don't use pretty urls, see [[bugzilla:57500]]
139
$oauthBaseUrl = "https://en.wikipedia.org/w/index.php?title=Special:OAuth";
140
// use this for requests from the server, if some special url is needed.
141
$oauthBaseUrlInternal = "https://en.wikipedia.org/w/index.php?title=Special:OAuth";
142
143
$oauthMediaWikiCanonicalServer = "http://en.wikipedia.org";
144
145
$useOauthSignup = true;
146
$enforceOAuth = false;
147
148
// Password for the creation bot when this is used in place of OAuth
149
$creationBotUsername = '';
150
$creationBotPassword = '';
151
152
/************************************
153
 * Providers Configuration
154
 */
155
156
// IP GeoLocation
157
// ------------------------
158
// To set this up, change the class to "IpLocationProvider", and put *your* ipinfodb API key in.
159
// You'll need to sign up at IpInfoDb.com to get an API key - it's free.
160
$locationProviderClass = "FakeLocationProvider";
161
$locationProviderApiKey = "super secret"; // ipinfodb api key
162
163
// RDNS Provider ( RDnsLookupProvider / CachedRDnsLookupProvider / FakeRDnsLookupProvider)
164
$rdnsProviderClass = "CachedRDnsLookupProvider";
165
166
$antispoofProviderClass = "FakeAntiSpoofProvider";
167
$xffTrustProviderClass = "XffTrustProvider";
168
169
/***********************************
170
 * Data clear script
171
 */
172
173
$dataclear_interval = '15 DAY';
174
175
/***********************************
176
 * Other stuff that doesn't fit in.
177
 */
178
179
$enableSQLError = 0; // Enable the display of SQL errors.
180
$enableTitleblacklist = 0; // Enable Title Blacklist checks.
181
182
// Enable the use of PATH_INFO for request parameters to prettify URLs.
183
$usePathInfo = true;
184
185
// user agent of the tool.
186
$toolUserAgent = "Wikipedia-ACC Tool/0.1 (+https://accounts.wmflabs.org/internal.php/team)";
187
188
// list of squid proxies requests go through.
189
$squidIpList = array();
190
191
// request states
192
$availableRequestStates = array(
193
    'Open'          => array(
194
        'defertolog' => 'users', // don't change or you'll break old logs
195
        'deferto'    => 'users',
196
        'header'     => 'Open requests',
197
        'api'        => "open",
198
        'queuehelp'  => null
199
    ),
200
    'Flagged users' => array(
201
        'defertolog' => 'flagged users', // don't change or you'll break old logs
202
        'deferto'    => 'flagged users',
203
        'header'     => 'Flagged user needed',
204
        'api'        => "admin",
205
        'queuehelp'  => 'This queue lists the requests which require a user with the <code>accountcreator</code> flag to create.<br />If creation is determined to be the correct course of action, requests here will require the overriding the AntiSpoof checks or the title blacklist in order to create. It is recommended to try to create the account <em>without</em> checking the flags to validate the results of the AntiSpoof and/or title blacklist hits.'
206
    ),
207
    'Checkuser'     => array(
208
        'defertolog' => 'checkusers', // don't change or you'll break old logs
209
        'deferto'    => 'checkusers',
210
        'header'     => 'Checkuser needed',
211
        'api'        => "checkuser",
212
        'queuehelp'  => null
213
    ),
214
);
215
216
$defaultRequestStateKey = 'Open';
217
218
$providerCacheExpiry = $dataclear_interval;
219
220
// miser mode
221
$requestLimitShowOnly = 25;
222
223
// Enables the Smarty debugging console. This should only be used for development and even then
224
// be left false when you don't need it, since this will open a popup window on every page load.
225
$smartydebug = false;
226
227
// ID of the Email template used for the main "Created!" close reason.
228
$createdid = 1;
229
230
// HSTS expiry - use false to disable header.
231
$strictTransportSecurityExpiry = false;
232
233
// CSP violation report URI
234
$cspReportUri = null;
235
236
// Must be disabled in production.
237
$enableErrorTrace = false;
238
$enableCssBreakpoints = false;
239
240
// Dangerous.
241
// Don't set this.
242
// Definitely don't set this if there's sensitive data stored here you care about such as OAuth credentials.
243
$curlDisableSSLVerifyPeer = false;
244
245
// Change this to be outside the web directory.
246
$curlCookieJar = __DIR__ . '/../cookies.txt';
247
248
$yubicoApiId = 0;
249
$yubicoApiKey = "";
250
251
$totpEncryptionKey = "1234";
252
253
// external resource cache epoch value. Bump me to force clients to reload assets
254
$resourceCacheEpoch = 1;
255
256
$commonEmailDomains = ['gmail.com', 'hotmail.com', 'outlook.com'];
257
258
// limit for block/drop ban actions
259
$banMaxIpBlockRange = [4 => 20, 6 => 48];
260
// limit for *all* ban actions, including block/drop.
261
$banMaxIpRange = [4 => 16, 6 => 32];
262
263
$jobQueueBatchSize = 10;
264
265
/**************************************************************************
266
 **********                   IMPORTANT NOTICE                    **********
267
 ***************************************************************************
268
 **     DON'T ADD ANY NEW CONFIGURATION OPTIONS BELOW THIS LINE!!!        **
269
 **     THEY WILL NOT BE CHANGABLE BY THE LOCAL CONFIGURATION FILE.       **
270
 ***************************************************************************/
271
272
// Retriving the local configuration file.
273
require_once('config.local.inc.php');
274
275
$cDatabaseConfig = array(
276
    "acc"           => array(
277
        "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database,
278
        "username" => $toolserver_username,
279
        "password" => $toolserver_password,
280
        "options"  => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'),
281
    ),
282
);
283
284
// //Keep the included files from being executed.
285
define("ACC", 1);
286
287
// Sets the values of the cookie configuration options.
288
ini_set('session.cookie_path', $cookiepath);
289
ini_set('session.name', $sessionname);
290
ini_set('user_agent', $toolUserAgent);
291
292
foreach (array(
293
    "mbstring", // unicode and stuff
294
    "pdo",
295
    "pdo_mysql", // new database module
296
    "session",
297
    "date",
298
    "pcre", // core stuff
299
    "curl", // mediawiki api access etc
300
    "openssl", // token generation
301
) as $x) {
302
    if (!extension_loaded($x)) {
303
        die("extension $x is required.");
304
    }
305
}
306
307
// Set up the AutoLoader
308
require_once(__DIR__ . "/includes/AutoLoader.php");
309
spl_autoload_register('Waca\\AutoLoader::load');
310
require_once(__DIR__ . '/vendor/autoload.php');
311
312
// Crap that's needed for libraries. >:(
313
/**
314
 * Don't use me. I'm only here because the MediaWiki OAuth library we're using requires it.
315
 *
316
 * @param $section
317
 * @param $message
318
 */
319
function wfDebugLog($section, $message)
320
{
321
}
322
323
// Initialise the site configuration object
324
/** @noinspection PhpFullyQualifiedNameUsageInspection */
325
$siteConfiguration = new \Waca\SiteConfiguration();
326
327
$siteConfiguration->setBaseUrl($baseurl)
0 ignored issues
show
Deprecated Code introduced by
The function Waca\SiteConfiguration::...aultCreatedTemplateId() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

327
/** @scrutinizer ignore-deprecated */ $siteConfiguration->setBaseUrl($baseurl)
Loading history...
Deprecated Code introduced by
The function Waca\SiteConfiguration::...efaultRequestStateKey() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

327
/** @scrutinizer ignore-deprecated */ $siteConfiguration->setBaseUrl($baseurl)
Loading history...
Deprecated Code introduced by
The function Waca\SiteConfiguration::setRequestStates() has been deprecated: To be removed after dynamic queues hit production. This will need to be major point release. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

327
/** @scrutinizer ignore-deprecated */ $siteConfiguration->setBaseUrl($baseurl)

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
328
    ->setFilePath(__DIR__)
329
    ->setDebuggingTraceEnabled($enableErrorTrace)
330
    ->setDebuggingCssBreakpointsEnabled($enableCssBreakpoints)
331
    ->setForceIdentification($forceIdentification)
332
    ->setIdentificationCacheExpiry($identificationCacheExpiry)
333
    ->setMediawikiScriptPath($mediawikiScriptPath)
334
    ->setMediawikiWebServiceEndpoint($mediawikiWebServiceEndpoint)
335
    ->setMetaWikimediaWebServiceEndpoint($metaWikimediaWebServiceEndpoint)
336
    ->setEnforceOAuth($enforceOAuth)
337
    ->setEmailConfirmationEnabled($enableEmailConfirm == 1)
338
    ->setEmailConfirmationExpiryDays($emailConfirmationExpiryDays)
339
    ->setMiserModeLimit($requestLimitShowOnly)
340
    ->setRequestStates($availableRequestStates)
341
    ->setSquidList($squidIpList)
342
    ->setDefaultCreatedTemplateId($createdid)
343
    ->setDefaultRequestStateKey($defaultRequestStateKey)
344
    ->setUseStrictTransportSecurity($strictTransportSecurityExpiry)
345
    ->setUserAgent($toolUserAgent)
346
    ->setCurlDisableVerifyPeer($curlDisableSSLVerifyPeer)
347
    ->setUseOAuthSignup($useOauthSignup)
348
    ->setOAuthBaseUrl($oauthBaseUrl)//
349
    ->setOAuthConsumerToken($oauthConsumerToken)
350
    ->setOAuthLegacyConsumerTokens($oauthLegacyTokens)
351
    ->setOAuthConsumerSecret($oauthSecretToken)
352
    ->setOauthMediaWikiCanonicalServer($oauthMediaWikiCanonicalServer)
353
    ->setDataClearInterval($dataclear_interval)
354
    ->setXffTrustedHostsFile($xff_trusted_hosts_file)
355
    ->setIrcNotificationsEnabled($ircBotNotificationsEnabled == 1)
356
    ->setIrcNotificationRoutingKey($ircBotNotificationRoutingKey)
357
    ->setIrcNotificationsInstance($whichami)
358
    ->setTitleBlacklistEnabled($enableTitleblacklist == 1)
359
    ->setTorExitPaths(array_merge(gethostbynamel('en.wikipedia.org'), gethostbynamel('accounts.wmflabs.org')))
360
    ->setCreationBotUsername($creationBotUsername)
361
    ->setCreationBotPassword($creationBotPassword)
362
    ->setCurlCookieJar($curlCookieJar)
363
    ->setYubicoApiId($yubicoApiId)
364
    ->setYubicoApiKey($yubicoApiKey)
365
    ->setTotpEncryptionKey($totpEncryptionKey)
366
    ->setRegistrationAllowed($allowRegistration)
367
    ->setCspReportUri($cspReportUri)
368
    ->setResourceCacheEpoch($resourceCacheEpoch)
369
    ->setLocationProviderApiKey($locationProviderApiKey)
370
    ->setCommonEmailDomains($commonEmailDomains)
371
    ->setBanMaxIpRange($banMaxIpRange)
372
    ->setBanMaxIpBlockRange($banMaxIpBlockRange)
373
    ->setJobQueueBatchSize($jobQueueBatchSize)
374
    ->setAmqpConfiguration($amqpConfiguration);
375