Kipcool has submitted this change and it was merged.

Change subject: Added text attributes to statistics
......................................................................


Added text attributes to statistics

Change-Id: Ifce9f534ac1e2cf48593f9a20f9304a19f76d9fd
---
M OmegaWiki/SpecialOWStatistics.php
1 file changed, 25 insertions(+), 3 deletions(-)

Approvals:
  Kipcool: Verified; Looks good to me, approved



diff --git a/OmegaWiki/SpecialOWStatistics.php 
b/OmegaWiki/SpecialOWStatistics.php
index 0e0f84f..4552009 100644
--- a/OmegaWiki/SpecialOWStatistics.php
+++ b/OmegaWiki/SpecialOWStatistics.php
@@ -258,8 +258,9 @@
        function getAnnotationStats () {
                $dc = wdGetDataSetContext();
                $dbr = wfGetDB( DB_SLAVE );
+               $output = "";
 
-               // at the moment only link attributes
+               // Link attributes
                $sql = "SELECT attribute_mid, count(DISTINCT value_id) as tot ";
                $sql .= " FROM {$dc}_url_attribute_values" ;
                $sql .= " WHERE remove_transaction_id IS NULL " ;
@@ -273,6 +274,28 @@
                }
                arsort ( $nbAtt ) ;
 
+               $output .= "<p><h2>Link attributes</h2>\n" . 
$this->createTable( $nbAtt ) . "</p>\n"  ;
+
+               // Text attributes
+               $sql = "SELECT attribute_mid, count(DISTINCT value_id) as tot ";
+               $sql .= " FROM {$dc}_text_attribute_values" ;
+               $sql .= " WHERE remove_transaction_id IS NULL " ;
+               $sql .= " group by attribute_mid " ;
+
+               $queryResult = $dbr->query( $sql );
+
+               while ( $row = $dbr->fetchObject( $queryResult ) ) {
+                       $att = $row->attribute_mid ;
+                       $nbAtt[$att] = $row->tot ;
+               }
+               arsort ( $nbAtt ) ;
+
+               $output .= "<p><h2>Text attributes</h2>\n" . 
$this->createTable( $nbAtt ) . "</p>\n"  ;
+
+               return $output ;
+       }
+
+       function createTable( $nbAtt ) {
                $table = "<center><table class=\"sortable\">" ;
                $table .= "<tr><th><b>" . wfMsg('ow_Annotation') . 
"</b></th><th><b>" . '#' . "</b></th></tr>\n";
                foreach ($nbAtt as $att => $nb) {
@@ -281,7 +304,6 @@
                        $table .= "<tr><td alt=$att>$attname</td><td 
align=right>$nb</td></tr>\n" ;
                }
                $table .= "</table></center>" ;
-               $output = "<p>$table</p>"  ;
-               return $output ;
+               return $table;
        }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifce9f534ac1e2cf48593f9a20f9304a19f76d9fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Kipcool <[email protected]>
Gerrit-Reviewer: Kipcool <[email protected]>

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

Reply via email to