On Fri, Sep 12, 2008 at 8:22 AM, Roan Kattouw roan.kattouw@home.nl wrote:
Chad schreef:
On Thu, Sep 11, 2008 at 6:30 PM, soxred93@svn.wikimedia.org wrote:
Revision: 40734 Author: soxred93 Date: 2008-09-11 22:30:27 +0000 (Thu, 11 Sep 2008)
Log Message:
Add new special page Wantedfiles.
[snip a whole lot]
function getSQL() {
$dbr = wfGetDB( DB_SLAVE );
list( $imagelinks, $page ) = $dbr->tableNamesN( 'imagelinks', 'page' );
$name = $dbr->addQuotes( $this->getName() );
return
"
SELECT
$name as type,
" . NS_IMAGE . " as namespace,
il_to as title,
COUNT(*) as value
FROM $imagelinks
LEFT JOIN $page ON il_to = page_title AND page_namespace = ". NS_IMAGE ."
WHERE page_title IS NULL
GROUP BY il_to
";
}
This is pretty much the same query I committed in r35934. It was later removed because the query is slow and makes this page useless--as is the case with WantedPages which is disabled on WMF sites because of it. Has something changed that makes this better now?
Also, please don't hardcode SQL like that, but use $dbr->select().
Roan Kattouw (Catrope)
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
When using classes that subclass QueryPage, SQL is manually constructed in getSQL. A lot of other specialpages are like this.
-Chad