Page MenuHomeMiraheze
Paste P128

(An Untitled Masterwork)
ActivePublic

Authored by Paladox on Oct 26 2018, 02:23.
Tags
None
Referenced Files
F859574:
Oct 26 2018, 02:27
F859573:
Oct 26 2018, 02:25
F859572:
Oct 26 2018, 02:25
F859571:
Oct 26 2018, 02:23
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 edited the content of this paste. (Show Details)