[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: Rename CargoHierarchy.php and its class variable

2017-08-15 Thread Yaron Koren (Code Review)
Yaron Koren has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/371206 )

Change subject: Rename CargoHierarchy.php and its class variable
..


Rename CargoHierarchy.php and its class variable

Change-Id: Iff9694bcc519851ee696e1881aa5bc07f792850c
---
M Cargo.php
R CargoHierarchyTree.php
M CargoUtils.php
M drilldown/CargoDrilldownHierarchy.php
M drilldown/CargoSpecialDrilldown.php
M extension.json
6 files changed, 16 insertions(+), 16 deletions(-)

Approvals:
  Yaron Koren: Looks good to me, approved
  Nischayn22: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/Cargo.php b/Cargo.php
index 35fe54f..e5e5508 100644
--- a/Cargo.php
+++ b/Cargo.php
@@ -82,7 +82,7 @@
 $wgAutoloadClasses['CargoUtils'] = $dir . '/CargoUtils.php';
 $wgAutoloadClasses['CargoFieldDescription'] = $dir . 
'/CargoFieldDescription.php';
 $wgAutoloadClasses['CargoTableSchema'] = $dir . '/CargoTableSchema.php';
-$wgAutoloadClasses['CargoHierarchy'] = $dir . '/CargoHierarchy.php';
+$wgAutoloadClasses['CargoHierarchyTree'] = $dir . '/CargoHierarchyTree.php';
 $wgAutoloadClasses['CargoDeclare'] = $dir . 
'/parserfunctions/CargoDeclare.php';
 $wgAutoloadClasses['CargoAttach'] = $dir . '/parserfunctions/CargoAttach.php';
 $wgAutoloadClasses['CargoStore'] = $dir . '/parserfunctions/CargoStore.php';
diff --git a/CargoHierarchy.php b/CargoHierarchyTree.php
similarity index 90%
rename from CargoHierarchy.php
rename to CargoHierarchyTree.php
index 18caaf8..3eec753 100644
--- a/CargoHierarchy.php
+++ b/CargoHierarchyTree.php
@@ -1,20 +1,20 @@
 mTitle = $curTitle;
+   $this->mRootValue = $curTitle;
$this->mChildren = array();
}
 
