Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function listPagesByPrefix( $prefix ) {
- $dbr = wfGetDB( DB_SLAVE );
- $title = Title::newFromText( $prefix );
- if ( $title ) {
- $ns = $title->getNamespace();
- $prefix = $title->getDBkey();
- } else {
- // Prolly won't work too good
- // @todo handle bare namespace names cleanly?
- $ns = 0;
- }
- $conds = [
- 'ar_namespace' => $ns,
- 'ar_title' . $dbr->buildLike( $prefix , $dbr->anyString() ),
- ];
- **$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";
- **return $dbr->query( $sql, __METHOD__ );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement