Page MenuHomeMiraheze
Paste P298

(An Untitled Masterwork)
ActivePublic

Authored by Paladox on Apr 17 2020, 01:02.
Tags
None
Referenced Files
F1144668: raw.txt
Apr 17 2020, 01:16
F1144667: raw.txt
Apr 17 2020, 01:13
F1144665: raw.txt
Apr 17 2020, 01:08
F1144662: raw.txt
Apr 17 2020, 01:02
Subscribers
None
<?php
require_once __DIR__ . '/../../../maintenance/Maintenance.php';
class hackScript extends Maintenance {
public function __construct() {
parent::__construct();
}
public function execute() {
global $wgCreateWikiDatabase, $wgDBname;
$dbw = wfGetDB( DB_MASTER, [], $wgCreateWikiDatabase );
$res = $dbw->select(
'mw_settings',
'*',
[],
__METHOD__
);
if ( !$res || !is_object( $res ) ) {
throw new MWException( '$res was not set to a valid array.' );
}
foreach ( $res as $row ) {
if ( !is_null( $row->s_extensions ) ) {
$dbName = $row->s_dbname;
$extensionsArray = json_decode( $row->s_extensions, true );
$flow = $this->hasExtension( 'flow', $extensionsArray );
if ( $flow ) {
exec( "/usr/bin/php /srv/mediawiki/w/extensions/ManageWiki/maintenance/addNamespaces.php --wiki={$dbName} --id=2600 --name=Topic --searchable=1 --subpages=0 --protection='' --content=0 --contentmodel=flow-board --core=1" );
exec( "/usr/bin/php /srv/mediawiki/w/extensions/ManageWiki/maintenance/addNamespaces.php --wiki={$dbName} --id=2601 --name=Topic_talk --searchable=0 --subpages=0 --protection='' --content=0 --contentmodel=wikitext --core=1" );
}
}
}
}
private function hasExtension( $extension, $extensionsarray ) {
return in_array( $extension, (array)$extensionsarray );
}
}
$maintClass = 'hackScript';
require_once RUN_MAINTENANCE_IF_MAIN;