r105888 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105887‎ | r105888 | r105889 >
Date:15:25, 12 December 2011
Author:reedy
Status:ok
Tags:
Comment:
Merge r102560, essentially merging r97175 into 1.18wmf1
Modified paths:
  • /branches/wmf/1.18wmf1 (modified) (history)
  • /branches/wmf/1.18wmf1/docs/hooks.txt (modified) (history)
  • /branches/wmf/1.18wmf1/includes (modified) (history)
  • /branches/wmf/1.18wmf1/includes/specials (modified) (history)
  • /branches/wmf/1.18wmf1/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/docs/hooks.txt
@@ -1689,6 +1689,11 @@
16901690 &$query_options: array of options for the database request
16911691 &$select: Array of columns to select
16921692
 1693+'SpecialSearchCreateLink': called when making the message to create a page or
 1694+go to the existing page
 1695+$t: title object searched for
 1696+&$params: an array of the default message name and page title (as parameter)
 1697+
16931698 'SpecialSearchGo': called when user clicked the "Go"
16941699 &$title: title object generated from the text entered by the user
16951700 &$term: the search term entered by the user
@@ -1697,6 +1702,12 @@
16981703 target doesn't exist
16991704 &$title: title object generated from the text entered by the user
17001705
 1706+'SpecialSearchPowerBox': the equivalent of SpecialSearchProfileForm for
 1707+the advanced form, a.k.a. power search box
 1708+&$showSections: an array to add values with more options to
 1709+$term: the search term (not a title object)
 1710+$opts: an array of hidden options (containing 'redirs' and 'profile')
 1711+
17011712 'SpecialSearchProfiles': allows modification of search profiles
17021713 &$profiles: profiles, which can be modified.
17031714
Property changes on: branches/wmf/1.18wmf1/docs/hooks.txt
___________________________________________________________________
Modified: svn:mergeinfo
17041715 Merged /branches/REL1_18/phase3/docs/hooks.txt:r102560
17051716 Merged /trunk/phase3/docs/hooks.txt:r97175
Index: branches/wmf/1.18wmf1/includes/specials/SpecialSearch.php
@@ -382,19 +382,28 @@
383383 global $wgOut;
384384
385385 // show direct page/create link if applicable
 386+
386387 // Check DBkey !== '' in case of fragment link only.
387 - $messageName = null;
388 - if( !is_null($t) && $t->getDBkey() !== '' ) {
389 - if( $t->isKnown() ) {
390 - $messageName = 'searchmenu-exists';
391 - } elseif( $t->userCan( 'create' ) ) {
392 - $messageName = 'searchmenu-new';
393 - } else {
394 - $messageName = 'searchmenu-new-nocreate';
395 - }
 388+ if( is_null( $t ) || $t->getDBkey() === '' ) {
 389+ // invalid title
 390+ // preserve the paragraph for margins etc...
 391+ $this->getOutput()->addHtml( '<p></p>' );
 392+ return;
396393 }
 394+ $messageName = '';
 395+ if( $t->isKnown() ) {
 396+ $messageName = 'searchmenu-exists';
 397+ } elseif( $t->userCan( 'create' ) ) {
 398+ $messageName = 'searchmenu-new';
 399+ } else {
 400+ $messageName = 'searchmenu-new-nocreate';
 401+ }
 402+ $params = array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) );
 403+ wfRunHooks( 'SpecialSearchCreateLink', array( $t, &$params ) );
 404+
 405+ // Extensions using the hook might still return an empty $messageName
397406 if( $messageName ) {
398 - $wgOut->wrapWikiMsg( "<p class=\"mw-search-createlink\">\n$1</p>", array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) ) );
 407+ $this->getOutput()->wrapWikiMsg( "<p class=\"mw-search-createlink\">\n$1</p>", $params );
399408 } else {
400409 // preserve the paragraph for margins etc...
401410 $wgOut->addHtml( '<p></p>' );
@@ -840,13 +849,17 @@
841850 }
842851 $namespaceTables .= Xml::closeElement( 'table' );
843852 }
 853+
 854+ $showSections = array( 'namespaceTables' => $namespaceTables );
 855+
844856 // Show redirects check only if backend supports it
845 - $redirects = '';
846857 if( $this->getSearchEngine()->supports( 'list-redirects' ) ) {
847 - $redirects =
 858+ $showSections['redirects'] =
848859 Xml::checkLabel( wfMsg( 'powersearch-redir' ), 'redirs', 'redirs', $this->searchRedirects );
849860 }
850861
 862+ wfRunHooks( 'SpecialSearchPowerBox', array( &$showSections, $term, $opts ) );
 863+
851864 $hidden = '';
852865 unset( $opts['redirs'] );
853866 foreach( $opts as $key => $value ) {
@@ -882,9 +895,8 @@
883896 )
884897 ) .
885898 Xml::element( 'div', array( 'class' => 'divider' ), '', false ) .
886 - $namespaceTables .
887 - Xml::element( 'div', array( 'class' => 'divider' ), '', false ) .
888 - $redirects . $hidden .
 899+ implode( Xml::element( 'div', array( 'class' => 'divider' ), '', false ), $showSections ) .
 900+ $hidden .
889901 Xml::closeElement( 'fieldset' );
890902 }
891903
Property changes on: branches/wmf/1.18wmf1/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
892904 Merged /branches/REL1_18/phase3/includes/specials:r102560
893905 Merged /trunk/phase3/includes/specials:r97175
Property changes on: branches/wmf/1.18wmf1/includes
___________________________________________________________________
Modified: svn:mergeinfo
894906 Merged /branches/REL1_18/phase3/includes:r102560
895907 Merged /trunk/phase3/includes:r97175
Property changes on: branches/wmf/1.18wmf1
___________________________________________________________________
Modified: svn:mergeinfo
896908 Merged /branches/REL1_18/phase3:r102560
897909 Merged /trunk/phase3:r97175

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97175Re-do reverted r96824, but in SpecialSearch first return if the title object ...robin16:26, 15 September 2011
r102560REL1_18 Partial MFT for r97175reedy19:32, 9 November 2011

Status & tagging log