X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FPrefixSearch.php;h=55a4f49b34615768066c86ef0664c270b7b8ae53;hb=b3f9120af5fc883b38d5e7b55368ff61c2bbdd09;hp=a4e64ee63d14cc0a1e3100a9e28b731647407942;hpb=82a60eafad9bbc7aa1c65221cd73d716d1e0582a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/PrefixSearch.php b/includes/PrefixSearch.php index a4e64ee63d..55a4f49b34 100644 --- a/includes/PrefixSearch.php +++ b/includes/PrefixSearch.php @@ -65,7 +65,7 @@ abstract class PrefixSearch { $search = $title->getText(); if ( $ns[0] == NS_MAIN ) { $ns = $namespaces; // no explicit prefix, use default namespaces - wfRunHooks( 'PrefixSearchExtractNamespace', array( &$ns, &$search ) ); + Hooks::run( 'PrefixSearchExtractNamespace', array( &$ns, &$search ) ); } return $this->searchBackend( $ns, $search, $limit, $offset ); } @@ -79,7 +79,7 @@ abstract class PrefixSearch { $namespaces = array( $title->getNamespace() ); $search = ''; } else { - wfRunHooks( 'PrefixSearchExtractNamespace', array( &$namespaces, &$search ) ); + Hooks::run( 'PrefixSearchExtractNamespace', array( &$namespaces, &$search ) ); } return $this->searchBackend( $namespaces, $search, $limit, $offset ); @@ -95,7 +95,6 @@ abstract class PrefixSearch { * @return array */ public function searchWithVariants( $search, $limit, array $namespaces, $offset = 0 ) { - wfProfileIn( __METHOD__ ); $searches = $this->search( $search, $limit, $namespaces, $offset ); // if the content language has variants, try to retrieve fallback results @@ -116,7 +115,6 @@ abstract class PrefixSearch { } } } - wfProfileOut( __METHOD__ ); return $searches; } @@ -157,7 +155,10 @@ abstract class PrefixSearch { } } $srchres = array(); - if ( wfRunHooks( 'PrefixSearchBackend', array( $namespaces, $search, $limit, &$srchres, $offset ) ) ) { + if ( Hooks::run( + 'PrefixSearchBackend', + array( $namespaces, $search, $limit, &$srchres, $offset ) + ) ) { return $this->titles( $this->defaultSearchBackend( $namespaces, $search, $limit, $offset ) ); } return $this->strings( $this->handleResultFromHook( $srchres, $namespaces, $search, $limit ) ); @@ -199,19 +200,19 @@ abstract class PrefixSearch { return $this->pullFront( $key, $srchres ); } $redirectTargetsToRedirect = $this->redirectTargetsToRedirect( $srchres ); - if ( isset( $redirectTargetsToRedirect[ $target ] ) ) { + if ( isset( $redirectTargetsToRedirect[$target] ) ) { // The exact match and something in the results list are both redirects // to the same thing! In this case we'll pull the returned match to the // top following the same logic above. Again, it might not be a perfect // choice but it'll do. - return $this->pullFront( $redirectTargetsToRedirect[ $target ], $srchres ); + return $this->pullFront( $redirectTargetsToRedirect[$target], $srchres ); } } else { $redirectTargetsToRedirect = $this->redirectTargetsToRedirect( $srchres ); - if ( isset( $redirectTargetsToRedirect[ $string ] ) ) { + if ( isset( $redirectTargetsToRedirect[$string] ) ) { // The exact match is the target of a redirect already in the results list so remove // the redirect from the results list and push the exact match to the front - array_splice( $srchres, $redirectTargetsToRedirect[ $string ], 1 ); + array_splice( $srchres, $redirectTargetsToRedirect[$string], 1 ); array_unshift( $srchres, $string ); return $srchres; } @@ -242,7 +243,7 @@ abstract class PrefixSearch { if ( !$target ) { continue; } - $result[ $target ] = $key; + $result[$target] = $key; } return $result; }