Page MenuHomeMiraheze
Paste P195

(An Untitled Masterwork)
ActivePublic

Authored by Paladox on Apr 27 2019, 22:12.
Tags
None
Referenced Files
F941078: raw.txt
Apr 27 2019, 22:12
Subscribers
None
<?php
$IP = getenv( 'MW_INSTALL_PATH' );
if ( $IP === false ) {
$IP = __DIR__ . '/../../..';
}
require_once "$IP/maintenance/Maintenance.php";
class ManageWikiQuickHackScript extends Maintenance {
public function __construct() {
parent::__construct();
}
function execute() {
global $wgCreateWikiDatabase, $wgDBname, $wmgPrivateWiki;
if ( ManageWiki::checkSetup( 'permissions' ) && $wmgPrivateWiki ) {
$dbw = wfGetDB( DB_MASTER, [], $wgCreateWikiDatabase );
$publicGroups = [ '*', 'user' ];
foreach ( $publicGroups as $group ) {
$meta = ManageWikiPermissions::groupPermissions( $group );
$perms = $meta['permissions'];
$newperms = array_diff( $perms, [ 'read' ] );
$dbw->update(
'mw_permissions',
[
'perm_permissions' => json_encode( $newperms )
],
[
'perm_dbname' => $dbname,
'perm_group' => $group
],
__METHOD__
);
}
$this->output( 'removed read from wiki ' $wgDBname );
ManageWikiCDB::changes( 'permissions' );
}
}
}
$maintClass = 'ManageWikiQuickHackScript';
require_once RUN_MAINTENANCE_IF_MAIN;