Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"action-createwiki-suppressrequest": "suppress wiki requests",
"action-requestwiki": "request wikis",
"createwiki": "Create a wiki",
"createwiki-close-email-body": "Hello,\n\nThis email is to inform you that your wiki has been closed.",
"createwiki-close-email-body": "Hello,\n\nThis email is to inform you that your wiki ([$2 $3]) has been closed.",
"createwiki-close-email-sender": "noreply",
"createwiki-close-email-subject": "Your wiki ($1) has been closed",
"createwiki-comment-success": "Comment successfully added to this request.",
Expand Down
2 changes: 1 addition & 1 deletion i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"action-createwiki-suppressrequest": "{{doc-action|createwiki-suppressrequest}}",
"action-requestwiki": "{{doc-action|requestwiki}}",
"createwiki": "{{doc-special}}",
"createwiki-close-email-body": "Email body sent to the user when their wiki is closed.",
"createwiki-close-email-body": "Email body sent to the user when their wiki is closed.\n\nParameters:\n* $1: The database name of the wiki (e.g. metawiki)\n* $2: The URL to the wiki (e.g. meta.example.com)\n* $3: The sitename of the wiki",
"createwiki-close-email-sender": "{{optional}}",
"createwiki-close-email-subject": "Subject of the email sent when a wiki is closed.",
"createwiki-comment-success": "Success message displayed when a comment is added to a wiki request.",
Expand Down
24 changes: 19 additions & 5 deletions maintenance/ManageInactiveWikis.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function checkLastActivity(
if ( $lastActivityTimestamp < date( 'YmdHis', strtotime( "-{$closeTime} days" ) ) ) {
if ( $canWrite ) {
$remoteWiki->markClosed();
$this->notifyBureaucrats( $dbname );
$this->notifyBureaucrats( $dbname, $remoteWiki );
$this->output( "{$dbname} has been closed. Last activity: {$lastActivityTimestamp}\n" );
} else {
$this->output( "{$dbname} should be closed. Last activity: {$lastActivityTimestamp}\n" );
Expand Down Expand Up @@ -154,7 +154,7 @@ private function handleInactiveWiki(
if ( $isInactive && $inactiveTimestamp < date( 'YmdHis', strtotime( "-{$closeDays} days" ) ) ) {
if ( $canWrite ) {
$remoteWiki->markClosed();
$this->notifyBureaucrats( $dbname );
$this->notifyBureaucrats( $dbname, $remoteWiki );
$this->output(
"{$dbname} was marked as inactive on {$inactiveTimestamp} and is now closed. " .
"Last activity: {$lastActivityTimestamp}.\n"
Expand Down Expand Up @@ -203,13 +203,27 @@ private function handleClosedWiki(
}
}

private function notifyBureaucrats( string $dbname ): void {
private function notifyBureaucrats( string $dbname, RemoteWikiFactory $remoteWiki ): void {
Comment thread
The-Voidwalker marked this conversation as resolved.
Outdated
$url = $remoteWiki->getServerName();
Comment thread
BlankEclair marked this conversation as resolved.
Outdated
if ( $url === '' ) {
$baseDomain = $this->getConfig()->get( ConfigNames::Subdomain );
$databaseSuffix = $this->getConfig()->get( ConfigNames::DatabaseSuffix );
$subdomain = substr( $dbname, 0, -strlen( $databaseSuffix ) );
$url = "https://{$subdomain}.{$baseDomain}";
}

$body = wfMessage( 'createwiki-close-email-body', $dbname, $url, $remoteWiki->getSitename() )
->inContentLanguage();

$notificationData = [
'type' => 'closure',
'subject' => wfMessage( 'createwiki-close-email-subject', $dbname )->inContentLanguage()->text(),
'body' => [
'html' => wfMessage( 'createwiki-close-email-body' )->inContentLanguage()->parse(),
'text' => wfMessage( 'createwiki-close-email-body' )->inContentLanguage()->text(),
'html' => $body->parse(),
// Yes, this sends out the wikitext if the user is reading plaintext emails by default.
// However, I anticipate that those who are would be able to read (or at least glean the
// URLs from) the wikitext, especially if they are the bureaucrat of a wiki.
'text' => $body->text(),
],
];

Expand Down