X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialWhatlinkshere.php;h=47fd972e4c907159fe6f1b6baa764b46a0b12c95;hb=8a5b362c435a054918a2392bc9d470ff85992022;hp=39980d298c92c66ce26385ebc7d47f886799cb03;hpb=298e55a5b7de57f129735f0c103e4d951c550a39;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index 39980d298c..47fd972e4c 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -72,7 +72,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { // Bind to member variable $this->opts = $opts; - $this->target = Title::newFromURL( $opts->getValue( 'target' ) ); + $this->target = Title::newFromText( $opts->getValue( 'target' ) ); if ( !$this->target ) { if ( !$this->including() ) { $out->addHTML( $this->whatlinkshereForm() ); @@ -127,20 +127,13 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { 'il_to' => $target->getDBkey(), ); - $useLinkNamespaceDBFields = $this->getConfig()->get( 'UseLinkNamespaceDBFields' ); $namespace = $this->opts->getValue( 'namespace' ); $invert = $this->opts->getValue( 'invert' ); $nsComparison = ( $invert ? '!= ' : '= ' ) . $dbr->addQuotes( $namespace ); if ( is_int( $namespace ) ) { - if ( $useLinkNamespaceDBFields ) { - $conds['pagelinks'][] = "pl_from_namespace $nsComparison"; - $conds['templatelinks'][] = "tl_from_namespace $nsComparison"; - $conds['imagelinks'][] = "il_from_namespace $nsComparison"; - } else { - $conds['pagelinks'][] = "page_namespace $nsComparison"; - $conds['templatelinks'][] = "page_namespace $nsComparison"; - $conds['imagelinks'][] = "page_namespace $nsComparison"; - } + $conds['pagelinks'][] = "pl_from_namespace $nsComparison"; + $conds['templatelinks'][] = "tl_from_namespace $nsComparison"; + $conds['imagelinks'][] = "il_from_namespace $nsComparison"; } if ( $from ) { @@ -156,7 +149,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { } $queryFunc = function ( IDatabase $dbr, $table, $fromCol ) use ( - $conds, $target, $limit, $useLinkNamespaceDBFields + $conds, $target, $limit ) { // Read an extra row as an at-end check $queryLimit = $limit + 1; @@ -165,9 +158,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { 'rd_title' => $target->getDBkey(), 'rd_interwiki = ' . $dbr->addQuotes( '' ) . ' OR rd_interwiki IS NULL' ); - if ( $useLinkNamespaceDBFields ) { // migration check - $on['rd_namespace'] = $target->getNamespace(); - } + $on['rd_namespace'] = $target->getNamespace(); // Inner LIMIT is 2X in case of stale backlinks with wrong namespaces $subQuery = $dbr->selectSqlText( array( $table, 'redirect', 'page' ), @@ -505,7 +496,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { $f .= ' '; # Submit - $f .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ); + $f .= Xml::submitButton( $this->msg( 'whatlinkshere-submit' )->text() ); # Close $f .= Xml::closeElement( 'fieldset' ) . Xml::closeElement( 'form' ) . "\n"; @@ -557,7 +548,9 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { * @return string[] Matching subpages */ public function prefixSearchSubpages( $search, $limit, $offset ) { - if ( $search === '' ) { + $title = Title::newFromText( $search ); + if ( !$title || !$title->canExist() ) { + // No prefix suggestion in special and media namespace return array(); } // Autocomplete subpage the same as a normal search