Page Menu
Home
Miraheze
Search
Configure Global Search
Log In
Paste
P128
(An Untitled Masterwork)
Active
Public
Actions
Authored by
Paladox
on Oct 26 2018, 02:23.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F859574:
Oct 26 2018, 02:27
2018-10-26 02:27:58 (UTC+0)
F859573:
Oct 26 2018, 02:25
2018-10-26 02:25:49 (UTC+0)
F859572:
Oct 26 2018, 02:25
2018-10-26 02:25:11 (UTC+0)
F859571:
Oct 26 2018, 02:23
2018-10-26 02:23:33 (UTC+0)
Subscribers
None
<?php
require_once
__DIR__
.
'/srv/mediawiki/w/maintenance/Maintenance.php'
;
class
MirahezeQuickDbScript
extends
Maintenance
{
public
function
__construct
()
{
parent
::
__construct
();
}
public
function
execute
()
{
global
$wgCreateWikiDBDirectory
,
$wgCreateWikiDatabase
;
$dbw
=
wfGetDB
(
DB_MASTER
,
[],
$wgCreateWikiDatabase
);
$res
=
$dbw
->
select
(
'cw_wikis'
,
'*'
,
array
(),
__METHOD__
);
if
(
!
$res
||
!
is_object
(
$res
)
)
{
throw
new
MWException
(
'$res was not set to a valid array.'
);
}
$allWikis
=
array
();
$privateWikis
=
array
();
$closedWikis
=
array
();
$inactiveWikis
=
array
();
foreach
(
$res
as
$row
)
{
$DBname
=
$row
->
wiki_dbname
;
$private
=
$row
->
wiki_private
;
$newname
=
'["autocreateaccount","createaccount","read","edit","createpage","createtalk", "writeapi","viewmywatchlist","editmywatchlist","viewmyprivateinfo", "editmyprivateinfo","editmyoptions","abusefilter-log","abusefilter-log-detail", "abusefilter-view","centralauth-autoaccount","centralauth-merge", "oathauth-enable"]'
;
if
(
$private
!==
"1"
)
{
$dbw
=
wfGetDB
(
DB_MASTER
,
[],
"mhglobal"
);
$dbw
->
update
(
'mw_permissions'
,
[
'perm_permissions'
=>
$newname
],
[
'perm_wiki'
=>
$DBname
,
'perm_group'
=>
"*"
,
'perm_permissions'
=
'perm_permissions'
],
__METHOD__
);
}
}
}
}
$maintClass
=
'MirahezeQuickDbScript'
;
require_once
RUN_MAINTENANCE_IF_MAIN
;
Event Timeline
Paladox
created this paste.
Oct 26 2018, 02:23
2018-10-26 02:23:33 (UTC+0)
Paladox
edited the content of this paste.
(Show Details)
Paladox
edited the content of this paste.
(Show Details)
Oct 26 2018, 02:25
2018-10-26 02:25:49 (UTC+0)
Paladox
edited the content of this paste.
(Show Details)
Oct 26 2018, 02:27
2018-10-26 02:27:58 (UTC+0)
Log In to Comment