SHARE
TWEET

Untitled

a guest Mar 7th, 2016 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static function listPagesByPrefix( $prefix ) {
  2.         $dbr = wfGetDB( DB_SLAVE );
  3.  
  4.         $title = Title::newFromText( $prefix );
  5.         if ( $title ) {
  6.             $ns = $title->getNamespace();
  7.             $prefix = $title->getDBkey();
  8.         } else {
  9.             // Prolly won't work too good
  10.             // @todo handle bare namespace names cleanly?
  11.             $ns = 0;
  12.         }
  13.  
  14.         $conds = [
  15.             'ar_namespace' => $ns,
  16.             'ar_title' . $dbr->buildLike( $prefix , $dbr->anyString() ),
  17.         ];
  18.        
  19.         **$sql = " SELECT ar_namespace ,  ar_title , COUNT(*) as count FROM  archive WHERE MATCH(ar_title) AGAINST('$prefix' IN BOOLEAN MODE) AND ar_namespace = $ns GROUP BY ar_namespace , ar_title ORDER BY ar_namespace , ar_title LIMIT 100";
  20.        
  21.         **return $dbr->query( $sql, __METHOD__ );
  22.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top