Skip to content

Commit

Permalink
add reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnFLewis committed Nov 12, 2018
1 parent ac5c8b7 commit 70d3de3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions includes/SpecialManageWikiPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ function buildMainView() {

$createForm = HTMLForm::factory( 'ooui', $createDescriptor, $this->getContext() );
$createForm->setMethod( 'post' )->setFormIdentifier( 'createForm' )->setSubmitCallback( [ $this, 'onSubmitRedirectToPermissionsPage' ] ) ->prepareForm()->show();

$out->addWikiMsg( 'managewiki-perm-resetgroups-header' );

$resetForm = HTMLForm::factory( 'ooui', [], $this->getContext() );
$resetForm->setMethod( 'post' )->setFormIdentifier( 'resetform' )->setSubmitTextMsg( 'managewiki-perm-resetgroups' )->setSubmitDestructive()->setSubmitCallback( [ $this, 'onSubmitResetForm' ] )->prepareForm()->show();
}
}

Expand All @@ -80,6 +85,24 @@ function onSubmitRedirectToPermissionsPage( array $params ) {
return true;
}

function onSubmitResetForm( $formData ) {
global $wgDBname, $wmgPrivateWiki;

$dbw = wfGetDB( DB_MASTER, [], $wgCreateWikiDatabase );

This comment has been minimized.

Copy link
@paladox

paladox Nov 12, 2018

Contributor

You forgot to add wgCreateWikiDatabase to global.


$dbw->delete(
'mw_permissions',
[
'perm_dbname' => $wgDBname
],
__METHOD__
);

ManageWikiHooks::onCreateWikiCreation( $wgDBname, $wmgPrivateWiki );

return true;
}

static function validateNewGroupName( $newGroup, $nullForm ) {
global $wgManageWikiPermissionsBlacklistGroups;

Expand Down

0 comments on commit 70d3de3

Please sign in to comment.