From a58285fd06c8113c45377c655dd43cef6337e815 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 11 Jan 2007 19:06:07 +0000 Subject: Aktualisierung auf MediaWiki 1.9.0 --- includes/QueryPage.php | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'includes/QueryPage.php') diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 7d6dc900..ff6355e7 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -92,7 +92,7 @@ class QueryPage { * @return Title */ function getTitle() { - return Title::makeTitle( NS_SPECIAL, $this->getName() ); + return SpecialPage::getTitleFor( $this->getName() ); } /** @@ -282,13 +282,15 @@ class QueryPage { $sname = $this->getName(); $fname = get_class($this) . '::doQuery'; - $sql = $this->getSQL(); $dbr =& wfGetDB( DB_SLAVE ); - $querycache = $dbr->tableName( 'querycache' ); $wgOut->setSyndicated( $this->isSyndicated() ); - if ( $this->isCached() ) { + if ( !$this->isCached() ) { + $sql = $this->getSQL(); + } else { + # Get the cached result + $querycache = $dbr->tableName( 'querycache' ); $type = $dbr->strencode( $sname ); $sql = "SELECT qc_type as type, qc_namespace as namespace,qc_title as title, qc_value as value @@ -310,6 +312,14 @@ class QueryPage { } $wgOut->addWikiText( $cacheNotice ); + + # If updates on this page have been disabled, let the user know + # that the data set won't be refreshed for now + global $wgDisableQueryPageUpdate; + if( is_array( $wgDisableQueryPageUpdate ) && in_array( $this->getName(), $wgDisableQueryPageUpdate ) ) { + $wgOut->addWikiText( wfMsg( 'querypage-no-updates' ) ); + } + } } @@ -339,7 +349,7 @@ class QueryPage { if ( $num > 0 ) { $s = array(); if ( ! $this->listoutput ) - $s[] = "
    "; + $s[] = $this->openList( $offset ); # Only read at most $num rows, because $res may contain the whole 1000 for ( $i = 0; $i < $num && $obj = $dbr->fetchObject( $res ); $i++ ) { @@ -364,7 +374,7 @@ class QueryPage { $dbr->freeResult( $res ); if ( ! $this->listoutput ) - $s[] = '
'; + $s[] = $this->closeList(); $str = $this->listoutput ? $wgContLang->listToText( $s ) : implode( '', $s ); $wgOut->addHTML( $str ); } @@ -373,12 +383,20 @@ class QueryPage { } return $num; } + + function openList( $offset ) { + return "
    "; + } + + function closeList() { + return '
'; + } /** * Do any necessary preprocessing of the result object. - * You should pass this by reference: &$db , &$res + * You should pass this by reference: &$db , &$res [although probably no longer necessary in PHP5] */ - function preprocessResults( $db, $res ) {} + function preprocessResults( &$db, &$res ) {} /** * Similar to above, but packaging in a syndicated feed instead of a web page @@ -459,7 +477,7 @@ class QueryPage { } function feedUrl() { - $title = Title::MakeTitle( NS_SPECIAL, $this->getName() ); + $title = SpecialPage::getTitleFor( $this->getName() ); return $title->getFullURL(); } } -- cgit v1.2.3-54-g00ecf