SPQRobin has uploaded a new change for review.

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

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, 13 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaIncubator 
refs/changes/63/112663/1

diff --git a/WikimediaIncubator.class.php b/WikimediaIncubator.class.php
index 17da13f..33cbd5f 100644
--- a/WikimediaIncubator.class.php
+++ b/WikimediaIncubator.class.php
@@ -843,12 +843,24 @@
 
                $newNs = $title->getNamespace();
                $newTitle = $title->getText();
+               $newTitle2 = 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( $newTitle2 ) == 'existing' ) {
+                       # the wiki already exists
+                       $link = self::getSubdomain(
+                               $newTitle2['lang'], $newTitle2['project'],
+                               ( $title->getNsText() ? $title->getNsText() . 
':' : '' ) .
+                               str_replace( ' ', '_', $newTitle2['realtitle'] )
+                       );
+                       $params[0] = 'wminc-error-wiki-exists';
+                       $params[1] = "[$link ". self::makeExternalLinkText( 
$link ) . "]";
+                       return true;
+               } elseif ( $newTitle2['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: newchange
Gerrit-Change-Id: I078eff25f37ddda7fffa4ab22072dea96df500ae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaIncubator
Gerrit-Branch: master
Gerrit-Owner: SPQRobin <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to