diff --git a/i18n/en.json b/i18n/en.json index 8a9d5eb8..ca52cb69 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -21,6 +21,7 @@ "nuke-maxpages": "Maximum number of pages:", "nuke-editby": "Created by [[Special:Contributions/$1|{{GENDER:$1|$1}}]]", "nuke-deleted": "Page '''$1''' has been deleted.", + "nuke-deletion-queued": "Page '''$1''' has been queued for deletion.", "nuke-not-deleted": "Page [[:$1]] '''could not''' be deleted.", "nuke-delete-more": "[[Special:Nuke|Delete more pages]]", "nuke-pattern": "SQL LIKE pattern (e.g. %) for the page name:", diff --git a/i18n/qqq.json b/i18n/qqq.json index 37f66801..784b2671 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -32,6 +32,7 @@ "nuke-maxpages": "Used as label for \"nuke limit\" input box.", "nuke-editby": "This message is followed by {{msg-mw|Comma-separator}} and {{msg-mw|Nuke-viewchanges}}.\n\nParameters:\n* $1 - a username", "nuke-deleted": "Used as success result of deletion. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Nuke-not-deleted}}", + "nuke-deletion-queued": "Used when the page is queued for deletion. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Nuke-deleted}}", "nuke-not-deleted": "Used as failure result of deletion. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Nuke-deleted}}", "nuke-delete-more": "Used at the bottom of the Nuke (mass deletion) result page.", "nuke-pattern": "Used as label for \"nuke pattern\" input box.", diff --git a/includes/SpecialNuke.php b/includes/SpecialNuke.php index 535c88d7..50f98dbc 100644 --- a/includes/SpecialNuke.php +++ b/includes/SpecialNuke.php @@ -2,6 +2,7 @@ namespace MediaWiki\Extension\Nuke; +use DeletePageJob; use FileDeleteForm; use Html; use HTMLForm; @@ -14,7 +15,6 @@ use Title; use User; use UserBlockedError; use UserNamePrefixSearch; -use WikiPage; use Xml; class SpecialNuke extends SpecialPage { @@ -343,6 +343,7 @@ class SpecialNuke extends SpecialPage { */ protected function doDelete( array $pages, $reason ) { $res = []; + $jobs = []; $user = $this->getUser(); $services = MediaWikiServices::getInstance(); @@ -379,17 +380,29 @@ class SpecialNuke extends SpecialPage { $user ); } else { - $status = WikiPage::factory( $title ) - ->doDeleteArticleReal( $reason, $user ); + $job = new DeletePageJob( [ + 'namespace' => $title->getNamespace(), + 'title' => $title->getId(), + 'reason' => $reason, + 'userId' => $user->getId() + ] ); + $jobs[] = $job; + $status = 'job'; } - if ( $status->isOK() ) { + if ( $status == 'job' ) { + $res[] = $this->msg( 'nuke-deletion-queued', $title->getPrefixedText() )->parse(); + } elseif ( $status->isOK() ) { $res[] = $this->msg( 'nuke-deleted', $title->getPrefixedText() )->parse(); } else { $res[] = $this->msg( 'nuke-not-deleted', $title->getPrefixedText() )->parse(); } } + if ( $jobs ) { + MediaWikiServices::getInstance()->getJobQueueGroup()->push( $jobs ); + } + $this->getOutput()->addHTML( "