Index: trunk/extensions/PasswordReset/PasswordReset_Disabledusers.php |
— | — | @@ -51,16 +51,15 @@ |
52 | 52 | return false; |
53 | 53 | } |
54 | 54 | |
55 | | - function getSQL() { |
56 | | - $db = wfGetDB( DB_SLAVE ); |
57 | | - $user = $db->tableName( 'user' ); |
58 | | - |
59 | | - return |
60 | | - "SELECT 'Disabledusers' as type, |
61 | | - user_id, |
62 | | - user_name as value |
63 | | - FROM $user |
64 | | - WHERE user_password='DISABLED'"; |
| 55 | + function getQueryInfo() { |
| 56 | + return array( |
| 57 | + 'tables' => array ( 'user' ), |
| 58 | + 'fields' => array( |
| 59 | + 'user_id', |
| 60 | + 'user_name AS value' |
| 61 | + ), |
| 62 | + 'conds' => array ( 'user_password' => 'DISABLED' ) |
| 63 | + ); |
65 | 64 | } |
66 | 65 | |
67 | 66 | function sortDescending() { |
Index: trunk/extensions/ProofreadPage/SpecialProofreadPages.php |
— | — | @@ -4,18 +4,12 @@ |
5 | 5 | * @ingroup SpecialPage |
6 | 6 | */ |
7 | 7 | |
8 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
9 | | - die( 1 ); |
10 | | -} |
11 | | - |
12 | | -global $IP; |
13 | | -require_once "$IP/includes/QueryPage.php"; |
14 | | - |
15 | | -class ProofreadPages extends SpecialPage { |
16 | | - |
17 | | - public function __construct() { |
18 | | - parent::__construct( 'IndexPages' ); |
19 | | - $this->index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
| 8 | +class ProofreadPages extends QueryPage { |
| 9 | + protected $index_namespace, $searchTerm; |
| 10 | + |
| 11 | + public function __construct( $name = 'IndexPages' ) { |
| 12 | + parent::__construct( $name ); |
| 13 | + $this->index_namespace = wfMsgForContent( 'proofreadpage_index_namespace' ); |
20 | 14 | } |
21 | 15 | |
22 | 16 | public function execute( $parameters ) { |
— | — | @@ -25,49 +19,38 @@ |
26 | 20 | list( $limit, $offset ) = wfCheckLimits(); |
27 | 21 | $wgOut->addWikiText( wfMsgForContentNoTrans( 'proofreadpage_specialpage_text' ) ); |
28 | 22 | $searchList = array(); |
29 | | - $searchTerm = $wgRequest->getText( 'key' ); |
| 23 | + $this->searchTerm = $wgRequest->getText( 'key' ); |
30 | 24 | if( !$wgDisableTextSearch ) { |
31 | 25 | $wgOut->addHTML( |
32 | 26 | Xml::openElement( 'form' ) . |
33 | 27 | Xml::openElement( 'fieldset' ) . |
34 | 28 | Xml::element( 'legend', null, wfMsg( 'proofreadpage_specialpage_legend' ) ) . |
35 | | - Xml::input( 'key', 20, $searchTerm ) . ' ' . |
| 29 | + Xml::input( 'key', 20, $this->searchTerm ) . ' ' . |
36 | 30 | Xml::submitButton( wfMsg( 'ilsubmit' ) ) . |
37 | 31 | Xml::closeElement( 'fieldset' ) . |
38 | 32 | Xml::closeElement( 'form' ) |
39 | 33 | ); |
40 | | - if( $searchTerm ) { |
| 34 | + if( $this->searchTerm ) { |
41 | 35 | $index_namespace = $this->index_namespace; |
42 | 36 | $index_ns_index = MWNamespace::getCanonicalIndex( strtolower( $index_namespace ) ); |
43 | 37 | $searchEngine = SearchEngine::create(); |
44 | 38 | $searchEngine->setLimitOffset( $limit, $offset ); |
45 | 39 | $searchEngine->setNamespaces( array( $index_ns_index ) ); |
46 | 40 | $searchEngine->showRedirects = false; |
47 | | - $textMatches = $searchEngine->searchText( $searchTerm ); |
| 41 | + $textMatches = $searchEngine->searchText( $this->searchTerm ); |
| 42 | + $escIndex = preg_quote( $index_namespace, '/' ); |
48 | 43 | while( $result = $textMatches->next() ) { |
49 | | - if ( preg_match( "/^$index_namespace:(.*)$/", $result->getTitle(), $m ) ) { |
| 44 | + if ( preg_match( "/^$escIndex:(.*)$/", $result->getTitle(), $m ) ) { |
50 | 45 | array_push( $searchList, str_replace( ' ' , '_' , $m[1] ) ); |
51 | 46 | } |
52 | 47 | } |
53 | 48 | } |
54 | 49 | } |
55 | | - $cnl = new ProofreadPagesQuery( $searchList, $searchTerm ); |
56 | | - $cnl->doQuery( $offset, $limit ); |
| 50 | + parent::execute( $parameters ); |
57 | 51 | } |
58 | | -} |
59 | 52 | |
60 | | -class ProofreadPagesQuery extends QueryPage { |
61 | | - function __construct( $searchList, $searchTerm ) { |
62 | | - $this->searchList = $searchList; |
63 | | - $this->searchTerm = $searchTerm; |
64 | | - $this->index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
65 | | - } |
66 | | - |
67 | | - function getName() { |
68 | | - return 'IndexPages'; |
69 | | - } |
70 | | - |
71 | 53 | function isExpensive() { |
| 54 | + // FIXME: the query does filesort, so we're kinda lying here right now |
72 | 55 | return false; |
73 | 56 | } |
74 | 57 | |
— | — | @@ -78,39 +61,28 @@ |
79 | 62 | function linkParameters() { |
80 | 63 | return array( 'key' => $this->searchTerm ); |
81 | 64 | } |
82 | | - |
83 | | - function getSQL() { |
84 | | - $dbr = wfGetDB( DB_SLAVE ); |
85 | | - $page = $dbr->tableName( 'page' ); |
86 | | - $pr_index = $dbr->tableName( 'pr_index' ); |
87 | | - |
88 | | - $query = "SELECT page_title as title, |
89 | | - pr_count,pr_q0,pr_q1,pr_q2,pr_q3,pr_q4 |
90 | | - FROM $pr_index LEFT JOIN $page ON page_id = pr_page_id"; |
91 | | - |
92 | | - if( $this->searchTerm ) { |
93 | | - if( $this->searchList ) { |
94 | | - $index_ns_index = MWNamespace::getCanonicalIndex( strtolower( $this->index_namespace ) ); |
95 | | - $querylist = ''; |
96 | | - foreach( $this->searchList as $item ) { |
97 | | - if( $querylist ) { |
98 | | - $querylist .= ', '; |
99 | | - } |
100 | | - $querylist .= "'" . $dbr->strencode( $item ). "'"; |
101 | | - } |
102 | | - $query .= " WHERE page_namespace=$index_ns_index AND page_title IN ($querylist)"; |
| 65 | + |
| 66 | + public function getQueryInfo() { |
| 67 | + $conds = array(); |
| 68 | + if ( $this->searchTerm ) { |
| 69 | + if ( $this->searchList ) { |
| 70 | + $index_namespace = pr_index_ns(); |
| 71 | + $index_ns_index = MWNamespace::getCanonicalIndex( strtolower( $index_namespace ) ); |
| 72 | + $conds = array( 'page_namespace' => $index_ns_index, 'page_title' => $this->searchList ); |
103 | 73 | } else { |
104 | | - # The SQL query is complete |
| 74 | + $conds = null; |
105 | 75 | } |
106 | 76 | } |
107 | | - return $query; |
| 77 | + return array( |
| 78 | + 'tables' => array( 'pr_index', 'page' ), |
| 79 | + 'fields' => array( 'page_title AS title', '2*pr_q4+pr_q3 AS value', 'pr_count', |
| 80 | + 'pr_q0', 'pr_q1', 'pr_q2' ,'pr_q3', 'pr_q4' ), |
| 81 | + 'conds' => $conds, |
| 82 | + 'options' => array(), |
| 83 | + 'join_conds' => array( 'page' => array( 'LEFT JOIN', 'page_id=pr_page_id' ) ) |
| 84 | + ); |
108 | 85 | } |
109 | 86 | |
110 | | - function getOrder() { |
111 | | - return ' ORDER BY 2*pr_q4+pr_q3 ' . |
112 | | - ( $this->sortDescending() ? 'DESC' : '' ); |
113 | | - } |
114 | | - |
115 | 87 | function sortDescending() { |
116 | 88 | return true; |
117 | 89 | } |
Index: trunk/extensions/ProofreadPage/SpecialPagesWithoutScans.php |
— | — | @@ -23,30 +23,13 @@ |
24 | 24 | * Special page that lists the texts that have no transclusions |
25 | 25 | * Pages in MediaWiki:Proofreadpage_notnaked_category are excluded. |
26 | 26 | */ |
27 | | -class PagesWithoutScans extends SpecialPage { |
| 27 | +class PagesWithoutScans extends QueryPage { |
28 | 28 | |
29 | | - public function __construct() { |
30 | | - parent::__construct( 'PagesWithoutScans' ); |
| 29 | + function __construct( $name = 'PagesWithoutScans' ) { |
| 30 | + parent::__construct( $name ); |
| 31 | + $this->page_namespace = wfMsgForContent( 'proofreadpage_namespace' ); |
31 | 32 | } |
32 | 33 | |
33 | | - public function execute( $parameters ) { |
34 | | - $this->setHeaders(); |
35 | | - list( $limit, $offset ) = wfCheckLimits(); |
36 | | - $cnl = new PagesWithoutScansQuery(); |
37 | | - $cnl->doQuery( $offset, $limit ); |
38 | | - } |
39 | | -} |
40 | | - |
41 | | -class PagesWithoutScansQuery extends QueryPage { |
42 | | - |
43 | | - function __construct() { |
44 | | - $this->page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
45 | | - } |
46 | | - |
47 | | - function getName() { |
48 | | - return 'PagesWithoutScans'; |
49 | | - } |
50 | | - |
51 | 34 | function isExpensive() { |
52 | 35 | return true; |
53 | 36 | } |
— | — | @@ -55,9 +38,9 @@ |
56 | 39 | return false; |
57 | 40 | } |
58 | 41 | |
59 | | - /* |
60 | | - * return a clause with the list of disambiguation templates. |
61 | | - * this function was copied verbatim from specials/SpecialDisambiguations.php |
| 42 | + /** |
| 43 | + * Return a clause with the list of disambiguation templates. |
| 44 | + * This function was copied verbatim from specials/SpecialDisambiguations.php |
62 | 45 | */ |
63 | 46 | function disambiguation_templates( $dbr ) { |
64 | 47 | $dMsgText = wfMsgForContent('disambiguationspage'); |
— | — | @@ -92,30 +75,47 @@ |
93 | 76 | } |
94 | 77 | return $linkBatch->constructSet( 'tl', $dbr ); |
95 | 78 | } |
96 | | - |
97 | | - function getSQL() { |
| 79 | + |
| 80 | + function getQueryInfo() { |
98 | 81 | $dbr = wfGetDB( DB_SLAVE ); |
99 | | - $page = $dbr->tableName( 'page' ); |
100 | | - $templatelinks = $dbr->tableName( 'templatelinks' ); |
101 | | - $forceindex = $dbr->useIndexClause( 'page_len' ); |
102 | 82 | $page_ns_index = MWNamespace::getCanonicalIndex( strtolower( $this->page_namespace ) ); |
103 | | - |
104 | | - /* SQL clause to exclude pages with scans */ |
105 | | - $pages_with_scans = "( SELECT DISTINCT tl_from FROM $templatelinks LEFT JOIN $page ON page_id=tl_from WHERE tl_namespace=$page_ns_index AND page_namespace=" . NS_MAIN . " ) "; |
106 | | - |
107 | | - /* Exclude disambiguation pages too */ |
| 83 | + |
| 84 | + // Construct subqueries |
| 85 | + $pagesWithScansSubquery = $dbr->selectSQLText( |
| 86 | + array( 'templatelinks', 'page' ), |
| 87 | + 'DISTINCT tl_from', |
| 88 | + array( |
| 89 | + 'page_id=tl_from', |
| 90 | + 'tl_namespace' => $page_ns_index, |
| 91 | + 'page_namespace' => NS_MAIN |
| 92 | + ) |
| 93 | + ); |
| 94 | + |
| 95 | + // Exclude disambiguation pages too |
108 | 96 | $dt = $this->disambiguation_templates( $dbr ); |
109 | | - $disambiguation_pages = "( SELECT page_id FROM $page LEFT JOIN $templatelinks ON page_id=tl_from WHERE page_namespace=" . NS_MAIN . " AND " . $dt . " )"; |
110 | | - |
111 | | - $sql = "SELECT page_namespace as namespace, |
112 | | - page_title as title, |
113 | | - page_len AS value |
114 | | - FROM $page $forceindex |
115 | | - WHERE page_namespace=" . NS_MAIN . " AND page_is_redirect=0 |
116 | | - AND page_id NOT IN $pages_with_scans |
117 | | - AND page_id NOT IN $disambiguation_pages"; |
118 | | - |
119 | | - return $sql; |
| 97 | + $disambigPagesSubquery = $dbr->selectSQLText( |
| 98 | + array( 'page', 'templatelinks' ), |
| 99 | + 'page_id', |
| 100 | + array( |
| 101 | + 'page_id=tl_from', |
| 102 | + 'page_namespace' => NS_MAIN, |
| 103 | + $dt |
| 104 | + ) |
| 105 | + ); |
| 106 | + |
| 107 | + return array( |
| 108 | + 'tables' => 'page', |
| 109 | + 'fields' => array( |
| 110 | + 'page_namespace AS namespace', |
| 111 | + 'page_title AS title', |
| 112 | + 'page_len AS value' ), |
| 113 | + 'conds' => array( |
| 114 | + 'page_namespace' => NS_MAIN, |
| 115 | + 'page_is_redirect' => 0, |
| 116 | + "page_id NOT IN ($pagesWithScansSubquery)", |
| 117 | + "page_id NOT IN ($disambigPagesSubquery)" ), |
| 118 | + 'options' => array( 'USE INDEX' => 'page_len' ) |
| 119 | + ); |
120 | 120 | } |
121 | 121 | |
122 | 122 | function sortDescending() { |
Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -20,6 +20,7 @@ |
21 | 21 | } |
22 | 22 | |
23 | 23 | $wgExtensionFunctions[] = 'wfProofreadPage'; |
| 24 | +$wgRunHooks['wgQueryPages'][] = 'wfProofreadPageAddQueryPages'; |
24 | 25 | |
25 | 26 | $dir = dirname( __FILE__ ) . '/'; |
26 | 27 | $wgExtensionMessagesFiles['ProofreadPage'] = $dir . 'ProofreadPage.i18n.php'; |
— | — | @@ -82,3 +83,9 @@ |
83 | 84 | new ProofreadPage; |
84 | 85 | return true; |
85 | 86 | } |
| 87 | + |
| 88 | +function wfProofreadPageAddQueryPages( &$wgQueryPages ) { |
| 89 | + $wgQueryPages['ProofreadPages'] = 'IndexPages'; |
| 90 | + $wgQueryPages['PagesWithoutScans'] = 'PagesWithoutScans'; |
| 91 | + return true; |
| 92 | +} |
Index: trunk/extensions/SemanticForms/specials/SF_Forms.php |
— | — | @@ -7,29 +7,15 @@ |
8 | 8 | |
9 | 9 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
10 | 10 | |
11 | | -class SFForms extends SpecialPage { |
12 | | - |
| 11 | +class SFForms extends QueryPage { |
13 | 12 | /** |
14 | 13 | * Constructor |
15 | 14 | */ |
16 | | - function __construct() { |
17 | | - parent::__construct( 'Forms' ); |
| 15 | + function __construct( $name = 'Forms' ) { |
| 16 | + parent::__construct( $name ); |
18 | 17 | SFUtils::loadMessages(); |
19 | 18 | } |
20 | 19 | |
21 | | - function execute( $query ) { |
22 | | - $this->setHeaders(); |
23 | | - list( $limit, $offset ) = wfCheckLimits(); |
24 | | - $rep = new FormsPage(); |
25 | | - return $rep->doQuery( $offset, $limit ); |
26 | | - } |
27 | | -} |
28 | | - |
29 | | -class FormsPage extends QueryPage { |
30 | | - function getName() { |
31 | | - return "Forms"; |
32 | | - } |
33 | | - |
34 | 20 | function isExpensive() { return false; } |
35 | 21 | |
36 | 22 | function isSyndicated() { return false; } |
— | — | @@ -64,6 +50,14 @@ |
65 | 51 | AND page_is_redirect = 0"; |
66 | 52 | } |
67 | 53 | |
| 54 | + function getQueryInfo() { |
| 55 | + return array( |
| 56 | + 'tables' => array( 'page' ), |
| 57 | + 'fields' => array( 'page_title AS title', 'page_title AS value' ), |
| 58 | + 'conds' => array( 'page_namespace' => SF_NS_FORM, 'page_is_redirect' => 0 ) |
| 59 | + ); |
| 60 | + } |
| 61 | + |
68 | 62 | function sortDescending() { |
69 | 63 | return false; |
70 | 64 | } |
Index: trunk/extensions/SemanticForms/specials/SF_Templates.php |
— | — | @@ -63,6 +63,14 @@ |
64 | 64 | WHERE page_namespace = {$NStemp}"; |
65 | 65 | } |
66 | 66 | |
| 67 | + function getQueryInfo() { |
| 68 | + return array( |
| 69 | + 'tables' => array( 'page' ), |
| 70 | + 'fields' => array( 'page_title AS title', 'page_title AS value' ), |
| 71 | + 'conds' => array( 'page_namespace' => NS_TEMPLATE ) |
| 72 | + ); |
| 73 | + } |
| 74 | + |
67 | 75 | function sortDescending() { |
68 | 76 | return false; |
69 | 77 | } |
Index: trunk/extensions/StalePages/StalePages_body.php |
— | — | @@ -52,27 +52,20 @@ |
53 | 53 | |
54 | 54 | function isSyndicated() { return false; } |
55 | 55 | |
56 | | - function getSQL() { |
57 | | - global $wgDBtype, $wgStalePagesDays; |
| 56 | + function getQueryInfo() { |
| 57 | + global $wgStalePagesDays; |
| 58 | + $date = mktime() - ( 60 * 60 * 24 * $wgStalePagesDays ); //randomish |
58 | 59 | $db = wfGetDB( DB_SLAVE ); |
59 | | - $page = $db->tableName( 'page' ); |
60 | | - $revision = $db->tableName( 'revision' ); |
61 | | - $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(rev_timestamp)' : |
62 | | - 'EXTRACT(epoch FROM rev_timestamp)'; |
63 | | - |
64 | | - $date = mktime() - ( 60 * 60 * 24 * $wgStalePagesDays ); //ranomish |
65 | 60 | $dateString = $db->timestamp($date); |
66 | | - |
67 | | - return |
68 | | - "SELECT 'Stalepages' as type, |
69 | | - page_namespace as namespace, |
70 | | - page_title as title, |
71 | | - $epoch as value |
72 | | - FROM $page, $revision |
73 | | - WHERE page_latest=rev_id |
74 | | - AND page_namespace=" . NS_MAIN . " |
75 | | - AND page_is_redirect=0 |
76 | | - AND rev_timestamp < '$dateString'"; |
| 61 | + return array( |
| 62 | + 'tables' => array( 'page', 'revision' ), |
| 63 | + 'fields' => array( 'page_namespace AS namespace', 'page_title AS title', 'rev_timestamp AS value' ), |
| 64 | + 'conds' => array( 'page_latest=rev_id', |
| 65 | + 'page_namespace' => NS_MAIN, |
| 66 | + 'page_is_redirect=0', |
| 67 | + 'rev_timestamp < ' . $db->addQuotes( $dateString ) , |
| 68 | + ) |
| 69 | + ); |
77 | 70 | } |
78 | 71 | |
79 | 72 | function sortDescending() { |
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialListStreams.php |
— | — | @@ -12,14 +12,6 @@ |
13 | 13 | |
14 | 14 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
15 | 15 | |
16 | | - |
17 | | -/*function doSpecialListStreams($par = null) { |
18 | | - list( $limit, $offset ) = wfCheckLimits(); |
19 | | - $rep = new MV_SpecialListStreams(); |
20 | | - return $rep->doQuery( $offset, $limit ); |
21 | | -} |
22 | | -SpecialPage::addPage( new SpecialPage('Mv_List_Streams','',true,'doSpecialListStreams',false) ); |
23 | | -*/ |
24 | 16 | class MV_SpecialListStreams extends SpecialPage { |
25 | 17 | public function __construct() { |
26 | 18 | parent::__construct( 'Mv_List_Streams' ); |
— | — | @@ -30,12 +22,11 @@ |
31 | 23 | return $rep->doQuery( $offset, $limit ); |
32 | 24 | } |
33 | 25 | } |
34 | | -class MV_SpecialQueryStreams extends QueryPage { |
35 | | - |
36 | | - function getName() { |
37 | | - return "MV_List_Streams"; |
| 26 | +class MV_SpecialListStreams extends QueryPage { |
| 27 | + public function __construct( $name = 'Mv_List_Streams' ) { |
| 28 | + parent::__construct( $name ); |
38 | 29 | } |
39 | | - |
| 30 | + |
40 | 31 | function isExpensive() { |
41 | 32 | return false; |
42 | 33 | } |
— | — | @@ -45,8 +36,8 @@ |
46 | 37 | function getPageHeader() { |
47 | 38 | return '<p>' . wfMsg( 'mv_list_streams_docu' ) . "</p><br />\n"; |
48 | 39 | } |
49 | | - function getSQL() { |
50 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 40 | + |
| 41 | + function getQueryInfo() { |
51 | 42 | // $relations = $dbr->tableName( 'smw_relations' ); |
52 | 43 | // $NSrel = SMW_NS_RELATION; |
53 | 44 | # QueryPage uses the value from this SQL in an ORDER clause. |
— | — | @@ -63,17 +54,22 @@ |
64 | 55 | * stream length |
65 | 56 | * formats available |
66 | 57 | * number of associative metadata chunks */ |
67 | | - return "SELECT |
68 | | - `id` as `stream_id`, |
69 | | - `name` as title, |
70 | | - `name` as value " . |
71 | | - "FROM " . $dbr->tableName( 'mv_streams' ); |
72 | 58 | |
| 59 | + return array( |
| 60 | + 'tables' => array( 'mv_streams' ), |
| 61 | + 'fields' => array( 'id AS stream_id', 'name AS title', 'name AS value' ) |
| 62 | + ); |
73 | 63 | } |
| 64 | + |
74 | 65 | function getOrder() { |
75 | | - return ' ORDER BY `mv_streams`.`date_start_time` DESC '; |
| 66 | + return ' ORDER BY date_start_time DESC '; |
76 | 67 | // ($this->sortDescending() ? 'DESC' : ''); |
77 | 68 | } |
| 69 | + |
| 70 | + function getOrderFields() { |
| 71 | + return array( 'date_start_time' ); |
| 72 | + } |
| 73 | + |
78 | 74 | function sortDescending() { |
79 | 75 | return false; |
80 | 76 | } |
Index: trunk/extensions/CrossNamespaceLinks/CrossNamespaceLinks_body.php |
— | — | @@ -83,22 +83,18 @@ |
84 | 84 | * that it could be fixed rather than put these two on the |
85 | 85 | * whitelist. |
86 | 86 | */ |
87 | | - function getSQL() { |
88 | | - $dbr = wfGetDB( DB_SLAVE ); |
89 | | - extract( $dbr->tableNames( 'page', 'pagelinks' ) ); |
90 | | - $namespaces = implode( ',', $this->namespaces ); |
91 | | - return |
92 | | - " |
93 | | - SELECT |
94 | | - 'CrossNamespaceLinks' as type, |
95 | | - COUNT(*) as namespace, |
96 | | - page_title as title, |
97 | | - pl_namespace as value |
98 | | - FROM $pagelinks |
99 | | - LEFT JOIN $page ON page_id = pl_from |
100 | | - WHERE page_is_redirect = 0 AND page_namespace = " . NS_MAIN . " AND pl_namespace NOT IN ($namespaces) |
101 | | - GROUP BY page_id |
102 | | - "; |
| 87 | + function getQueryInfo() { |
| 88 | + return array( |
| 89 | + 'tables' => array( 'page', 'pagelinks' ), |
| 90 | + 'fields' => array( 'COUNT(*) AS namespace', 'page_title AS title', 'pl_namespace AS value' ), |
| 91 | + 'options' => array ( 'GROUP BY' => 'page_id' ), |
| 92 | + 'conds' => array( 'page_is_redirect' => 0, |
| 93 | + 'page_namespace' => NS_MAIN, |
| 94 | + 'pl_namespace NOT' => $this->namespaces ), |
| 95 | + 'join_conds' => array( |
| 96 | + 'page' => array( 'LEFT JOIN' => array( 'page_id=pl_from' ) ) |
| 97 | + ) |
| 98 | + ); |
103 | 99 | } |
104 | 100 | |
105 | 101 | function sortDescending() { return false; } |
Index: trunk/extensions/ApprovedRevs/SpecialApprovedRevs.php |
— | — | @@ -135,10 +135,58 @@ |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
| 139 | + function getQueryInfo() { |
| 140 | + if ( $this->mMode == 'notlatest' ) { |
| 141 | + return array( |
| 142 | + 'tables' => array( 'ar' => 'approved_revs', 'p' => 'page' ), |
| 143 | + 'fields' => array( |
| 144 | + 'p.page_id AS id', |
| 145 | + 'ar.rev_id AS rev_id', |
| 146 | + 'p.page_latest AS latest_id', |
| 147 | + ), |
| 148 | + 'join_conds' => array( |
| 149 | + 'page AS p' => array( |
| 150 | + 'JOIN', 'ar.page_id=p.page_id' |
| 151 | + ) |
| 152 | + ), |
| 153 | + 'conds' => array( 'p.page_latest != ar.rev_id') |
| 154 | + ); |
| 155 | + } elseif ( $this->mMode == 'unapproved' ) { |
| 156 | + return array( |
| 157 | + 'tables' => array( 'ar' => 'approve_revs', 'p' => 'page' ), |
| 158 | + 'fields' => array( 'p.page_id AS id' ), |
| 159 | + 'join_conds' => array( |
| 160 | + 'page AS p' => array( |
| 161 | + 'RIGHT OUTER JOIN', 'ar.page_id=p.page_id' |
| 162 | + ) |
| 163 | + ), |
| 164 | + 'conds' => array( "ar.page_id IS NULL" ) |
| 165 | + ); |
| 166 | + } else { // all approved pages |
| 167 | + return array( |
| 168 | + 'tables' => array( 'ar' => 'approved_revs', 'p' => 'page' ), |
| 169 | + 'fields' => array( |
| 170 | + 'p.page_id AS id', |
| 171 | + 'ar.rev_id AS rev_id', |
| 172 | + 'p.page_latest AS latest_id', |
| 173 | + ), |
| 174 | + 'join_conds' => array( |
| 175 | + 'page AS p' => array( |
| 176 | + 'JOIN', 'ar.page_id=p.page_id' |
| 177 | + ) |
| 178 | + ), |
| 179 | + ); |
| 180 | + } |
| 181 | + } |
| 182 | + |
139 | 183 | function getOrder() { |
140 | 184 | return ' ORDER BY p.page_namespace, p.page_title ASC'; |
141 | 185 | } |
142 | 186 | |
| 187 | + function getOrderFields() { |
| 188 | + return array( 'p.page_namespace', 'p.page_title' ); |
| 189 | + } |
| 190 | + |
143 | 191 | function formatResult( $skin, $result ) { |
144 | 192 | $title = Title::newFromId( $result->id ); |
145 | 193 | $pageLink = $skin->makeLinkObj( $title ); |
Index: trunk/extensions/SemanticDrilldown/specials/SD_Filters.php |
— | — | @@ -55,6 +55,14 @@ |
56 | 56 | WHERE page_namespace = $filter_ns"; |
57 | 57 | } |
58 | 58 | |
| 59 | + function getQueryInfo() { |
| 60 | + return array( |
| 61 | + 'tables' => array( 'page' ), |
| 62 | + 'fields' => array( 'page_title AS title', 'page_title AS value' ), |
| 63 | + 'conds' => array( 'page_namespace' => SD_NS_FILTER ) |
| 64 | + ); |
| 65 | + } |
| 66 | + |
59 | 67 | function sortDescending() { |
60 | 68 | return false; |
61 | 69 | } |
Index: trunk/extensions/SemanticDrilldown/specials/SD_BrowseData.php |
— | — | @@ -1003,6 +1003,10 @@ |
1004 | 1004 | function getOrder() { |
1005 | 1005 | return ' ORDER BY sortkey '; |
1006 | 1006 | } |
| 1007 | + |
| 1008 | + function getOrderFields() { |
| 1009 | + return array( 'sortkey' ); |
| 1010 | + } |
1007 | 1011 | |
1008 | 1012 | function formatResult( $skin, $result ) { |
1009 | 1013 | $title = Title::makeTitle( $result->namespace, $result->value ); |