Go to the documentation of this file.
56 $allSearchTerms = [ $searchterm ];
58 if (
$lang->hasVariants() ) {
59 $allSearchTerms = array_unique( array_merge(
61 $lang->autoConvertToAllVariants( $searchterm )
66 if ( !
Hooks::run(
'SearchGetNearMatchBefore', [ $allSearchTerms, &$titleResult ] ) ) {
73 if ( $searchterm ===
'' || $searchterm[0] ===
'#' ) {
77 foreach ( $allSearchTerms
as $term ) {
78 # Exact match? No need to look further.
84 # Try files if searching in the Media: namespace
93 # See if it still otherwise has content is some sane sense
95 if ( $page->hasViewableContent() ) {
103 # Now try all lower case (i.e. first letter capitalized)
109 # Now try capitalized string
115 # Now try all upper case
121 # Now try Word-Caps-Breaking-At-Word-Breaks, for hyphenated names etc
136 # Entering an IP address goes to the contributions page
137 if ( $this->config->get(
'EnableSearchContributorsByIP' ) ) {
144 # Entering a user goes to the user page whether it's there or not
149 # Go to images that exist even if there's no local page.
150 # There may have been a funny upload, or it may be on a shared
151 # file repository such as Wikimedia Commons.
159 # MediaWiki namespace? Page may be "implied" if not customized.
160 # Just return it, with caps forced as the message system likes it.
165 # Quoted term? Try without the quotes...
167 if ( preg_match(
'/^"([^"]+)"$/', $searchterm,
$matches ) ) {
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getNearMatchInternal( $searchterm)
Really find the title match.
if(!isset( $args[0])) $lang
getNearMatch( $searchterm)
If an exact title match can be found, or a very slightly close match, return the title.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
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
Interface for configuration instances.
namespace and then decline to actually register it file or subcat img or subcat $title
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Implementation of near match title search.
static isIP( $name)
Does the string match an anonymous IP address?
A SearchResultSet wrapper for SearchNearMatcher.
getNearMatchResultSet( $searchterm)
Do a near match (see SearchEngine::getNearMatch) and wrap it into a SearchResultSet.
Language $language
Current language.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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 modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check $image
whereas SearchGetNearMatch runs after $term
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying
wfFindFile( $title, $options=[])
Find a file.
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
__construct(Config $config, Language $lang)
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Internationalisation code.