MediaWiki REL1_32
SpecialSearch.php
Go to the documentation of this file.
1<?php
33
47 protected $profile;
48
50 protected $searchEngine;
51
54
56 protected $extraParams = [];
57
62 protected $mPrefix;
63
67 protected $limit, $offset;
68
72 protected $namespaces;
73
77 protected $fulltext;
78
82 protected $sort;
83
87 protected $runSuggestion = true;
88
93 protected $searchConfig;
94
95 const NAMESPACES_CURRENT = 'sense';
96
97 public function __construct() {
98 parent::__construct( 'Search' );
99 $this->searchConfig = MediaWikiServices::getInstance()->getSearchEngineConfig();
100 }
101
107 public function execute( $par ) {
108 $request = $this->getRequest();
109 $out = $this->getOutput();
110
111 // Fetch the search term
112 $term = str_replace( "\n", " ", $request->getText( 'search' ) );
113
114 // Historically search terms have been accepted not only in the search query
115 // parameter, but also as part of the primary url. This can have PII implications
116 // in releasing page view data. As such issue a 301 redirect to the correct
117 // URL.
118 if ( strlen( $par ) && !strlen( $term ) ) {
119 $query = $request->getValues();
120 unset( $query['title'] );
121 // Strip underscores from title parameter; most of the time we'll want
122 // text form here. But don't strip underscores from actual text params!
123 $query['search'] = str_replace( '_', ' ', $par );
124 $out->redirect( $this->getPageTitle()->getFullURL( $query ), 301 );
125 return;
126 }
127
128 // Need to load selected namespaces before handling nsRemember
129 $this->load();
130 // TODO: This performs database actions on GET request, which is going to
131 // be a problem for our multi-datacenter work.
132 if ( !is_null( $request->getVal( 'nsRemember' ) ) ) {
133 $this->saveNamespaces();
134 // Remove the token from the URL to prevent the user from inadvertently
135 // exposing it (e.g. by pasting it into a public wiki page) or undoing
136 // later settings changes (e.g. by reloading the page).
137 $query = $request->getValues();
138 unset( $query['title'], $query['nsRemember'] );
139 $out->redirect( $this->getPageTitle()->getFullURL( $query ) );
140 return;
141 }
142
143 $this->searchEngineType = $request->getVal( 'srbackend' );
144 if (
145 !$request->getVal( 'fulltext' ) &&
146 $request->getVal( 'offset' ) === null
147 ) {
148 $url = $this->goResult( $term );
149 if ( $url !== null ) {
150 // successful 'go'
151 $out->redirect( $url );
152 return;
153 }
154 // No match. If it could plausibly be a title
155 // run the No go match hook.
156 $title = Title::newFromText( $term );
157 if ( !is_null( $title ) ) {
158 Hooks::run( 'SpecialSearchNogomatch', [ &$title ] );
159 }
160 }
161
162 $this->setupPage( $term );
163
164 if ( $this->getConfig()->get( 'DisableTextSearch' ) ) {
165 $searchForwardUrl = $this->getConfig()->get( 'SearchForwardUrl' );
166 if ( $searchForwardUrl ) {
167 $url = str_replace( '$1', urlencode( $term ), $searchForwardUrl );
168 $out->redirect( $url );
169 } else {
170 $out->addHTML(
171 "<fieldset>" .
172 "<legend>" .
173 $this->msg( 'search-external' )->escaped() .
174 "</legend>" .
175 "<p class='mw-searchdisabled'>" .
176 $this->msg( 'searchdisabled' )->escaped() .
177 "</p>" .
178 $this->msg( 'googlesearch' )->rawParams(
179 htmlspecialchars( $term ),
180 'UTF-8',
181 $this->msg( 'searchbutton' )->escaped()
182 )->text() .
183 "</fieldset>"
184 );
185 }
186
187 return;
188 }
189
190 $this->showResults( $term );
191 }
192
198 public function load() {
199 $request = $this->getRequest();
200 list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, '' );
201 $this->mPrefix = $request->getVal( 'prefix', '' );
202 if ( $this->mPrefix !== '' ) {
203 $this->setExtraParam( 'prefix', $this->mPrefix );
204 }
205
206 $this->sort = $request->getVal( 'sort', SearchEngine::DEFAULT_SORT );
207 if ( $this->sort !== SearchEngine::DEFAULT_SORT ) {
208 $this->setExtraParam( 'sort', $this->sort );
209 }
210
211 $user = $this->getUser();
212
213 # Extract manually requested namespaces
214 $nslist = $this->powerSearch( $request );
215 if ( !count( $nslist ) ) {
216 # Fallback to user preference
217 $nslist = $this->searchConfig->userNamespaces( $user );
218 }
219
220 $profile = null;
221 if ( !count( $nslist ) ) {
222 $profile = 'default';
223 }
224
225 $profile = $request->getVal( 'profile', $profile );
226 $profiles = $this->getSearchProfiles();
227 if ( $profile === null ) {
228 // BC with old request format
229 $profile = 'advanced';
230 foreach ( $profiles as $key => $data ) {
231 if ( $nslist === $data['namespaces'] && $key !== 'advanced' ) {
232 $profile = $key;
233 }
234 }
235 $this->namespaces = $nslist;
236 } elseif ( $profile === 'advanced' ) {
237 $this->namespaces = $nslist;
238 } else {
239 if ( isset( $profiles[$profile]['namespaces'] ) ) {
240 $this->namespaces = $profiles[$profile]['namespaces'];
241 } else {
242 // Unknown profile requested
243 $profile = 'default';
244 $this->namespaces = $profiles['default']['namespaces'];
245 }
246 }
247
248 $this->fulltext = $request->getVal( 'fulltext' );
249 $this->runSuggestion = (bool)$request->getVal( 'runsuggestion', true );
250 $this->profile = $profile;
251 }
252
259 public function goResult( $term ) {
260 # If the string cannot be used to create a title
261 if ( is_null( Title::newFromText( $term ) ) ) {
262 return null;
263 }
264 # If there's an exact or very near match, jump right there.
265 $title = $this->getSearchEngine()
266 ->getNearMatcher( $this->getConfig() )->getNearMatch( $term );
267 if ( is_null( $title ) ) {
268 return null;
269 }
270 $url = null;
271 if ( !Hooks::run( 'SpecialSearchGoResult', [ $term, $title, &$url ] ) ) {
272 return null;
273 }
274
275 return $url ?? $title->getFullUrlForRedirect();
276 }
277
281 public function showResults( $term ) {
282 if ( $this->searchEngineType !== null ) {
283 $this->setExtraParam( 'srbackend', $this->searchEngineType );
284 }
285
286 $out = $this->getOutput();
288 $this,
289 $this->searchConfig,
290 $this->getSearchProfiles()
291 );
292 $filePrefix = MediaWikiServices::getInstance()->getContentLanguage()->
293 getFormattedNsText( NS_FILE ) . ':';
294 if ( trim( $term ) === '' || $filePrefix === trim( $term ) ) {
295 // Empty query -- straight view of search form
296 if ( !Hooks::run( 'SpecialSearchResultsPrepend', [ $this, $out, $term ] ) ) {
297 # Hook requested termination
298 return;
299 }
300 $out->enableOOUI();
301 // The form also contains the 'Showing results 0 - 20 of 1234' so we can
302 // only do the form render here for the empty $term case. Rendering
303 // the form when a search is provided is repeated below.
304 $out->addHTML( $formWidget->render(
305 $this->profile, $term, 0, 0, $this->offset, $this->isPowerSearch()
306 ) );
307 return;
308 }
309
310 $search = $this->getSearchEngine();
311 $search->setFeatureData( 'rewrite', $this->runSuggestion );
312 $search->setLimitOffset( $this->limit, $this->offset );
313 $search->setNamespaces( $this->namespaces );
314 $search->setSort( $this->sort );
315 $search->prefix = $this->mPrefix;
316
317 Hooks::run( 'SpecialSearchSetupEngine', [ $this, $this->profile, $search ] );
318 if ( !Hooks::run( 'SpecialSearchResultsPrepend', [ $this, $out, $term ] ) ) {
319 # Hook requested termination
320 return;
321 }
322
323 $title = Title::newFromText( $term );
324 $showSuggestion = $title === null || !$title->isKnown();
325 $search->setShowSuggestion( $showSuggestion );
326
327 $rewritten = $search->transformSearchTerm( $term );
328 if ( $rewritten !== $term ) {
329 $term = $rewritten;
330 wfDeprecated( 'SearchEngine::transformSearchTerm() (overridden by ' .
331 get_class( $search ) . ')', '1.32' );
332 }
333
334 $rewritten = $search->replacePrefixes( $term );
335 if ( $rewritten !== $term ) {
336 wfDeprecated( 'SearchEngine::replacePrefixes() (overridden by ' .
337 get_class( $search ) . ')', '1.32' );
338 }
339
340 // fetch search results
341 $titleMatches = $search->searchTitle( $rewritten );
342 $textMatches = $search->searchText( $rewritten );
343
344 $textStatus = null;
345 if ( $textMatches instanceof Status ) {
346 $textStatus = $textMatches;
347 $textMatches = $textStatus->getValue();
348 }
349
350 // Get number of results
351 $titleMatchesNum = $textMatchesNum = $numTitleMatches = $numTextMatches = 0;
352 if ( $titleMatches ) {
353 $titleMatchesNum = $titleMatches->numRows();
354 $numTitleMatches = $titleMatches->getTotalHits();
355 }
356 if ( $textMatches ) {
357 $textMatchesNum = $textMatches->numRows();
358 $numTextMatches = $textMatches->getTotalHits();
359 if ( $textMatchesNum > 0 ) {
360 $search->augmentSearchResults( $textMatches );
361 }
362 }
363 $num = $titleMatchesNum + $textMatchesNum;
364 $totalRes = $numTitleMatches + $numTextMatches;
365
366 // start rendering the page
367 $out->enableOOUI();
368 $out->addHTML( $formWidget->render(
369 $this->profile, $term, $num, $totalRes, $this->offset, $this->isPowerSearch()
370 ) );
371
372 // did you mean... suggestions
373 if ( $textMatches ) {
374 $dymWidget = new MediaWiki\Widget\Search\DidYouMeanWidget( $this );
375 $out->addHTML( $dymWidget->render( $term, $textMatches ) );
376 }
377
378 $hasErrors = $textStatus && $textStatus->getErrors() !== [];
379 $hasOtherResults = $textMatches &&
380 $textMatches->hasInterwikiResults( SearchResultSet::INLINE_RESULTS );
381
382 if ( $textMatches && $textMatches->hasInterwikiResults( SearchResultSet::SECONDARY_RESULTS ) ) {
383 $out->addHTML( '<div class="searchresults mw-searchresults-has-iw">' );
384 } else {
385 $out->addHTML( '<div class="searchresults">' );
386 }
387
388 if ( $hasErrors ) {
389 list( $error, $warning ) = $textStatus->splitByErrorType();
390 if ( $error->getErrors() ) {
391 $out->addHTML( Html::errorBox(
392 $error->getHTML( 'search-error' )
393 ) );
394 }
395 if ( $warning->getErrors() ) {
396 $out->addHTML( Html::warningBox(
397 $warning->getHTML( 'search-warning' )
398 ) );
399 }
400 }
401
402 // Show the create link ahead
403 $this->showCreateLink( $title, $num, $titleMatches, $textMatches );
404
405 Hooks::run( 'SpecialSearchResults', [ $term, &$titleMatches, &$textMatches ] );
406
407 // If we have no results and have not already displayed an error message
408 if ( $num === 0 && !$hasErrors ) {
409 $out->wrapWikiMsg( "<p class=\"mw-search-nonefound\">\n$1</p>", [
410 $hasOtherResults ? 'search-nonefound-thiswiki' : 'search-nonefound',
412 ] );
413 }
414
415 // Although $num might be 0 there can still be secondary or inline
416 // results to display.
418 $mainResultWidget = new FullSearchResultWidget( $this, $linkRenderer );
419
420 // Default (null) on. Can be explicitly disabled.
421 if ( $search->getFeatureData( 'enable-new-crossproject-page' ) !== false ) {
422 $sidebarResultWidget = new InterwikiSearchResultWidget( $this, $linkRenderer );
423 $sidebarResultsWidget = new InterwikiSearchResultSetWidget(
424 $this,
425 $sidebarResultWidget,
427 MediaWikiServices::getInstance()->getInterwikiLookup(),
428 $search->getFeatureData( 'show-multimedia-search-results' )
429 );
430 } else {
431 $sidebarResultWidget = new SimpleSearchResultWidget( $this, $linkRenderer );
432 $sidebarResultsWidget = new SimpleSearchResultSetWidget(
433 $this,
434 $sidebarResultWidget,
436 MediaWikiServices::getInstance()->getInterwikiLookup()
437 );
438 }
439
440 $widget = new BasicSearchResultSetWidget( $this, $mainResultWidget, $sidebarResultsWidget );
441
442 $out->addHTML( $widget->render(
443 $term, $this->offset, $titleMatches, $textMatches
444 ) );
445
446 if ( $titleMatches ) {
447 $titleMatches->free();
448 }
449
450 if ( $textMatches ) {
451 $textMatches->free();
452 }
453
454 $out->addHTML( '<div class="mw-search-visualclear"></div>' );
455
456 // prev/next links
457 if ( $totalRes > $this->limit || $this->offset ) {
458 // Allow matches to define the correct offset, as interleaved
459 // AB testing may require a different next page offset.
460 if ( $textMatches && $textMatches->getOffset() !== null ) {
461 $offset = $textMatches->getOffset();
462 } else {
463 $offset = $this->offset;
464 }
465
466 $prevnext = $this->getLanguage()->viewPrevNext(
467 $this->getPageTitle(),
468 $offset,
469 $this->limit,
470 $this->powerSearchOptions() + [ 'search' => $term ],
471 $this->limit + $this->offset >= $totalRes
472 );
473 $out->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
474 }
475
476 // Close <div class='searchresults'>
477 $out->addHTML( "</div>" );
478
479 Hooks::run( 'SpecialSearchResultsAppend', [ $this, $out, $term ] );
480 }
481
488 protected function showCreateLink( $title, $num, $titleMatches, $textMatches ) {
489 // show direct page/create link if applicable
490
491 // Check DBkey !== '' in case of fragment link only.
492 if ( is_null( $title ) || $title->getDBkey() === ''
493 || ( $titleMatches !== null && $titleMatches->searchContainedSyntax() )
494 || ( $textMatches !== null && $textMatches->searchContainedSyntax() )
495 ) {
496 // invalid title
497 // preserve the paragraph for margins etc...
498 $this->getOutput()->addHTML( '<p></p>' );
499
500 return;
501 }
502
503 $messageName = 'searchmenu-new-nocreate';
504 $linkClass = 'mw-search-createlink';
505
506 if ( !$title->isExternal() ) {
507 if ( $title->isKnown() ) {
508 $messageName = 'searchmenu-exists';
509 $linkClass = 'mw-search-exists';
510 } elseif ( ContentHandler::getForTitle( $title )->supportsDirectEditing()
511 && $title->quickUserCan( 'create', $this->getUser() )
512 ) {
513 $messageName = 'searchmenu-new';
514 }
515 }
516
517 $params = [
518 $messageName,
519 wfEscapeWikiText( $title->getPrefixedText() ),
520 Message::numParam( $num )
521 ];
522 Hooks::run( 'SpecialSearchCreateLink', [ $title, &$params ] );
523
524 // Extensions using the hook might still return an empty $messageName
525 if ( $messageName ) {
526 $this->getOutput()->wrapWikiMsg( "<p class=\"$linkClass\">\n$1</p>", $params );
527 } else {
528 // preserve the paragraph for margins etc...
529 $this->getOutput()->addHTML( '<p></p>' );
530 }
531 }
532
539 protected function setupPage( $term ) {
540 $out = $this->getOutput();
541
542 $this->setHeaders();
543 $this->outputHeader();
544 // TODO: Is this true? The namespace remember uses a user token
545 // on save.
546 $out->allowClickjacking();
547 $this->addHelpLink( 'Help:Searching' );
548
549 if ( strval( $term ) !== '' ) {
550 $out->setPageTitle( $this->msg( 'searchresults' ) );
551 $out->setHTMLTitle( $this->msg( 'pagetitle' )
552 ->plaintextParams( $this->msg( 'searchresults-title' )->plaintextParams( $term )->text() )
553 ->inContentLanguage()->text()
554 );
555 }
556
557 if ( $this->mPrefix !== '' ) {
558 $subtitle = $this->msg( 'search-filter-title-prefix' )->plaintextParams( $this->mPrefix );
559 $params = $this->powerSearchOptions();
560 unset( $params['prefix'] );
561 $params += [
562 'search' => $term,
563 'fulltext' => 1,
564 ];
565
566 $subtitle .= ' (';
567 $subtitle .= Xml::element(
568 'a',
569 [
570 'href' => $this->getPageTitle()->getLocalURL( $params ),
571 'title' => $this->msg( 'search-filter-title-prefix-reset' )->text(),
572 ],
573 $this->msg( 'search-filter-title-prefix-reset' )->text()
574 );
575 $subtitle .= ')';
576 $out->setSubtitle( $subtitle );
577 }
578
579 $out->addJsConfigVars( [ 'searchTerm' => $term ] );
580 $out->addModules( 'mediawiki.special.search' );
581 $out->addModuleStyles( [
582 'mediawiki.special', 'mediawiki.special.search.styles', 'mediawiki.ui', 'mediawiki.ui.button',
583 'mediawiki.ui.input', 'mediawiki.widgets.SearchInputWidget.styles',
584 ] );
585 }
586
592 protected function isPowerSearch() {
593 return $this->profile === 'advanced';
594 }
595
603 protected function powerSearch( &$request ) {
604 $arr = [];
605 foreach ( $this->searchConfig->searchableNamespaces() as $ns => $name ) {
606 if ( $request->getCheck( 'ns' . $ns ) ) {
607 $arr[] = $ns;
608 }
609 }
610
611 return $arr;
612 }
613
621 public function powerSearchOptions() {
622 $opt = [];
623 if ( $this->isPowerSearch() ) {
624 foreach ( $this->namespaces as $n ) {
625 $opt['ns' . $n] = 1;
626 }
627 } else {
628 $opt['profile'] = $this->profile;
629 }
630
631 return $opt + $this->extraParams;
632 }
633
639 protected function saveNamespaces() {
640 $user = $this->getUser();
641 $request = $this->getRequest();
642
643 if ( $user->isLoggedIn() &&
644 $user->matchEditToken(
645 $request->getVal( 'nsRemember' ),
646 'searchnamespace',
648 ) && !wfReadOnly()
649 ) {
650 // Reset namespace preferences: namespaces are not searched
651 // when they're not mentioned in the URL parameters.
652 foreach ( MWNamespace::getValidNamespaces() as $n ) {
653 $user->setOption( 'searchNs' . $n, false );
654 }
655 // The request parameters include all the namespaces to be searched.
656 // Even if they're the same as an existing profile, they're not eaten.
657 foreach ( $this->namespaces as $n ) {
658 $user->setOption( 'searchNs' . $n, true );
659 }
660
661 DeferredUpdates::addCallableUpdate( function () use ( $user ) {
662 $user->saveSettings();
663 } );
664
665 return true;
666 }
667
668 return false;
669 }
670
674 protected function getSearchProfiles() {
675 // Builds list of Search Types (profiles)
676 $nsAllSet = array_keys( $this->searchConfig->searchableNamespaces() );
677 $defaultNs = $this->searchConfig->defaultNamespaces();
678 $profiles = [
679 'default' => [
680 'message' => 'searchprofile-articles',
681 'tooltip' => 'searchprofile-articles-tooltip',
682 'namespaces' => $defaultNs,
683 'namespace-messages' => $this->searchConfig->namespacesAsText(
684 $defaultNs
685 ),
686 ],
687 'images' => [
688 'message' => 'searchprofile-images',
689 'tooltip' => 'searchprofile-images-tooltip',
690 'namespaces' => [ NS_FILE ],
691 ],
692 'all' => [
693 'message' => 'searchprofile-everything',
694 'tooltip' => 'searchprofile-everything-tooltip',
695 'namespaces' => $nsAllSet,
696 ],
697 'advanced' => [
698 'message' => 'searchprofile-advanced',
699 'tooltip' => 'searchprofile-advanced-tooltip',
700 'namespaces' => self::NAMESPACES_CURRENT,
701 ]
702 ];
703
704 Hooks::run( 'SpecialSearchProfiles', [ &$profiles ] );
705
706 foreach ( $profiles as &$data ) {
707 if ( !is_array( $data['namespaces'] ) ) {
708 continue;
709 }
710 sort( $data['namespaces'] );
711 }
712
713 return $profiles;
714 }
715
721 public function getSearchEngine() {
722 if ( $this->searchEngine === null ) {
723 $services = MediaWikiServices::getInstance();
724 $this->searchEngine = $this->searchEngineType ?
725 $services->getSearchEngineFactory()->create( $this->searchEngineType ) :
726 $services->newSearchEngine();
727 }
728
729 return $this->searchEngine;
730 }
731
736 function getProfile() {
737 return $this->profile;
738 }
739
744 function getNamespaces() {
745 return $this->namespaces;
746 }
747
757 public function setExtraParam( $key, $value ) {
758 $this->extraParams[$key] = $value;
759 }
760
769 public function getPrefix() {
770 return $this->mPrefix;
771 }
772
773 protected function getGroupName() {
774 return 'pages';
775 }
776}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
to move a page</td >< td > &*You are moving the page across namespaces
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
wfReadOnly()
Check whether the wiki is in read-only mode.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Renders a suggested search for the user, or tells the user a suggested search was run instead of the ...
Renders a 'full' multi-line search result with metadata.
Renders one or more SearchResultSets into a sidebar grouped by interwiki prefix.
Renders one or more SearchResultSets into a sidebar grouped by interwiki prefix.
Configuration handling class for SearchEngine.
Contain a class for special pages.
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
implements Special:Search - Run text & title search and display the output
goResult( $term)
If an exact title match can be found, jump straight ahead to it.
setExtraParam( $key, $value)
Users of hook SpecialSearchSetupEngine can use this to add more params to links to not lose selection...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
string $mPrefix
The prefix url parameter.
const NAMESPACES_CURRENT
null string $profile
Current search profile.
load()
Set up basic search parameters from the request and user settings.
SearchEngineConfig $searchConfig
Search engine configurations.
getPrefix()
The prefix value send to Special:Search using the 'prefix' URI param It means that the user is willin...
saveNamespaces()
Save namespace preferences when we're supposed to.
getProfile()
Current search profile.
SearchEngine $searchEngine
Search engine.
isPowerSearch()
Return true if current search is a power (advanced) search.
getNamespaces()
Current namespaces.
powerSearchOptions()
Reconstruct the 'power search' options for links TODO: Instead of exposing this publicly,...
string $searchEngineType
Search engine type, if not default.
powerSearch(&$request)
Extract "power search" namespace settings from the request object, returning a list of index numbers ...
array $extraParams
For links.
execute( $par)
Entry point.
setupPage( $term)
Sets up everything for the HTML output page including styles, javascript, page title,...
showCreateLink( $title, $num, $titleMatches, $textMatches)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:40
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
const NS_FILE
Definition Defines.php:70
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition hooks.txt:2880
namespace and then decline to actually register it & $namespaces
Definition hooks.txt:964
For QUnit the mediawiki tests qunit testrunner dependency will be added to any module whereas SearchGetNearMatch runs after $term
Definition hooks.txt:2926
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:994
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
Definition hooks.txt:2335
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition hooks.txt:894
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:302
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition hooks.txt:1656
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
Definition hooks.txt:2105
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition hooks.txt:247
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
MediaWiki has optional support for a high distributed memory object caching system For general information on but for a larger site with heavy load
Definition memcached.txt:6
$params