r102560 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102559‎ | r102560 | r102561 >
Date:19:32, 9 November 2011
Author:reedy
Status:ok
Tags:
Comment:
REL1_18 Partial MFT for r97175
Modified paths:
  • /branches/REL1_18/phase3 (modified) (history)
  • /branches/REL1_18/phase3/docs/hooks.txt (modified) (history)
  • /branches/REL1_18/phase3/includes (modified) (history)
  • /branches/REL1_18/phase3/includes/specials (modified) (history)
  • /branches/REL1_18/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/docs/hooks.txt
@@ -1684,6 +1684,11 @@
16851685 &$query_options: array of options for the database request
16861686 &$select: Array of columns to select
16871687
 1688+'SpecialSearchCreateLink': called when making the message to create a page or
 1689+go to the existing page
 1690+$t: title object searched for
 1691+&$params: an array of the default message name and page title (as parameter)
 1692+
16881693 'SpecialSearchGo': called when user clicked the "Go"
16891694 &$title: title object generated from the text entered by the user
16901695 &$term: the search term entered by the user
@@ -1692,6 +1697,12 @@
16931698 target doesn't exist
16941699 &$title: title object generated from the text entered by the user
16951700
 1701+'SpecialSearchPowerBox': the equivalent of SpecialSearchProfileForm for
 1702+the advanced form, a.k.a. power search box
 1703+&$showSections: an array to add values with more options to
 1704+$term: the search term (not a title object)
 1705+$opts: an array of hidden options (containing 'redirs' and 'profile')
 1706+
16961707 'SpecialSearchProfiles': allows modification of search profiles
16971708 &$profiles: profiles, which can be modified.
16981709
Property changes on: branches/REL1_18/phase3/docs/hooks.txt
___________________________________________________________________
Modified: svn:mergeinfo
16991710 Merged /trunk/phase3/docs/hooks.txt:r97175
Index: branches/REL1_18/phase3/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/REL1_18/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
892904 Merged /trunk/phase3/includes/specials:r97175
Property changes on: branches/REL1_18/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
893905 Merged /trunk/phase3/includes:r97175
Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
894906 Merged /trunk/phase3:r97175

Follow-up revisions

RevisionCommit summaryAuthorDate
r105888Merge r102560, essentially merging r97175 into 1.18wmf1reedy15:25, 12 December 2011

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

Status & tagging log