@@ -62,7 +62,7 @@
while ( !$stack->isEmpty() ) {
$node = $stack->pop();
$row = array();
-   $row['_value'] = $node->mTitle;
+   $row['_value'] = $node->mRootValue;
$row['_left'] = $node->mLeft;
$row['_right'] = $node->mRight;
$tableData[] = $row;
diff --git a/CargoUtils.php b/CargoUtils.php
index a1686be..d8628a4 100644
--- a/CargoUtils.php
+++ b/CargoUtils.php
@@ -732,7 +732,7 @@
$cdb->query( $createIndexSQL );
$fieldHelperTableNames[] = 
$fieldHelperTableName;
// Insert hierarchy information in the 
__hierarchy table
-   $hierarchyTree = 
CargoHierarchy::newFromWikiText( $fieldDescription->mHierarchyStructure );
+   $hierarchyTree = 
CargoHierarchyTree::newFromWikiText( $fieldDescription->mHierarchyStructure );
$hierarchyStructureTableData = 
$hierarchyTree->generateHierarchyStructureTableData();
foreach( $hierarchyStructureTableData as $entry 
) {
$cdb->insert( $fieldHelperTableName, 
$entry );
diff --git a/drilldown/CargoDrilldownHierarchy.php 
b/drilldown/CargoDrilldownHierarchy.php
index 42598a0..07f889b 100644
--- a/drilldown/CargoDrilldownHierarchy.php
+++ b/drilldown/CargoDrilldownHierarchy.php
@@ -6,7 +6,7 @@
  * @ingroup Cargo
  */
 
-class CargoDrilldownHierarchy extends CargoHierarchy {
+class CargoDrilldownHierarchy extends CargoHierarchyTree {
public $mWithinTreeMatchCount = 0;
public $mExactRootMatchCount = 0;
 
@@ -67,11 +67,11 @@
if ( $node->mLeft !== 1 ) {
// check if its not __pseudo_root__ node, then 
only add count

CargoDrilldownHierarchy::computeNodeCountByFilter( $node, $f, 
$fullTextSearchTerm, $appliedFilters );
-   $filter_values[$node->mTitle] = 
$node->mWithinTreeMatchCount;
+   $filter_values[$node->mRootValue] = 
$node->mWithinTreeMatchCount;
}
if ( count( $node->mChildren ) > 0 ) {
if ( $node->mLeft !== 1 ) {
-   $filter_values[$node->mTitle . " only"] 
= $node->mWithinTreeMatchCount;
+   $filter_values[$node->mRootValue . " 
only"] = $node->mWithinTreeMatchCount;
}
for ( $i = count( $node->mChildren ) - 1; $i >= 
0; $i-- ) {
$stack->push( $node->mChildren[$i] );
diff --git a/drilldown/CargoSpecialDrilldown.php 
b/drilldown/CargoSpecialDrilldown.php
index 7f7e062..b89561a 100644
--- a/drilldown/CargoSpecialDrilldown.php
+++ b/drilldown/CargoSpecialDrilldown.php
@@ -499,7 +499,7 @@
 
function printUnappliedFilterValuesForHierarchy( $cur_url, $f, 
$fullTextSearchTerm, $applied_filters ) {

[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: Rename CargoHierarchy.php and its class variable

2017-08-10 Thread Fz-29 (Code Review)
Fz-29 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371206 )

Change subject: Rename CargoHierarchy.php and its class variable
..

Rename CargoHierarchy.php and its class variable

Change-Id: Iff9694bcc519851ee696e1881aa5bc07f792850c
---
M Cargo.php
R CargoHierarchyTree.php
M CargoUtils.php
M drilldown/CargoDrilldownHierarchy.php
M drilldown/CargoSpecialDrilldown.php
M extension.json
6 files changed, 16 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/06/371206/1

diff --git a/Cargo.php b/Cargo.php
index 35fe54f..e5e5508 100644
--- a/Cargo.php
+++ b/Cargo.php
@@ -82,7 +82,7 @@
 $wgAutoloadClasses['CargoUtils'] = $dir . '/CargoUtils.php';
 $wgAutoloadClasses['CargoFieldDescription'] = $dir . 
'/CargoFieldDescription.php';
 $wgAutoloadClasses['CargoTableSchema'] = $dir . '/CargoTableSchema.php';
-$wgAutoloadClasses['CargoHierarchy'] = $dir . '/CargoHierarchy.php';
+$wgAutoloadClasses['CargoHierarchyTree'] = $dir . '/CargoHierarchyTree.php';
 $wgAutoloadClasses['CargoDeclare'] = $dir . 
'/parserfunctions/CargoDeclare.php';
 $wgAutoloadClasses['CargoAttach'] = $dir . '/parserfunctions/CargoAttach.php';
 $wgAutoloadClasses['CargoStore'] = $dir . '/parserfunctions/CargoStore.php';
diff --git a/CargoHierarchy.php b/CargoHierarchyTree.php
similarity index 90%
rename from CargoHierarchy.php
rename to CargoHierarchyTree.php
index 18caaf8..3eec753 100644
--- a/CargoHierarchy.php
+++ b/CargoHierarchyTree.php
@@ -1,20 +1,20 @@
 mTitle = $curTitle;
+   $this->mRootValue = $curTitle;
$this->mChildren = array();
}
 
@@ -62,7 +62,7 @@
while ( !$stack->isEmpty() ) {
$node = $stack->pop();
$row = array();
-   $row['_value'] = $node->mTitle;
+   $row['_value'] = $node->mRootValue;
$row['_left'] = $node->mLeft;
$row['_right'] = $node->mRight;
$tableData[] = $row;
diff --git a/CargoUtils.php b/CargoUtils.php
index a1686be..d8628a4 100644
--- a/CargoUtils.php
+++ b/CargoUtils.php
@@ -732,7 +732,7 @@
$cdb->query( $createIndexSQL );
$fieldHelperTableNames[] = 
$fieldHelperTableName;
// Insert hierarchy information in the 
__hierarchy table
-   $hierarchyTree = 
CargoHierarchy::newFromWikiText( $fieldDescription->mHierarchyStructure );
+   $hierarchyTree = 
CargoHierarchyTree::newFromWikiText( $fieldDescription->mHierarchyStructure );
$hierarchyStructureTableData = 
$hierarchyTree->generateHierarchyStructureTableData();
foreach( $hierarchyStructureTableData as $entry 
) {
$cdb->insert( $fieldHelperTableName, 
$entry );
diff --git a/drilldown/CargoDrilldownHierarchy.php 
b/drilldown/CargoDrilldownHierarchy.php
index 42598a0..07f889b 100644
--- a/drilldown/CargoDrilldownHierarchy.php
+++ b/drilldown/CargoDrilldownHierarchy.php
@@ -6,7 +6,7 @@
  * @ingroup Cargo
  */
 
-class CargoDrilldownHierarchy extends CargoHierarchy {
+class CargoDrilldownHierarchy extends CargoHierarchyTree {
public $mWithinTreeMatchCount = 0;
public $mExactRootMatchCount = 0;
 
@@ -67,11 +67,11 @@
if ( $node->mLeft !== 1 ) {
// check if its not __pseudo_root__ node, then 
only add count

CargoDrilldownHierarchy::computeNodeCountByFilter( $node, $f, 
$fullTextSearchTerm, $appliedFilters );
-   $filter_values[$node->mTitle] = 
$node->mWithinTreeMatchCount;
+   $filter_values[$node->mRootValue] = 
$node->mWithinTreeMatchCount;
}
if ( count( $node->mChildren ) > 0 ) {
if ( $node->mLeft !== 1 ) {
-   $filter_values[$node->mTitle . " only"] 
= $node->mWithinTreeMatchCount;
+   $filter_values[$node->mRootValue . " 
only"] = $node->mWithinTreeMatchCount;
}
for ( $i = count( $node->mChildren ) - 1; $i >= 
0; $i-- ) {
$stack->push( $node->mChildren[$i] );
diff --git a/drilldown/CargoSpecialDrilldown.php 
b/drilldown/CargoSpecialDrilldown.php
index 7f7e062..b89561a 100644
--- a/drilldown/CargoSpecialDrilldown.php
+++ b/drilldown/CargoSpecialDrilldown.php
@@ -499,7 +499,7 @@
 
function printUnappliedFilterValuesForHierarchy( $cur_url, $f, 
$fullTextSearchTerm, $applied_filters ) {
$results_line = "";
-   // co