jenkins-bot has submitted this change and it was merged.

Change subject: Added display of num rows to main Special:CargoTables screen
......................................................................


Added display of num rows to main Special:CargoTables screen

Change-Id: I18000a39f569986b2b86fbd41052def239826de0
---
M i18n/en.json
M i18n/qqq.json
M specials/CargoTables.php
3 files changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Yaron Koren: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/i18n/en.json b/i18n/en.json
index 0eca289..db13549 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -50,6 +50,7 @@
        "cargo-cargotables-attachedby": "attached by $1",
        "cargo-cargotables-tablenotfound": "Table \"$1\" not found in Cargo 
database.",
        "cargo-cargotables-totalrows": "This table has '''$1''' 
{{PLURAL:$1|row|rows}} altogether.",
+       "cargo-cargotables-totalrowsshort": "$1 {{PLURAL:$1|row|rows}}",
        "deletecargotable": "Delete Cargo table",
        "pagevalues": "Page values",
        "cargo-pagevaluesfor": "Page values for \"$1\"",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 41832f7..d1d16c6 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -55,6 +55,7 @@
        "cargo-cargotables-attachedby": "Parameters:\n* $1 - template name",
        "cargo-cargotables-tablenotfound": "An error message. 
({{doc-cargo}})\n\nParameters:\n* $1 - table name.",
        "cargo-cargotables-totalrows": "Parameters:\n* $1 - number of rows in a 
database table.",
+       "cargo-cargotables-totalrowsshort": "Parameters:\n* $1 - number of rows 
in a database table.",
        "deletecargotable": "{{doc-special|DeleteCargoTable}}\n{{doc-cargo}}",
        "pagevalues": "{{doc-special|PageValues}}",
        "cargo-pagevaluesfor": "Parameters:\n* $1 - a page name.",
diff --git a/specials/CargoTables.php b/specials/CargoTables.php
index 70ae150..919efdb 100644
--- a/specials/CargoTables.php
+++ b/specials/CargoTables.php
@@ -121,6 +121,7 @@
        function displayListOfTables() {
                global $wgUser;
 
+               $cdb = CargoUtils::getDB();
                $tableNames = CargoUtils::getTables();
                $templatesThatDeclareTables = CargoUtils::getAllPageProps( 
'CargoTableName' );
                $templatesThatAttachToTables = CargoUtils::getAllPageProps( 
'CargoAttachedTable' );
@@ -149,6 +150,10 @@
                                $actionLinks .= ' | ' . Html::element( 'a', 
array( 'href' => $deleteTableURL ),
                                                $this->msg( 'delete' )->text() 
);
                        }
+
+                       $res = $cdb->select( $tableName, 'COUNT(*)' );
+                       $row = $cdb->fetchRow( $res );
+                       $numRowsText = $this->msg( 
'cargo-cargotables-totalrowsshort' )->numParams( $row[0] )->parse();
 
                        // "Declared by" text
                        if ( !array_key_exists( $tableName, 
$templatesThatDeclareTables ) ) {
@@ -183,7 +188,7 @@
                                                'cargo-cargotables-attachedby', 
implode( $templateLinks ) )->text();
                        }
 
-                       $tableText = "$tableName ($actionLinks) 
($declaringTemplatesText";
+                       $tableText = "$tableName ($actionLinks) - $numRowsText 
($declaringTemplatesText";
                        if ( $attachingTemplatesText != '' ) {
                                $tableText .= ", $attachingTemplatesText";
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/295694
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I18000a39f569986b2b86fbd41052def239826de0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to