-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSiteCustomCode_Unused.php
70 lines (53 loc) · 2.02 KB
/
SiteCustomCode_Unused.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
<?php
/* These functions were unused at the time of conversion. They've been left in this file for reference should we need them in the future. */
function SetUespMapSessionData()
{
//Note: This is no longer needed/used
global $_SESSION, $wgUser;
// TODO: Unsure when we have to migrate to the new session object (should have been 1.27/28)
//$session = \MediaWiki\Session\SessionManager::getGlobalSession();
$_SESSION['UESP_AllMap_canEdit'] = 0;
$_SESSION['UESP_EsoMap_canEdit'] = 0;
$_SESSION['UESP_TRMap_canEdit'] = 0;
$_SESSION['UESP_OtherMap_canEdit'] = 0;
//$session->set('UESP_AllMap_canEdit', 0);
//$session->set('UESP_EsoMap_canEdit', 0);
//$session->set('UESP_TRMap_canEdit', 0);
//$session->set('UESP_OtherMap_canEdit', 0);
if ($wgUser == null) return;
if ($wgUser->isAllowed('esomapedit')) {
$_SESSION['UESP_EsoMap_canEdit'] = 1;
//$session->set('UESP_EsoMap_canEdit', 1);
}
if ($wgUser->isAllowed('mapedit') || $wgUser->isAllowed('othermapedit')) {
$_SESSION['UESP_OtherMap_canEdit'] = 1;
//$session->set('UESP_OtherMap_canEdit', 1);
}
if ($wgUser->isAllowed('trmapedit')) {
$_SESSION['UESP_TRMap_canEdit'] = 1;
//$session->set('UESP_TRMap_canEdit', 1);
}
}
function onSearchGetNearMatchBefore($allSearchTerms, &$title)
{
$title = Title::newFromText($allSearchTerms[0]); // Look for exact match before trying alternates
if ($title->exists()) {
return false; // false = match
}
$title = Title::newFromText(preg_replace('/\beso\b/i', 'Online', $allSearchTerms[0]));
if ($title->exists()) {
return false; // false = match
}
$title = Title::newFromText(preg_replace('/\beso\b/i', 'online', $allSearchTerms[0]));
return !$title->exists();
}
function onSpecialSearchCreateLink($t, &$params)
{
$params[1] = preg_replace('/\((ESO) OR online\)/i', '$1', $params[1]);
return true;
}
// group pages appear under at Special:SpecialPages
// $wgSpecialPageGroups['Preferences'] = 'users';
// $wgSpecialPageGroups['Search'] = 'redirects';
// $wgSpecialPageGroups['Wantedpages'] = 'maintenance';
return true;