43 $this->mQuery = $params[
'query'];
44 $this->mNs = $params[
'namespace'];
45 $this->mProt = $params[
'protocol'];
49 parent::__construct( $name );
65 $out->allowClickjacking();
68 $target = $request->getVal(
'target', $par ??
'' );
69 $namespace = $request->getIntOrNull(
'namespace' );
72 foreach ( $this->
getConfig()->
get(
'UrlProtocols' ) as $prot ) {
73 if ( $prot !==
'//' ) {
74 $protocols_list[] = $prot;
78 $target2 = Parser::normalizeLinkUrl( $target );
80 $protocol =
'http://';
82 if ( isset( $bits[
'scheme'] ) && isset( $bits[
'delimiter'] ) ) {
83 $protocol = $bits[
'scheme'] . $bits[
'delimiter'];
86 if ( strcasecmp( $protocol, substr( $target, 0, strlen( $protocol ) ) ) === 0 ) {
87 $target2 = substr( $target, strlen( $protocol ) );
96 '<nowiki>' . $this->
getLanguage()->commaList( $protocols_list ) .
'</nowiki>',
97 count( $protocols_list )
105 'label-message' =>
'linksearch-pat',
106 'default' => $target,
110 if ( !$this->
getConfig()->
get(
'MiserMode' ) ) {
113 'type' =>
'namespaceselect',
114 'name' =>
'namespace',
115 'label-message' =>
'linksearch-ns',
116 'default' => $namespace,
119 'cssclass' =>
'namespaceselector',
126 $htmlForm = HTMLForm::factory(
'ooui', $fields, $this->
getContext() );
127 $htmlForm->addHiddenFields( $hiddenFields );
128 $htmlForm->setSubmitTextMsg(
'linksearch-ok' );
129 $htmlForm->setWrapperLegendMsg(
'linksearch' );
131 $htmlForm->setMethod(
'get' );
132 $htmlForm->prepareForm()->displayForm(
false );
135 if ( $target !=
'' ) {
138 'namespace' => $namespace,
139 'protocol' => $protocol ] );
140 parent::execute( $par );
141 if ( $this->mungedQuery ===
false ) {
142 $out->addWikiMsg(
'linksearch-error' );
158 if ( $this->mNs !==
null && !$this->
getConfig()->
get(
'MiserMode' ) ) {
169 if ( $this->mQuery ===
'*' && $this->mProt !==
'' ) {
170 $this->mungedQuery = [
171 'el_index_60' .
$dbr->buildLike( $this->mProt,
$dbr->anyString() ),
175 'protocol' => $this->mProt,
176 'oneWildcard' =>
true,
179 if ( $this->mungedQuery ===
false ) {
181 return [
'tables' =>
'page',
'fields' =>
'page_id',
'conds' =>
'0=1' ];
183 $orderBy[] =
'el_index_60';
186 $orderBy[] =
'el_id';
189 'tables' => [
'page',
'externallinks' ],
191 'namespace' =>
'page_namespace',
192 'title' =>
'page_title',
193 'value' =>
'el_index',
196 'conds' => array_merge(
202 'options' => [
'ORDER BY' => $orderBy ]
205 if ( $this->mNs !==
null && !$this->
getConfig()->
get(
'MiserMode' ) ) {
206 $retval[
'conds'][
'page_namespace'] =
$this->mNs;
234 return $this->
msg(
'linksearch-line' )->rawParams( $urlLink, $pageLink )->escaped();
258 return max( parent::getMaxResults(), 60000 );
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
static getQueryConditions( $filterEntry, array $options=[])
Return query conditions which will match the specified string.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
Special:LinkSearch to search the external-links table.
__construct( $name='LinkSearch')
execute( $par)
This is the actual workhorse.
isSyndicated()
Disable RSS/Atom feeds.
getOrderFields()
Override to squash the ORDER BY.
linkParameters()
If using extra form wheely-dealies, return a set of parameters here as an associative array.
formatResult( $skin, $result)
getMaxResults()
enwiki complained about low limits on this special page
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
isCacheable()
Is the output of this query cacheable? Non-cacheable expensive pages will be disabled in miser mode a...
preprocessResults( $db, $res)
Pre-fill the link cache.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
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.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
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.
Represents a page (or page fragment) title within MediaWiki.