Ljonka has uploaded a new change for review. https://gerrit.wikimedia.org/r/243141
Change subject: Add custom url field in ExtendedSearch for External Repository ...................................................................... Add custom url field in ExtendedSearch for External Repository Change-Id: I1e4e89446f6a9042c039760e83c84b78a36f998e --- M ExtendedSearch/ExtendedSearch.class.php M ExtendedSearch/i18n/de.json M ExtendedSearch/i18n/en.json M ExtendedSearch/i18n/qqq.json M ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php M ExtendedSearch/includes/SearchIndex/SearchResult.class.php 6 files changed, 16 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions refs/changes/41/243141/1 diff --git a/ExtendedSearch/ExtendedSearch.class.php b/ExtendedSearch/ExtendedSearch.class.php index 2f93566..c3b9d69 100644 --- a/ExtendedSearch/ExtendedSearch.class.php +++ b/ExtendedSearch/ExtendedSearch.class.php @@ -94,6 +94,7 @@ BsConfig::registerVar( 'MW::ExtendedSearch::IndexTypesWiki', true, BsConfig::TYPE_BOOL|BsConfig::LEVEL_PUBLIC, 'bs-extendedsearch-pref-indextypeswiki', 'toggle' ); BsConfig::registerVar( 'MW::ExtendedSearch::IndexTypesSpecial', true, BsConfig::TYPE_BOOL|BsConfig::LEVEL_PUBLIC, 'bs-extendedsearch-pref-indextypesspecial', 'toggle' ); BsConfig::registerVar( 'MW::ExtendedSearch::ExternalRepo', '', BsConfig::TYPE_STRING|BsConfig::LEVEL_PUBLIC, 'bs-extendedsearch-pref-externalrepo' ); + BsConfig::registerVar( 'MW::ExtendedSearch::ExternalRepoUrl', '', BsConfig::TYPE_STRING|BsConfig::LEVEL_PUBLIC, 'bs-extendedsearch-pref-externalrepo-url' ); BsConfig::registerVar( 'MW::ExtendedSearch::DefScopeUser', 'text', BsConfig::TYPE_STRING|BsConfig::LEVEL_USER|BsConfig::USE_PLUGIN_FOR_PREFS, 'bs-extendedsearch-pref-defscopeuser', 'select' ); BsConfig::registerVar( 'MW::ExtendedSearch::HighlightSnippets', '3', BsConfig::TYPE_INT|BsConfig::LEVEL_PUBLIC, 'bs-extendedsearch-pref-highlightsnippets', 'int' ); BsConfig::registerVar( 'MW::ExtendedSearch::LogUsers', true, BsConfig::TYPE_BOOL|BsConfig::LEVEL_PUBLIC, 'bs-extendedsearch-pref-logusers', 'toggle' ); diff --git a/ExtendedSearch/i18n/de.json b/ExtendedSearch/i18n/de.json index 08b0769..26b333a 100644 --- a/ExtendedSearch/i18n/de.json +++ b/ExtendedSearch/i18n/de.json @@ -60,6 +60,7 @@ "bs-extendedsearch-pref-showfacets": "Facettensuche aktivieren", "bs-extendedsearch-pref-showautocomplete": "Seiten mit dem passenden Suchbegriff vorschlagen", "bs-extendedsearch-pref-externalrepo": "Externes Verzeichnis indexieren:", + "bs-extendedsearch-pref-externalrepo-url": "Url zum externen Verzeichnis:", "bs-extendedsearch-pref-acentries": "Anzahl der Vorschläge mit dem passenden Suchbegriff:", "bs-extendedsearch-pref-highlightsnippets": "Anzahl gefundener Textpassagen auf der Spezialseite:", "bs-extendedsearch-pref-indexfiletypes": "Dateien mit bestimmten Dateierweiterungen indexieren:", diff --git a/ExtendedSearch/i18n/en.json b/ExtendedSearch/i18n/en.json index 36a049d..a66d7ea 100644 --- a/ExtendedSearch/i18n/en.json +++ b/ExtendedSearch/i18n/en.json @@ -57,6 +57,7 @@ "bs-extendedsearch-pref-showfacets": "Show facets on special page", "bs-extendedsearch-pref-showautocomplete": "Suggest pages matching search term", "bs-extendedsearch-pref-externalrepo": "Index external directory:", + "bs-extendedsearch-pref-externalrepo-url": "Url for external directory:", "bs-extendedsearch-pref-acentries": "Number of suggestions matching search term:", "bs-extendedsearch-pref-highlightsnippets": "Number of highlight snippets:", "bs-extendedsearch-pref-indexfiletypes": "Index files with certain file extensions:", diff --git a/ExtendedSearch/i18n/qqq.json b/ExtendedSearch/i18n/qqq.json index cb9b9c3..950e226 100644 --- a/ExtendedSearch/i18n/qqq.json +++ b/ExtendedSearch/i18n/qqq.json @@ -64,6 +64,7 @@ "bs-extendedsearch-pref-showfacets": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], checkbox label text for show facets on special page", "bs-extendedsearch-pref-showautocomplete": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], checkbox label text for show autocomplete menu", "bs-extendedsearch-pref-externalrepo": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label text for index external directory:", + "bs-extendedsearch-pref-externalrepo-url": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label text for Web-URL of external directory, replace server path:", "bs-extendedsearch-pref-acentries": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label text for number of results in autocomplete:", "bs-extendedsearch-pref-highlightsnippets": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label text for number of highlight snippets:", "bs-extendedsearch-pref-indexfiletypes": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label text for file extensions to be indexed:", diff --git a/ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php b/ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php index d6df0cd..2934975 100644 --- a/ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php +++ b/ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php @@ -98,12 +98,20 @@ if ( $this->sizeExceedsMaxDocSize( $oRepoFile->getSize(), $sFileName ) ) continue; - $sRepoFileRealPath = $oRepoFile->getRealPath(); + //Insert URL to Filename + $sURL = BsConfig::get( 'MW::ExtendedSearch::ExternalRepoUrl' ); + //Replace realpath with webserver url only if $sUrl is set, otherwise work as before + if($sURL == ""){ + $sRepoFileRealPath = "file:///" . $oRepoFile->getRealPath(); + }else{ + $sRepoFileRealPath = $sURL . "/" . $oRepoFile->getFilename(); + } + $timestampImage = wfTimestamp( TS_ISO_8601, $oRepoFile->getMTime() ); - if ( $this->checkExistence( $sRepoFileRealPath, 'external', $timestampImage, $sFileName ) ) continue; + if ( $this->checkExistence( $oRepoFile->getRealPath(), 'external', $timestampImage, $sFileName ) ) continue; - $text = $this->getFileText( $sRepoFileRealPath, $sFileName ); + $text = $this->getFileText( $oRepoFile->getRealPath(), $sFileName ); $doc = $this->makeRepoDocument( $sDocType, utf8_encode( $sFileName ), $text, utf8_encode( $sRepoFileRealPath ), $timestampImage ); $this->writeLog( $sFileName ); diff --git a/ExtendedSearch/includes/SearchIndex/SearchResult.class.php b/ExtendedSearch/includes/SearchIndex/SearchResult.class.php index 1a79e5e..e4bd129 100644 --- a/ExtendedSearch/includes/SearchIndex/SearchResult.class.php +++ b/ExtendedSearch/includes/SearchIndex/SearchResult.class.php @@ -525,7 +525,7 @@ $sTitle = $oDocument->title; $sLink = $oDocument->path; - $sSearchLink = '<a target="_blank" href="file:///' . $sLink . '">' . $sTitle . '</a>'; + $sSearchLink = '<a target="_blank" href="' . $sLink . '">' . $sTitle . '</a>'; } return $sSearchLink; } -- To view, visit https://gerrit.wikimedia.org/r/243141 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1e4e89446f6a9042c039760e83c84b78a36f998e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions Gerrit-Branch: master Gerrit-Owner: Ljonka <l.verhovs...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits