[MediaWiki-commits] [Gerrit] Improve search - change (mediawiki...WikimediaIncubator)

2014-02-11 Thread SPQRobin (Code Review)
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 robinp.1...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Improve search - change (mediawiki...WikimediaIncubator)

2014-02-11 Thread SPQRobin (Code Review)
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 robinp.1...@gmail.com
Gerrit-Reviewer: Ebe123 beauleetien...@gmail.com
Gerrit-Reviewer: MF-Warburg mfwarb...@googlemail.com
Gerrit-Reviewer: SPQRobin robinp.1...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits