Minor cleanup to SpecialNuke::doDelete

Don't re-fetch the context user each time
through a loop.

Change-Id: I0a9c414da4cb0cec686e1e91b5d0babe055925a6
This commit is contained in:
DannyS712 2020-03-07 08:05:47 +00:00 committed by DannyS712
parent 77a9707ecd
commit 94a3043d0d

View file

@ -343,6 +343,7 @@ class SpecialNuke extends SpecialPage {
*/
protected function doDelete( array $pages, $reason ) {
$res = [];
$user = $this->getUser();
$services = MediaWikiServices::getInstance();
$localRepo = $services->getRepoGroup()->getLocalRepo();
@ -360,14 +361,13 @@ class SpecialNuke extends SpecialPage {
continue;
}
$user = $this->getUser();
$file = $title->getNamespace() === NS_FILE ? $localRepo->newFile( $title ) : false;
$permission_errors = $permissionManager->getPermissionErrors( 'delete', $user, $title );
if ( $permission_errors !== [] ) {
throw new PermissionsError( 'delete', $permission_errors );
}
$file = $title->getNamespace() === NS_FILE ? wfLocalFile( $title ) : false;
if ( $file ) {
$oldimage = null; // Must be passed by reference
$status = FileDeleteForm::doDelete(
@ -390,8 +390,11 @@ class SpecialNuke extends SpecialPage {
}
}
$this->getOutput()->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $res ) .
"</li>\n</ul>\n" );
$this->getOutput()->addHTML(
"<ul>\n<li>" .
implode( "</li>\n<li>", $res ) .
"</li>\n</ul>\n"
);
$this->getOutput()->addWikiMsg( 'nuke-delete-more' );
}