mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Nuke
synced 2024-11-15 03:35:39 +00:00
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:
parent
77a9707ecd
commit
94a3043d0d
|
@ -343,6 +343,7 @@ class SpecialNuke extends SpecialPage {
|
||||||
*/
|
*/
|
||||||
protected function doDelete( array $pages, $reason ) {
|
protected function doDelete( array $pages, $reason ) {
|
||||||
$res = [];
|
$res = [];
|
||||||
|
$user = $this->getUser();
|
||||||
|
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
$localRepo = $services->getRepoGroup()->getLocalRepo();
|
$localRepo = $services->getRepoGroup()->getLocalRepo();
|
||||||
|
@ -360,14 +361,13 @@ class SpecialNuke extends SpecialPage {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->getUser();
|
|
||||||
$file = $title->getNamespace() === NS_FILE ? $localRepo->newFile( $title ) : false;
|
|
||||||
$permission_errors = $permissionManager->getPermissionErrors( 'delete', $user, $title );
|
$permission_errors = $permissionManager->getPermissionErrors( 'delete', $user, $title );
|
||||||
|
|
||||||
if ( $permission_errors !== [] ) {
|
if ( $permission_errors !== [] ) {
|
||||||
throw new PermissionsError( 'delete', $permission_errors );
|
throw new PermissionsError( 'delete', $permission_errors );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$file = $title->getNamespace() === NS_FILE ? wfLocalFile( $title ) : false;
|
||||||
if ( $file ) {
|
if ( $file ) {
|
||||||
$oldimage = null; // Must be passed by reference
|
$oldimage = null; // Must be passed by reference
|
||||||
$status = FileDeleteForm::doDelete(
|
$status = FileDeleteForm::doDelete(
|
||||||
|
@ -390,8 +390,11 @@ class SpecialNuke extends SpecialPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getOutput()->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $res ) .
|
$this->getOutput()->addHTML(
|
||||||
"</li>\n</ul>\n" );
|
"<ul>\n<li>" .
|
||||||
|
implode( "</li>\n<li>", $res ) .
|
||||||
|
"</li>\n</ul>\n"
|
||||||
|
);
|
||||||
$this->getOutput()->addWikiMsg( 'nuke-delete-more' );
|
$this->getOutput()->addWikiMsg( 'nuke-delete-more' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue