Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/56767


Change subject: Consolidate statistics
......................................................................

Consolidate statistics

This is a cherry-pick from the 1.9.x branch:

-------------------

commit 26f7377a0a605b81a0ebff2a31d015a729e0f242
Author: mwjames <[email protected]>
Date:   Sat Nov 3 15:26:27 2012 +0900

    SMW 1.9: Consolidate statistics

    + Consolidate how statistics are provided,
    + Incorporate inline query statistics depends on Change Iccd5fa17

    SQLStore2 + SQLStore3

------------------

Change-Id: I850fac7e6c9de4457975215a12f341274e9c45bb
---
M includes/storage/SQLStore/SMW_SQLStore3_SpecialPageHandlers.php
M specials/Statistics/SMW_SpecialStatistics.php
2 files changed, 16 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki 
refs/changes/67/56767/1

diff --git a/includes/storage/SQLStore/SMW_SQLStore3_SpecialPageHandlers.php 
b/includes/storage/SQLStore/SMW_SQLStore3_SpecialPageHandlers.php
index 3f38c69..df2ece3 100644
--- a/includes/storage/SQLStore/SMW_SQLStore3_SpecialPageHandlers.php
+++ b/includes/storage/SQLStore/SMW_SQLStore3_SpecialPageHandlers.php
@@ -194,6 +194,17 @@
                $result = array();
                $proptables = SMWSQLStore3::getPropertyTables();
 
+               // Properties with their own page
+               $result['OWNPAGE'] = $dbr->estimateRowCount( 'page', '*', 
array( 'page_namespace' => SMW_NS_PROPERTY ) );
+
+               // Count existing inline queries
+               $typeprop = new SMWDIProperty( '_ASK' );
+               $typetable = $proptables[SMWSQLStore3::findPropertyTableID( 
$typeprop )];
+               $res = $dbr->select( $typetable->name, 'COUNT(s_id) AS count', 
array(), 'SMW::getStatistics' );
+               $row = $dbr->fetchObject( $res );
+               $result['QUERY'] = $row->count;
+               $dbr->freeResult( $res );
+
                // count number of declared properties by counting "has type" 
annotations
                $typeprop = new SMWDIProperty( '_TYPE' );
                $typetable = $proptables[SMWSQLStore3::findPropertyTableID( 
$typeprop )];
diff --git a/specials/Statistics/SMW_SpecialStatistics.php 
b/specials/Statistics/SMW_SpecialStatistics.php
index 337a816..da82072 100644
--- a/specials/Statistics/SMW_SpecialStatistics.php
+++ b/specials/Statistics/SMW_SpecialStatistics.php
@@ -1,10 +1,10 @@
 <?php
 
 /**
- * File holding the SMWSpecialSemanticStatistics class for the 
Special:SemanticStatistics page. 
+ * File holding the SMWSpecialSemanticStatistics class for the 
Special:SemanticStatistics page.
  *
  * @file SMW_SpecialStatistics.php
- * 
+ *
  * @ingroup SMWSpecialPage
  * @ingroup SpecialPage
  *
@@ -18,9 +18,9 @@
 
        public function execute( $param ) {
                global $wgOut, $wgLang;
-               
+
                $wgOut->setPageTitle( wfMessage( 'semanticstatistics' )->text() 
);
-               
+
                $semanticStatistics = smwfGetStore()->getStatistics();
        
                $dbr = wfGetDB( DB_SLAVE );
@@ -36,7 +36,7 @@
                $out = wfMessage( 'smw_semstats_text' )->numParams(     
$semanticStatistics['PROPUSES'],
                        $semanticStatistics['USEDPROPS'], $propertyPageAmount, 
$semanticStatistics['DECLPROPS']
                )->parseAsBlock();
-       
+
                $wgOut->addHTML( $out );
        }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I850fac7e6c9de4457975215a12f341274e9c45bb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Mwjames <[email protected]>

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

Reply via email to