jenkins-bot has submitted this change and it was merged. Change subject: Fix: Add Path Replacement on multiple External Repos ......................................................................
Fix: Add Path Replacement on multiple External Repos Patch Set 2: Coding conventions Change-Id: I8c6db90a3bed1da98d9fcb8a3dd40c121c6b6cfd --- M ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php 1 file changed, 25 insertions(+), 1 deletion(-) Approvals: Mglaser: Looks good to me, approved jenkins-bot: Verified diff --git a/ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php b/ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php index 2934975..6ea0dac 100644 --- a/ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php +++ b/ExtendedSearch/includes/BuildIndex/BuildIndexMwExternalRepository.class.php @@ -99,12 +99,13 @@ if ( $this->sizeExceedsMaxDocSize( $oRepoFile->getSize(), $sFileName ) ) continue; //Insert URL to Filename + $rURL = BsConfig::get( 'MW::ExtendedSearch::ExternalRepo' ); $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(); + $sRepoFileRealPath = $this->getFilePath( $rURL, $sURL, $oRepoFile ); } $timestampImage = wfTimestamp( TS_ISO_8601, $oRepoFile->getMTime() ); @@ -124,6 +125,29 @@ } } } + /** + * Get Path for File + */ + public function getFilePath( $rURL, $sURL, $file ){ + //Check if comma separated dir given + $arrRepos = explode( ',', $rURL ); + $arrReposURL = explode( ',', $sURL ); + //search repo-repoUrl pair and create right path + if( + sizeof( $arrRepos ) > 1 && + sizeof( $arrReposURL ) > 1 && + sizeof( $arrRepos ) == sizeof( $arrReposURL ) + ){ + while( list( $key, $repo ) = each( $arrRepos ) ){ + if( strstr( $file->getRealPath(), $repo ) ){ + //end search with return if match + return $arrReposURL[$key] . "/" . $file->getFilename(); + } + } + } else { + return $sURL . "/" . $file->getFilename(); + } + } /** * Descructor for BuildIndexMwExternalRepository class -- To view, visit https://gerrit.wikimedia.org/r/255353 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8c6db90a3bed1da98d9fcb8a3dd40c121c6b6cfd Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions Gerrit-Branch: master Gerrit-Owner: Ljonka <l.verhovs...@gmail.com> Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz> Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz> Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits