Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/76474
Change subject: Add a new Special:MassMessageStatus page, which shows how many
jobs are queued
......................................................................
Add a new Special:MassMessageStatus page, which shows how many jobs are queued
Change-Id: Iab149c296b1a484f6a0cf123d05ef3b9cb716ee6
---
M MassMessage.alias.php
M MassMessage.i18n.php
M MassMessage.php
A SpecialMassMessageStatus.php
4 files changed, 29 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage
refs/changes/74/76474/1
diff --git a/MassMessage.alias.php b/MassMessage.alias.php
index 29a121a..abaea3f 100644
--- a/MassMessage.alias.php
+++ b/MassMessage.alias.php
@@ -11,4 +11,5 @@
/** English (English) */
$specialPageAliases['en'] = array(
'MassMessage' => array( 'MassMessage' ),
-);
\ No newline at end of file
+ 'MassMessageStatus' => array( 'MassMessageStatus' ),
+);
diff --git a/MassMessage.i18n.php b/MassMessage.i18n.php
index c3de09f..c87b794 100644
--- a/MassMessage.i18n.php
+++ b/MassMessage.i18n.php
@@ -29,6 +29,8 @@
'massmessage-spamlist-doesnotexist' => 'The specified page-list page
does not exist.',
'massmessage-empty-subject' => 'The subject line is empty.',
'massmessage-empty-message' => 'The message body is empty.',
+ 'massmessage-status' => 'There are currently $1 queued messages.',
+ 'massmessagestatus' => 'Mass message status',
'massmessage-form-header' => 'Use the form below to send messages to a
specified list. All fields are required.',
'right-massmessage' => 'Send a message to multiple users at once',
'action-massmessage' => 'send a message to multiple users at once',
@@ -68,6 +70,8 @@
This message probably means "The specified page which contains list of pages,
does not exist".',
'massmessage-empty-subject' => 'Error message the user sees if the
"subject" field is empty.',
'massmessage-empty-message' => 'Error message the user sees if the
"message" field is empty.',
+ 'massmessage-status' => 'Used on Special:MassMessage to indicate how
many queued jobs are left. $1 is the number of jobs.',
+ 'massmessagestatus' => '{{doc-special|MassMessageStatus}}',
'massmessage-form-header' => 'Introduction text at the top of the
form.',
'right-massmessage' => '{{doc-right|massmessage}}
See also:
diff --git a/MassMessage.php b/MassMessage.php
index 93b7808..c2e9407 100644
--- a/MassMessage.php
+++ b/MassMessage.php
@@ -52,10 +52,12 @@
$dir = dirname(__FILE__);
$wgSpecialPages[ 'MassMessage' ] = 'SpecialMassMessage';
+$wgSpecialPages['MassMessageStatus'] = 'SpecialMassMessageStatus';
$wgExtensionMessagesFiles['MassMessage'] = "$dir/MassMessage.i18n.php";
$wgExtensionMessagesFiles['MassMessageAlias'] = "$dir/MassMessage.alias.php";
$wgAutoloadClasses['MassMessage'] = "$dir/MassMessage.body.php";
$wgAutoloadClasses['SpecialMassMessage'] = "$dir/SpecialMassMessage.php";
+$wgAutoloadClasses['SpecialMassMessageStatus'] =
"$dir/SpecialMassMessageStatus.php";
$wgAutoloadClasses['MassMessageJob'] = "$dir/MassMessageJob.php";
$wgJobClasses['massmessageJob'] = 'MassMessageJob';
diff --git a/SpecialMassMessageStatus.php b/SpecialMassMessageStatus.php
new file mode 100644
index 0000000..3e3add4
--- /dev/null
+++ b/SpecialMassMessageStatus.php
@@ -0,0 +1,21 @@
+<?php
+class SpecialMassMessageStatus extends SpecialPage {
+ function __construct() {
+ parent::__construct( 'MassMessageStatus' );
+ }
+
+ function execute( $par ) {
+ $this->setHeaders();
+
+ // From runJobs.php --group
+ $group = JobQueueGroup::singleton();
+ $queue = $group->get( 'massmessageJob' );
+ $pending = $queue->getSize();
+ $claimed = $queue->getAcquiredCount();
+ $abandoned = $queue->getAbandonedCount();
+ $active = ( $claimed - $abandoned );
+
+ $msg = wfMessage( 'massmessage-status' )->params( $active +
$claimed )->plain();
+ $this->getOutput()->addWikiText( $msg );
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/76474
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab149c296b1a484f6a0cf123d05ef3b9cb716ee6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits