jenkins-bot has submitted this change and it was merged.
Change subject: UsageTracker: show number of open analyses
......................................................................
UsageTracker: show number of open analyses
Now shows the number of analyses yet to be made. Also, as long as
analyses are open, it is not possible to trigger the re-analysis.
Patch Set 2: Implemented i18n CR
Change-Id: I036b55d31824383217b591626588eee272514665
---
M UsageTracker/UsageTracker.class.php
M UsageTracker/i18n/de.json
M UsageTracker/i18n/en.json
M UsageTracker/i18n/qqq.json
M UsageTracker/src/specials/SpecialUsageTracker.php
5 files changed, 46 insertions(+), 15 deletions(-)
Approvals:
Mglaser: Looks good to me, approved
jenkins-bot: Verified
diff --git a/UsageTracker/UsageTracker.class.php
b/UsageTracker/UsageTracker.class.php
index 37e42ec..7ee9528 100644
--- a/UsageTracker/UsageTracker.class.php
+++ b/UsageTracker/UsageTracker.class.php
@@ -71,7 +71,7 @@
foreach ( $this->aCollectors as $oCollector ) {
$oCollector->registerJob();
}
- return true;
+ return $this->aCollectors;
}
foreach ( $this->aCollectors as $oCollector ) {
diff --git a/UsageTracker/i18n/de.json b/UsageTracker/i18n/de.json
index ad43b21..e524089 100644
--- a/UsageTracker/i18n/de.json
+++ b/UsageTracker/i18n/de.json
@@ -15,5 +15,6 @@
"bs-usagetracker-col-last-updated": "Zuletzt aktualisiert",
"bs-usagetracker-caution": "Bitte beachte: Die Aktualisierung der
Nutzungsstatistiken kann einige Zeit und Ressourcen in Anspruch nehmen. Löse
die Aktualisierung nur aus, wenn du wirklich aktuelle Daten benötigst. Die
Aktualisierung wird über verzögerte Aufträge ausgeführt, so dass du die Seite
mehrere Male neu laden musst, bis die Daten vollständig gesammelt wurden.",
"bs-usagetracker-base-collector-desc": "Anzahl der Seiten, die $1
nutzen",
- "bs-usagetracker-tag-collector-desc": "Anzahl der Seiten, die das Tag
<$1> nutzen"
+ "bs-usagetracker-tag-collector-desc": "Anzahl der Seiten, die das Tag
<$1> nutzen",
+ "bs-usagetracker-open-tasks" : "Die Plattform wird gerade analysiert.
{{PLURAL:$1|Eine Analyse steht|$1 Analysen stehen}} noch aus. <a href='$2'>(Neu
laden)</a>"
}
diff --git a/UsageTracker/i18n/en.json b/UsageTracker/i18n/en.json
index 3fadc35..0b7ac59 100644
--- a/UsageTracker/i18n/en.json
+++ b/UsageTracker/i18n/en.json
@@ -15,5 +15,6 @@
"bs-usagetracker-col-last-updated" : "Last updated",
"bs-usagetracker-caution" : "Be aware: Updating usage statistics may
take some time and resources. Only trigger the update when you really, really
need current data. The update is done via deferred jobs, so you might have to
reload several times until the data is fully collected.",
"bs-usagetracker-base-collector-desc" : "Number of pages using $1",
- "bs-usagetracker-tag-collector-desc" : "Number of pages using tag <$1>"
+ "bs-usagetracker-tag-collector-desc" : "Number of pages using tag <$1>",
+ "bs-usagetracker-open-tasks" : "Site analysis is currently in progress.
{{PLURAL:$1|One analysis is|$1 analyses are}} still open. <a
href='$2'>(Refresh)</a>"
}
diff --git a/UsageTracker/i18n/qqq.json b/UsageTracker/i18n/qqq.json
index 1b6a26c..af936dd 100644
--- a/UsageTracker/i18n/qqq.json
+++ b/UsageTracker/i18n/qqq.json
@@ -14,5 +14,7 @@
"bs-usagetracker-col-desc": "Used in [[Special:Usage_Tracker]], label
for description column\n{{Identical|Description}}",
"bs-usagetracker-col-count": "Used in [[Special:Usage_Tracker]], label
for count column\n{{Identical|Count}}",
"bs-usagetracker-col-last-updated": "Used in [[Special:Usage_Tracker]],
label for last updated column\n{{Identical|Last updated}}",
- "bs-usagetracker-caution": "Used in [[Special:Usage_Tracker]], text to
warn users not that the feature is resource intense"
+ "bs-usagetracker-caution": "Used in [[Special:Usage_Tracker]], text to
warn users not that the feature is resource intense",
+ "bs-usagetracker-open-tasks" : "Used in [[Special:Usage_Tracker]], text
to show that site analysis is currently in progress.\n\n* $1 is the number of
open jobs."
+
}
diff --git a/UsageTracker/src/specials/SpecialUsageTracker.php
b/UsageTracker/src/specials/SpecialUsageTracker.php
index 05efe33..2609ba7 100644
--- a/UsageTracker/src/specials/SpecialUsageTracker.php
+++ b/UsageTracker/src/specials/SpecialUsageTracker.php
@@ -16,6 +16,8 @@
class SpecialUsageTracker extends BsSpecialPage {
+ public $iOpenTasks = null;
+
/**
* Constructor of SpecialUsageTracker class
*/
@@ -38,11 +40,21 @@
// Handle update requests (in case the user has the neccesary
rights)
if ( $this->getUser()->isAllowed( 'usagetracker-update') ) {
- $this->showUpdateForm();
-
if ( $oRequest->wasPosted() ) {
- BsExtensionManager::getExtension(
'UsageTracker' )->getUsageData();
+ $aData = BsExtensionManager::getExtension(
'UsageTracker' )->getUsageData();
+ // JobQueue...getSize is not updated fast
enough, so we use the
+ // raw count of jobs just enqueued.
+ $this->iOpenTasks = count( $aData );
+ } else {
+ $oJobQueue = JobQueueGroup::singleton()->get(
'usageTrackerCollectJob' );
+ $oJobQueue->flushCaches();
+ // This count is wrong, since some jobs are
executed right at the
+ // end of this page load. However, since we do
not know the number
+ // it's ok. Possibly, the user has to reload
one time more than
+ // necessary.
+ $this->iOpenTasks = $oJobQueue->getSize();
}
+ $this->showUpdateForm();
}
// Get stored data from db
@@ -63,7 +75,6 @@
$oOut->addHTML(
HTML::rawElement( "table", array( "class" => "sortable
wikitable" ), $sTableHtml )
);
-
return true;
}
@@ -90,7 +101,7 @@
/**
* Output a form to start collect jobs
*/
- function showUpdateForm() {
+ protected function showUpdateForm() {
$this->getOutput()->addHTML(
Html::openElement(
'form',
@@ -103,14 +114,30 @@
) .
Html::hidden( 'title',
$this->getPageTitle()->getPrefixedText() ) .
Xml::fieldset( $this->msg(
'bs-usagetracker-create-statistics' )->text() ) .
- Xml::element( 'div', [], $this->msg(
'bs-usagetracker-caution' )->text() ).
- Xml::submitButton(
+ Xml::element( 'div', [], $this->msg(
'bs-usagetracker-caution' )->text() )
+ );
+ if ( $this->iOpenTasks > 0 ) {
+ $this->getOutput()->addHTML( Html::openElement( 'b' ) );
+ $this->getOutput()->addHTML(
$this->msg(
- 'bs-usagetracker-startjobs'
+ 'bs-usagetracker-open-tasks',
+ $this->iOpenTasks,
+ SpecialPage::getTitleFor(
'UsageTracker' )->getLinkURL()
)->text()
- ) .
- Html::closeElement( 'fieldset' ) .
- Html::closeElement( 'form' ) . "\n"
+ );
+ $this->getOutput()->addHTML( Html::closeElement( 'b' )
);
+ } else {
+ $this->getOutput()->addHTML(
+ Xml::submitButton(
+ $this->msg(
+ 'bs-usagetracker-startjobs'
+ )->text()
+ )
+ );
+ }
+ $this->getOutput()->addHTML(
+ Html::closeElement('fieldset') .
+ Html::closeElement('form') . "\n"
);
}
--
To view, visit https://gerrit.wikimedia.org/r/320155
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I036b55d31824383217b591626588eee272514665
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Mglaser <[email protected]>
Gerrit-Reviewer: Dvogel hallowelt <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Raimond Spekking <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits