SPQRobin has submitted this change and it was merged.
Change subject: Improve search
......................................................................
Improve search
When suggesting a page title to create when searching, do not add a prefix if
the search term already contains one
Secondly, if the prefix is of an existing wiki, link to that (similar to when
viewing the page itself)
Change-Id: I078eff25f37ddda7fffa4ab22072dea96df500ae
---
M WikimediaIncubator.class.php
1 file changed, 14 insertions(+), 1 deletion(-)
Approvals:
SPQRobin: Verified; Looks good to me, approved
diff --git a/WikimediaIncubator.class.php b/WikimediaIncubator.class.php
index 17da13f..c7cbef5 100644
--- a/WikimediaIncubator.class.php
+++ b/WikimediaIncubator.class.php
@@ -843,12 +843,25 @@
$newNs = $title->getNamespace();
$newTitle = $title->getText();
+ $newTitleData = self::analyzePrefix( $newTitle, false, true );
if ( !in_array( $title->getNamespace(),
$wmincTestWikiNamespaces ) ) {
# namespace not affected by the prefix system: show
normal msg
return true;
} elseif ( $prefix == $wmincProjectSite['short'] ) {
$newNs = NS_PROJECT;
- } else {
+ } elseif ( self::getDBState( $newTitleData ) == 'existing' ) {
+ # the wiki already exists
+ $link = self::getSubdomain(
+ $newTitleData['lang'], $newTitleData['project'],
+ ( $title->getNsText() ? $title->getNsText() .
':' : '' ) .
+ str_replace( ' ', '_',
$newTitleData['realtitle'] )
+ );
+ $params[0] = 'wminc-error-wiki-exists';
+ $params[1] = "[$link ". self::makeExternalLinkText(
$link ) . "]";
+ return true;
+ } elseif ( $newTitleData['error'] ) {
+ # only add a prefix to the title if there is no prefix
+ # ('error' by analyzePrefix)
$newTitle = $prefix . '/' . $newTitle;
}
--
To view, visit https://gerrit.wikimedia.org/r/112663
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I078eff25f37ddda7fffa4ab22072dea96df500ae
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikimediaIncubator
Gerrit-Branch: master
Gerrit-Owner: SPQRobin <[email protected]>
Gerrit-Reviewer: Ebe123 <[email protected]>
Gerrit-Reviewer: MF-Warburg <[email protected]>
Gerrit-Reviewer: SPQRobin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits