Index: trunk/phase3/includes/SpecialWatchlist.php |
— | — | @@ -11,25 +11,8 @@ |
12 | 12 | $wgOut->setPagetitle( wfMsg( "watchlist" ) ); |
13 | 13 | $sub = str_replace( "$1", $wgUser->getName(), wfMsg( "watchlistsub" ) ); |
14 | 14 | $wgOut->setSubtitle( $sub ); |
15 | | - $wgOut->setRobotpolicy( "index,follow" ); |
| 15 | + $wgOut->setRobotpolicy( "noindex,nofollow" ); |
16 | 16 | |
17 | | - if ( ! isset( $days ) ) { |
18 | | - /* |
19 | | - $days = $wgUser->getOption( "rcdays" ); |
20 | | - if ( ! $days ) { $days = 3; } |
21 | | - */ |
22 | | - $days = (1.0 / 24.0); # 1 hour... |
23 | | - } |
24 | | - $days = floatval($days); |
25 | | - |
26 | | - if ( $days <= 0 ) { |
27 | | - $docutoff = ''; |
28 | | - } else { |
29 | | - $docutoff = "cur_timestamp > '" . |
30 | | - ( $cutoff = wfUnix2Timestamp( time() - intval( $days * 86400 ) ) ) |
31 | | - . "' AND"; |
32 | | - } |
33 | | - |
34 | 17 | $uid = $wgUser->getID(); |
35 | 18 | if( $uid == 0 ) { |
36 | 19 | $wgOut->addHTML( wfMsg( "nowatchlist" ) ); |
— | — | @@ -67,13 +50,33 @@ |
68 | 51 | $wgOut->addHTML( wfMsg( "nowatchlist" ) ); |
69 | 52 | return; |
70 | 53 | } |
| 54 | + |
| 55 | + if ( ! isset( $days ) ) { |
| 56 | + $big = 250; |
| 57 | + if($nitems > $big) { |
| 58 | + # Set default cutoff shorter |
| 59 | + $days = (1.0 / 24.0); # 1 hour... |
| 60 | + } else { |
| 61 | + $days = 0; # no time cutoff for shortlisters |
| 62 | + } |
| 63 | + } else { |
| 64 | + $days = floatval($days); |
| 65 | + } |
71 | 66 | |
72 | | - $sql = "SELECT COUNT(*) AS n FROM cur WHERE cur_timestamp>'$cutoff'"; |
73 | | - $res = wfQuery( $sql ); |
74 | | - $s = wfFetchObject( $res ); |
75 | | - $npages = $s->n; |
76 | | - |
77 | | - |
| 67 | + if ( $days <= 0 ) { |
| 68 | + $docutoff = ''; |
| 69 | + $cutoff = false; |
| 70 | + $npages = wfMsg( "all" ); |
| 71 | + } else { |
| 72 | + $docutoff = "AND cur_timestamp > '" . |
| 73 | + ( $cutoff = wfUnix2Timestamp( time() - intval( $days * 86400 ) ) ) |
| 74 | + . "'"; |
| 75 | + $sql = "SELECT COUNT(*) AS n FROM cur WHERE cur_timestamp>'$cutoff'"; |
| 76 | + $res = wfQuery( $sql ); |
| 77 | + $s = wfFetchObject( $res ); |
| 78 | + $npages = $s->n; |
| 79 | + } |
| 80 | + |
78 | 81 | if(isset($_REQUEST['magic'])) { |
79 | 82 | $wgOut->addHTML( wfMsg( "watchlistcontains", $nitems ) . |
80 | 83 | "<p>" . wfMsg( "watcheditlist" ) . "</p>\n" ); |
— | — | @@ -105,10 +108,10 @@ |
106 | 109 | # down its entirety and then sort the results. |
107 | 110 | |
108 | 111 | # If it's relatively long, it may be worth our while to zip |
109 | | - # through the time-sorted page list checking for |
| 112 | + # through the time-sorted page list checking for watched items. |
110 | 113 | |
111 | 114 | # Up estimate of watched items by 15% to compensate for talk pages... |
112 | | - if( ( $nitems*1.15 > $npages ) ) { |
| 115 | + if( $cutoff && ( $nitems*1.15 > $npages ) ) { |
113 | 116 | $x = "cur_timestamp"; |
114 | 117 | $y = wfMsg( "watchmethod-recent" ); |
115 | 118 | $z = "wl_namespace=cur_namespace&65534"; |
— | — | @@ -129,7 +132,7 @@ |
130 | 133 | WHERE wl_user=$uid |
131 | 134 | AND $z |
132 | 135 | AND wl_title=cur_title |
133 | | - AND cur_timestamp>'$cutoff' |
| 136 | + $docutoff |
134 | 137 | ORDER BY cur_timestamp DESC"; |
135 | 138 | |
136 | 139 | |
— | — | @@ -137,8 +140,10 @@ |
138 | 141 | |
139 | 142 | if($days >= 1) |
140 | 143 | $note = wfMsg( "rcnote", $limit, $days ); |
| 144 | + elseif($days > 0) |
| 145 | + $note = wfMsg( "wlnote", $limit, round($days*24) ); |
141 | 146 | else |
142 | | - $note = wfMsg( "wlnote", $limit, round($days*24) ); |
| 147 | + $note = ""; |
143 | 148 | $wgOut->addHTML( "\n<hr>\n{$note}\n<br>" ); |
144 | 149 | $note = wlCutoffLinks( $days, $limit ); |
145 | 150 | $wgOut->addHTML( "{$note}\n" ); |
— | — | @@ -186,7 +191,7 @@ |
187 | 192 | $sk = $wgUser->getSkin(); |
188 | 193 | $s = $sk->makeKnownLink( |
189 | 194 | $wgLang->specialPage( $page ), |
190 | | - $d, "days=$d" ); |
| 195 | + ($d ? $d : wfMsg( "all" ) ), "days=$d" ); |
191 | 196 | return $s; |
192 | 197 | } |
193 | 198 | |
— | — | @@ -206,7 +211,8 @@ |
207 | 212 | return |
208 | 213 | "Show last " . |
209 | 214 | implode(" | ", $hours) . " hours " . |
210 | | - implode(" | ", $days) . " days"; |
| 215 | + implode(" | ", $days) . " days " . |
| 216 | + wlDaysLink( 0, $page ); |
211 | 217 | # $note = wfMsg( "rclinks", $cl, $dl, $mlink ); |
212 | 218 | } |
213 | 219 | |