return false;
}
- $querycache = $dbr->tableName( 'querycache' );
-
if ( $ignoreErrors ) {
$ignoreW = $dbw->ignoreErrors( true );
$ignoreR = $dbr->ignoreErrors( true );
if ( count( $vals ) ) {
if ( !$dbw->insert( 'querycache', $vals, __METHOD__ ) ) {
// Set result to false to indicate error
- $dbr->freeResult( $res );
$res = false;
}
}
- if ( $res ) {
- $dbr->freeResult( $res );
- }
if ( $ignoreErrors ) {
$dbw->ignoreErrors( $ignoreW );
$dbr->ignoreErrors( $ignoreR );
$this->preprocessResults( $dbr, $res );
- $wgOut->addHTML( XML::openElement( 'div', array('class' => 'mw-spcontent') ) );
+ $wgOut->addHTML( Xml::openElement( 'div', array('class' => 'mw-spcontent') ) );
# Top header and navigation
if( $shownavigation ) {
# No results to show, so don't bother with "showing X of Y" etc.
# -- just let the user know and give up now
$wgOut->addHTML( '<p>' . wfMsgHtml( 'specialpage-empty' ) . '</p>' );
- $wgOut->addHTML( XML::closeElement( 'div' ) );
+ $wgOut->addHTML( Xml::closeElement( 'div' ) );
return;
}
}
$wgOut->addHTML( '<p>' . $paging . '</p>' );
}
- $wgOut->addHTML( XML::closeElement( 'div' ) );
+ $wgOut->addHTML( Xml::closeElement( 'div' ) );
return $num;
}
$sql = $this->getSQL() . $this->getOrder();
$sql = $dbr->limitResult( $sql, $limit, 0 );
$res = $dbr->query( $sql, 'QueryPage::doFeed' );
- while( $obj = $dbr->fetchObject( $res ) ) {
+ foreach ( $res as $obj ) {
$item = $this->feedResult( $obj );
- if( $item ) $feed->outItem( $item );
+ if( $item ) {
+ $feed->outItem( $item );
+ }
}
- $dbr->freeResult( $res );
$feed->outFooter();
return true;
}
function feedTitle() {
- global $wgContLanguageCode, $wgSitename;
+ global $wgLanguageCode, $wgSitename;
$page = SpecialPage::getPage( $this->getName() );
$desc = $page->getDescription();
- return "$wgSitename - $desc [$wgContLanguageCode]";
+ return "$wgSitename - $desc [$wgLanguageCode]";
}
function feedDesc() {
*/
function preprocessResults( $db, $res ) {
$batch = new LinkBatch;
- while ( $row = $db->fetchObject( $res ) )
+ foreach ( $res as $row ) {
$batch->add( $row->namespace, $row->title );
+ }
$batch->execute();
// Back to start for display
$db->dataSeek( $res, 0 );
}
+ /**
+ * Should formatResult() always check page existence, even if
+ * the results are fresh? This is a (hopefully temporary)
+ * kluge for Special:WantedFiles, which may contain false
+ * positives for files that exist e.g. in a shared repo (bug
+ * 6220).
+ */
+ function forceExistenceCheck() {
+ return false;
+ }
+
/**
* Format an individual result
*
public function formatResult( $skin, $result ) {
$title = Title::makeTitleSafe( $result->namespace, $result->title );
if( $title instanceof Title ) {
- if( $this->isCached() ) {
- $pageLink = $title->exists()
- ? '<s>' . $skin->link( $title ) . '</s>'
+ if( $this->isCached() || $this->forceExistenceCheck() ) {
+ $pageLink = $title->isKnown()
+ ? '<del>' . $skin->link( $title ) . '</del>'
: $skin->link(
$title,
null,