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