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

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

321
function wfDebugLog(/** @scrutinizer ignore-unused */ $section, $message)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $message is not used and could be removed. ( Ignorable by Annotation )

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

321
function wfDebugLog($section, /** @scrutinizer ignore-unused */ $message)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
322
{
323
}
324
325
// Initialise the site configuration object
326
/** @noinspection PhpFullyQualifiedNameUsageInspection */
327
$siteConfiguration = new \Waca\SiteConfiguration();
0 ignored issues
show
The type Waca\SiteConfiguration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
328
329
$siteConfiguration->setBaseUrl($baseurl)
330
    ->setFilePath(__DIR__)
331
    ->setDebuggingTraceEnabled($enableErrorTrace)
332
    ->setForceIdentification($forceIdentification)
333
    ->setIdentificationCacheExpiry($identificationCacheExpiry)
334
    ->setMediawikiScriptPath($mediawikiScriptPath)
335
    ->setMediawikiWebServiceEndpoint($mediawikiWebServiceEndpoint)
336
    ->setMetaWikimediaWebServiceEndpoint($metaWikimediaWebServiceEndpoint)
337
    ->setEnforceOAuth($enforceOAuth)
338
    ->setEmailConfirmationEnabled($enableEmailConfirm == 1)
339
    ->setEmailConfirmationExpiryDays($emailConfirmationExpiryDays)
340
    ->setMiserModeLimit($requestLimitShowOnly)
341
    ->setRequestStates($availableRequestStates)
342
    ->setSquidList($squidIpList)
343
    ->setDefaultCreatedTemplateId($createdid)
344
    ->setDefaultRequestStateKey($defaultRequestStateKey)
345
    ->setUseStrictTransportSecurity($strictTransportSecurityExpiry)
346
    ->setUserAgent($toolUserAgent)
347
    ->setCurlDisableVerifyPeer($curlDisableSSLVerifyPeer)
348
    ->setUseOAuthSignup($useOauthSignup)
349
    ->setOAuthBaseUrl($oauthBaseUrl)
350
    ->setOAuthConsumerToken($oauthConsumerToken)
351
    ->setOAuthConsumerSecret($oauthSecretToken)
352
    ->setOauthMediaWikiCanonicalServer($oauthMediaWikiCanonicalServer)
353
    ->setDataClearInterval($dataclear_interval)
354
    ->setXffTrustedHostsFile($xff_trusted_hosts_file)
355
    ->setIrcNotificationsEnabled($ircBotNotificationsEnabled == 1)
356
    ->setIrcNotificationType($ircBotNotificationType)
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