25 namespace MediaWiki\Specials;
48 private $mungedQuery =
false;
58 private function setParams( $params ) {
59 $this->mQuery = $params[
'query'];
60 $this->mNs = $params[
'namespace'];
61 $this->mProt = $params[
'protocol'];
74 parent::__construct(
'LinkSearch' );
77 $this->urlUtils = $urlUtils;
89 $out->setPreventClickjacking(
false );
92 $target = $request->getVal(
'target', $par ??
'' );
93 $namespace = $request->getIntOrNull(
'namespace' );
97 if ( $prot !==
'//' ) {
98 $protocols_list[] = $prot;
104 $bits = $this->urlUtils->parse( $target );
105 if ( isset( $bits[
'scheme'] ) && isset( $bits[
'delimiter'] ) ) {
106 $protocol = $bits[
'scheme'] . $bits[
'delimiter'];
108 if ( str_starts_with( strtolower( $target ), strtolower( $protocol ) ) ) {
109 $target2 = substr( $target, strlen( $protocol ) );
118 '<nowiki>' . $this->
getLanguage()->commaList( $protocols_list ) .
'</nowiki>',
119 count( $protocols_list )
127 'label-message' =>
'linksearch-pat',
128 'default' => $target,
135 'type' =>
'namespaceselect',
136 'name' =>
'namespace',
137 'label-message' =>
'linksearch-ns',
138 'default' => $namespace,
141 'cssclass' =>
'namespaceselector',
146 $htmlForm->setSubmitTextMsg(
'linksearch-ok' );
147 $htmlForm->setWrapperLegendMsg(
'linksearch' );
149 $htmlForm->setMethod(
'get' );
150 $htmlForm->prepareForm()->displayForm(
false );
153 if ( $target !=
'' ) {
156 'namespace' => $namespace,
157 'protocol' => $protocol ] );
158 parent::execute( $par );
159 if ( $this->mungedQuery ===
false ) {
160 $out->addWikiMsg(
'linksearch-error' );
175 $params[
'target'] = $this->mProt . $this->mQuery;
177 $params[
'namespace'] = $this->mNs;
186 $field =
'el_to_domain_index';
188 'urldomain' =>
'el_to_domain_index',
189 'urlpath' =>
'el_to_path'
191 if ( $this->mQuery ===
'*' && $this->mProt !==
'' ) {
192 $this->mungedQuery = [
193 $field . $dbr->buildLike( $this->mProt, $dbr->anyString() ),
197 'protocol' => $this->mProt,
198 'oneWildcard' =>
true,
201 if ( $this->mungedQuery ===
false ) {
203 return [
'tables' =>
'page',
'fields' =>
'page_id',
'conds' =>
'0=1' ];
206 $orderBy = [
'el_id' ];
209 'tables' => [
'page',
'externallinks' ],
210 'fields' => array_merge( [
211 'namespace' =>
'page_namespace',
212 'title' =>
'page_title',
214 'conds' => array_merge(
220 'options' => [
'ORDER BY' => $orderBy ]
224 $retval[
'conds'][
'page_namespace'] = $this->mNs;
246 $title =
new TitleValue( (
int)$result->namespace, $result->title );
252 return $this->
msg(
'linksearch-line' )->rawParams( $urlLink, $pageLink )->escaped();
276 return max( parent::getMaxResults(), 60000 );
283 class_alias( SpecialLinkSearch::class,
'SpecialLinkSearch' );
A class containing constants representing the names of configuration variables.
const UrlProtocols
Name constant for the UrlProtocols setting, for use with Config::get()
const MiserMode
Name constant for the MiserMode setting, for use with Config::get()
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
setDatabaseProvider(IConnectionProvider $databaseProvider)
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getPageTitle( $subpage=false)
Get a self-referential title object.
getConfig()
Shortcut to get main config object.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getLanguage()
Shortcut to get user's language.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
static normalizeLinkUrl( $url)
Replace unusual escape codes in a URL with their equivalent characters.
The base class for all skins.