|
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
|
|
|
namespace Waca\ConsoleTasks; |
|
10
|
|
|
|
|
11
|
|
|
use Waca\DataObjects\Domain; |
|
12
|
|
|
use Waca\DataObjects\RequestQueue; |
|
13
|
|
|
use Waca\Tasks\ConsoleTaskBase; |
|
14
|
|
|
|
|
15
|
|
|
class MigrateToDomains extends ConsoleTaskBase |
|
16
|
|
|
{ |
|
17
|
|
|
public function execute() |
|
18
|
|
|
{ |
|
19
|
|
|
$siteConfiguration = $this->getSiteConfiguration(); |
|
20
|
|
|
|
|
21
|
|
|
/** @noinspection PhpDeprecationInspection */ |
|
22
|
|
|
$requestStates = $siteConfiguration->getRequestStates(); |
|
|
|
|
|
|
23
|
|
|
$database = $this->getDatabase(); |
|
24
|
|
|
|
|
25
|
|
|
$domain = new Domain(); |
|
26
|
|
|
$domain->setEnabled(true); |
|
27
|
|
|
$domain->setShortName('enwiki'); |
|
28
|
|
|
$domain->setLongName('English Wikipedia'); |
|
29
|
|
|
$domain->setWikiArticlePath($siteConfiguration->getMediawikiScriptPath()); |
|
30
|
|
|
$domain->setWikiApiPath($siteConfiguration->getMediawikiWebServiceEndpoint()); |
|
31
|
|
|
$domain->setEnabled(true); |
|
32
|
|
|
/** @noinspection PhpDeprecationInspection */ |
|
33
|
|
|
$domain->setDefaultClose($siteConfiguration->getDefaultCreatedTemplateId()); |
|
|
|
|
|
|
34
|
|
|
$domain->setDefaultLanguage('en'); |
|
35
|
|
|
$domain->setEmailSender('[email protected]'); |
|
36
|
|
|
$domain->setNotificationTarget($siteConfiguration->getIrcNotificationType()); |
|
37
|
|
|
|
|
38
|
|
|
$domain->setDatabase($database); |
|
39
|
|
|
$domain->save(); |
|
40
|
|
|
|
|
41
|
|
|
foreach ($requestStates as $key => $data) { |
|
42
|
|
|
$state = new RequestQueue(); |
|
43
|
|
|
|
|
44
|
|
|
/** @noinspection PhpDeprecationInspection */ |
|
45
|
|
|
if ($siteConfiguration->getDefaultRequestStateKey() === $key) { |
|
|
|
|
|
|
46
|
|
|
$state->setDefault(true); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** @noinspection PhpDeprecationInspection */ |
|
50
|
|
|
if ($siteConfiguration->getDefaultRequestDeferredStateKey() === $key) { |
|
|
|
|
|
|
51
|
|
|
$state->setDefaultAntispoof(true); |
|
52
|
|
|
$state->setDefaultTitleBlacklist(true); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
$state->setDomain($domain->getId()); |
|
56
|
|
|
$state->setApiName($data['api']); |
|
57
|
|
|
$state->setDisplayName($data['deferto']); |
|
58
|
|
|
$state->setHeader($data['header']); |
|
59
|
|
|
/** @noinspection PhpDeprecationInspection */ |
|
60
|
|
|
$state->setLogName($data['defertolog']); |
|
|
|
|
|
|
61
|
|
|
/** @noinspection PhpDeprecationInspection */ |
|
62
|
|
|
$state->setLegacyStatus($key); |
|
|
|
|
|
|
63
|
|
|
$state->setEnabled(true); |
|
64
|
|
|
|
|
65
|
|
|
if (isset($data['help'])) { |
|
66
|
|
|
$state->setHelp($data['help']); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
$state->setDatabase($database); |
|
70
|
|
|
$state->save(); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** @noinspection SqlWithoutWhere */ |
|
74
|
|
|
$database->exec("UPDATE schemaversion SET version = 37;"); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|
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.