summaryrefslogtreecommitdiff
path: root/includes/SpecialWatchlist.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-03-21 11:49:34 +0100
committerPierre Schmitz <pierre@archlinux.de>2008-03-21 11:49:34 +0100
commit086ae52d12011746a75f5588e877347bc0457352 (patch)
treee73263c7a29d0f94fafb874562610e16eb292ba8 /includes/SpecialWatchlist.php
parent749e7fb2bae7bbda855de3c9e319435b9f698ff7 (diff)
Update auf MediaWiki 1.12.0
Diffstat (limited to 'includes/SpecialWatchlist.php')
-rw-r--r--includes/SpecialWatchlist.php50
1 files changed, 29 insertions, 21 deletions
diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php
index e9aa7e68..2dfa8ae5 100644
--- a/includes/SpecialWatchlist.php
+++ b/includes/SpecialWatchlist.php
@@ -87,19 +87,11 @@ function wfSpecialWatchlist( $par ) {
$dbr = wfGetDB( DB_SLAVE, 'watchlist' );
list( $page, $watchlist, $recentchanges ) = $dbr->tableNamesN( 'page', 'watchlist', 'recentchanges' );
- $sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_user=$uid";
- $res = $dbr->query( $sql, $fname );
- $s = $dbr->fetchObject( $res );
-
-# Patch *** A1 *** (see A2 below)
-# adjust for page X, talk:page X, which are both stored separately, but treated together
- $nitems = floor($s->n / 2);
-# $nitems = $s->n;
-
- if($nitems == 0) {
- $wgOut->addWikiText( wfMsg( 'nowatchlist' ) );
- return;
- }
+ $watchlistCount = $dbr->selectField( 'watchlist', 'COUNT(*)',
+ array( 'wl_user' => $uid ), __METHOD__ );
+ // Adjust for page X, talk:page X, which are both stored separately,
+ // but treated together
+ $nitems = floor($watchlistCount / 2);
if( is_null($days) || !is_numeric($days) ) {
$big = 1000; /* The magical big */
@@ -122,6 +114,16 @@ function wfSpecialWatchlist( $par ) {
wfAppendToArrayIfNotDefault( 'hideMinor', (int)$hideMinor, $defaults, $nondefaults );
wfAppendToArrayIfNotDefault('namespace', $nameSpace , $defaults, $nondefaults);
+ $hookSql = "";
+ if( ! wfRunHooks('BeforeWatchlist', array($nondefaults, $wgUser, &$hookSql)) ) {
+ return;
+ }
+
+ if($nitems == 0) {
+ $wgOut->addWikiMsg( 'nowatchlist' );
+ return;
+ }
+
if ( $days <= 0 ) {
$andcutoff = '';
} else {
@@ -180,8 +182,10 @@ function wfSpecialWatchlist( $par ) {
'" /><input type="hidden" name="reset" value="all" /></form>' .
"\n\n" );
}
-
- $sql = "SELECT *
+ if ( $wgShowUpdatedMarker ) {
+ $wltsfield=", ${watchlist}.wl_notificationtimestamp ";
+ }
+ $sql = "SELECT ${recentchanges}.* ${wltsfield}
FROM $watchlist,$recentchanges,$page
WHERE wl_user=$uid
AND wl_namespace=rc_namespace
@@ -193,6 +197,7 @@ function wfSpecialWatchlist( $par ) {
$andHideBots
$andHideMinor
$nameSpaceClause
+ $hookSql
ORDER BY rc_timestamp DESC
$limitWatchlist";
@@ -251,7 +256,7 @@ function wfSpecialWatchlist( $par ) {
# If there's nothing to show, stop here
if( $numRows == 0 ) {
- $wgOut->addWikiText( wfMsgNoTrans( 'watchnochange' ) );
+ $wgOut->addWikiMsg( 'watchnochange' );
return;
}
@@ -286,10 +291,13 @@ function wfSpecialWatchlist( $par ) {
}
if ($wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
- $sql3 = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_title='" .$dbr->strencode($obj->page_title). "' AND wl_namespace='{$obj->page_namespace}'" ;
- $res3 = $dbr->query( $sql3, $fname );
- $x = $dbr->fetchObject( $res3 );
- $rc->numberofWatchingusers = $x->n;
+ $rc->numberofWatchingusers = $dbr->selectField( 'watchlist',
+ 'COUNT(*)',
+ array(
+ 'wl_namespace' => $obj->rc_namespace,
+ 'wl_title' => $obj->rc_title,
+ ),
+ __METHOD__ );
} else {
$rc->numberofWatchingusers = 0;
}
@@ -364,4 +372,4 @@ function wlCountItems( &$user, $talk = true ) {
$count = floor( $count / 2 );
return( $count );
-} \ No newline at end of file
+}