|
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
|
|
|
$requestStates = $this->getSiteConfiguration()->getRequestStates(); |
|
|
|
|
|
|
20
|
|
|
$database = $this->getDatabase(); |
|
21
|
|
|
|
|
22
|
|
|
$domain = new Domain(); |
|
23
|
|
|
$domain->setEnabled(true); |
|
24
|
|
|
$domain->setShortName('enwiki'); |
|
25
|
|
|
$domain->setLongName('English Wikipedia'); |
|
26
|
|
|
$domain->setWikiArticlePath($this->getSiteConfiguration()->getMediawikiScriptPath()); |
|
27
|
|
|
$domain->setWikiApiPath($this->getSiteConfiguration()->getMediawikiWebServiceEndpoint()); |
|
28
|
|
|
$domain->setEnabled(true); |
|
29
|
|
|
$domain->setDefaultClose($this->getSiteConfiguration()->getDefaultCreatedTemplateId()); |
|
30
|
|
|
$domain->setDefaultLanguage('en'); |
|
31
|
|
|
$domain->setEmailSender('[email protected]'); |
|
32
|
|
|
$domain->setNotificationTarget($this->getSiteConfiguration()->getIrcNotificationType()); |
|
33
|
|
|
|
|
34
|
|
|
$domain->setDatabase($database); |
|
35
|
|
|
$domain->save(); |
|
36
|
|
|
|
|
37
|
|
|
$first = true; |
|
38
|
|
|
foreach ($requestStates as $key => $data) { |
|
39
|
|
|
$state = new RequestQueue(); |
|
40
|
|
|
$state->setDefault($first); |
|
41
|
|
|
$state->setDefaultAntispoof($first); |
|
42
|
|
|
$state->setDefaultTitleBlacklist($first); |
|
43
|
|
|
$state->setDomain($domain->getId()); |
|
44
|
|
|
$state->setApiName($data['api']); |
|
45
|
|
|
$state->setDisplayName($data['deferto']); |
|
46
|
|
|
$state->setHeader($data['header']); |
|
47
|
|
|
$state->setLogName($data['defertolog']); |
|
|
|
|
|
|
48
|
|
|
$state->setLegacyStatus($key); |
|
|
|
|
|
|
49
|
|
|
$state->setEnabled(true); |
|
50
|
|
|
|
|
51
|
|
|
if (isset($data['help'])) { |
|
52
|
|
|
$state->setHelp($data['help']); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
$state->setDatabase($database); |
|
56
|
|
|
$state->save(); |
|
57
|
|
|
|
|
58
|
|
|
$first = false; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** @noinspection SqlWithoutWhere */ |
|
62
|
|
|
$database->exec("UPDATE schemaversion SET version = 37;"); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|