[MediaWiki-commits] [Gerrit] Remove duplicated and unnecessary code - change (mediawiki...CirrusSearch)

2016-06-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Remove duplicated and unnecessary code
..


Remove duplicated and unnecessary code

Change-Id: I4e2d6753da9f8dae1dac8d264b8d46808246124f
---
M includes/Util.php
M maintenance/forceSearchIndex.php
2 files changed, 2 insertions(+), 24 deletions(-)

Approvals:
  EBernhardson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Util.php b/includes/Util.php
index e53fd09..6918e0a 100644
--- a/includes/Util.php
+++ b/includes/Util.php
@@ -44,32 +44,13 @@
 
/**
 * Get the textual representation of a namespace with underscores 
stripped, varying
-* by gender if need be.
+* by gender if need be (using Title::getNsText()).
 *
 * @param Title $title The page title to use
 * @return string
 */
public static function getNamespaceText( Title $title ) {
-   global $wgContLang;
-
-   $ns = $title->getNamespace();
-
-   // If we're in NS_USER(_TALK) and we're in a gender-distinct 
language
-   // then vary the namespace on gender like we should.
-   $nsText = '';
-   if ( MWNamespace::hasGenderDistinction( $ns ) && 
$wgContLang->needsGenderDistinction() ) {
-   $nsText = $wgContLang->getGenderNsText(
-   $ns,
-   
MediaWikiServices::getInstance()->getGenderCache()->getGenderOf(
-   User::newFromName( $title->getText() ),
-   __METHOD__
-   )
-   );
-   } elseif ( $nsText !== NS_MAIN ) {
-   $nsText = $wgContLang->getNsText( $ns );
-   }
-
-   return strtr( $nsText, '_', ' ' );
+   return strtr( $title->getNsText(), '_', ' ' );
}
 
/**
diff --git a/maintenance/forceSearchIndex.php b/maintenance/forceSearchIndex.php
index b4cd45b..99abdf4 100644
--- a/maintenance/forceSearchIndex.php
+++ b/maintenance/forceSearchIndex.php
@@ -5,7 +5,6 @@
 use CirrusSearch;
 use CirrusSearch\Maintenance\Maintenance;
 use JobQueueGroup;
-use LinkCache;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\MediaWikiServices;
 use MWException;
@@ -453,8 +452,6 @@
}
$result[] = $update;
}
-   // Clear the LinkCache to prevent its memory use from growing 
without bounds.
-   MediaWikiServices::getInstance()->getLinkCache()->clear();
 
return $result;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4e2d6753da9f8dae1dac8d264b8d46808246124f
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse 
Gerrit-Reviewer: DCausse 
Gerrit-Reviewer: EBernhardson 
Gerrit-Reviewer: Gehel 
Gerrit-Reviewer: Manybubbles 
Gerrit-Reviewer: Smalyshev 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove duplicated and unnecessary code - change (mediawiki...CirrusSearch)

2016-05-31 Thread DCausse (Code Review)
DCausse has uploaded a new change for review.

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

Change subject: Remove duplicated and unnecessary code
..

Remove duplicated and unnecessary code

Change-Id: I4e2d6753da9f8dae1dac8d264b8d46808246124f
---
M includes/Search/Result.php
M includes/Updater.php
M includes/Util.php
M maintenance/forceSearchIndex.php
4 files changed, 2 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/81/291881/1

diff --git a/includes/Search/Result.php b/includes/Search/Result.php
index ce289a9..ae4b1ae 100644
--- a/includes/Search/Result.php
+++ b/includes/Search/Result.php
@@ -88,7 +88,7 @@
$highlights = $result->getHighlights();
if ( isset( $highlights[ 'title' ] ) ) {
$nstext = $this->getTitle()->getNamespace() === 0 ? '' :
-   Util::getNamespaceText( $this->getTitle() ) . 
':';
+   $this->getTitle()->getNsText() . ':';
$this->titleSnippet = $nstext . 
$this->escapeHighlightedText( $highlights[ 'title' ][ 0 ] );
} elseif ( $this->mTitle->isExternal() ) {
// Interwiki searches are weird. They won't have title 
highlights by design, but
diff --git a/includes/Updater.php b/includes/Updater.php
index 2a4bc74..57572fb 100644
--- a/includes/Updater.php
+++ b/includes/Updater.php
@@ -292,7 +292,7 @@
'version' => $page->getLatest(),
'version_type' => 'external',
'namespace' => $title->getNamespace(),
-   'namespace_text' => Util::getNamespaceText( 
$title ),
+   'namespace_text' => $title->getNsText(),
'title' => $title->getText(),
'timestamp' => wfTimestamp( TS_ISO_8601, 
$page->getTimestamp() ),
) );
diff --git a/includes/Util.php b/includes/Util.php
index 69538f6..f5de8f1 100644
--- a/includes/Util.php
+++ b/includes/Util.php
@@ -43,35 +43,6 @@
private static $defaultBoostTemplates = null;
 
/**
-* Get the textual representation of a namespace with underscores 
stripped, varying
-* by gender if need be.
-*
-* @param Title $title The page title to use
-* @return string
-*/
-   public static function getNamespaceText( Title $title ) {
-   global $wgContLang;
-
-   $ns = $title->getNamespace();
-
-   // If we're in NS_USER(_TALK) and we're in a gender-distinct 
language
-   // then vary the namespace on gender like we should.
-   $nsText = '';
-   if ( MWNamespace::hasGenderDistinction( $ns ) && 
$wgContLang->needsGenderDistinction() ) {
-   $nsText = $wgContLang->getGenderNsText( $ns,
-   GenderCache::singleton()->getGenderOf(
-   User::newFromName( $title->getText() ),
-   __METHOD__
-   )
-   );
-   } elseif ( $nsText !== NS_MAIN ) {
-   $nsText = $wgContLang->getNsText( $ns );
-   }
-
-   return strtr( $nsText, '_', ' ' );
-   }
-
-   /**
 * Check if too arrays are recursively the same.  Values are compared 
with != and arrays
 * are descended into.
 *
diff --git a/maintenance/forceSearchIndex.php b/maintenance/forceSearchIndex.php
index 95d8ca1..5c89876 100644
--- a/maintenance/forceSearchIndex.php
+++ b/maintenance/forceSearchIndex.php
@@ -5,7 +5,6 @@
 use CirrusSearch;
 use CirrusSearch\Maintenance\Maintenance;
 use JobQueueGroup;
-use LinkCache;
 use MediaWiki\Logger\LoggerFactory;
 use MWException;
 use MWTimestamp;
@@ -446,8 +445,6 @@
}
$result[] = $update;
}
-   // Clear the LinkCache to prevent its memory use from growing 
without bounds.
-   LinkCache::singleton()->clear();
 
return $result;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e2d6753da9f8dae1dac8d264b8d46808246124f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits