~ubuntu-branches/ubuntu/maverick/mediawiki/maverick

« back to all changes in this revision

Viewing changes to includes/specials/SpecialRecentchanges.php

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2009-06-19 01:38:50 UTC
  • mfrom: (16.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090619013850-dsn4lrxvs90ab4rx
Tags: 1:1.15.0-1
* New upstream release. 
* Upstream added support for OASIS documents.
Closes: #530328
* Refreshed quilt patches
* Bumped standards versions to 3.8.2
* Bumped compat to 7
* Pointed to GPL-2 in debian/copyright
* Added php5-sqlite to possible DB backend dependencies.
Closes: #501569
* Proofread README.Debian, upgrade is documented there.
Closes: #520121

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
                $opts->add( 'limit', (int)$wgUser->getOption( 'rclimit' ) );
24
24
                $opts->add( 'from', '' );
25
25
 
26
 
                $opts->add( 'hideminor',     (bool)$wgUser->getOption( 'hideminor' ) );
 
26
                $opts->add( 'hideminor',     $wgUser->getBoolOption( 'hideminor' ) );
27
27
                $opts->add( 'hidebots',      true  );
28
28
                $opts->add( 'hideanons',     false );
29
29
                $opts->add( 'hideliu',       false );
30
 
                $opts->add( 'hidepatrolled', false );
 
30
                $opts->add( 'hidepatrolled', $wgUser->getBoolOption( 'hidepatrolled' ) );
31
31
                $opts->add( 'hidemyself',    false );
32
32
 
33
33
                $opts->add( 'namespace', '', FormOptions::INTNULL );
35
35
 
36
36
                $opts->add( 'categories', '' );
37
37
                $opts->add( 'categories_any', false );
 
38
                $opts->add( 'tagfilter', '' );
38
39
                return $opts;
39
40
        }
40
41
 
54
55
                        $this->parseParameters( $parameters, $opts );
55
56
                }
56
57
 
57
 
                $opts->validateIntBounds( 'limit', 0, 5000 );
 
58
                $opts->validateIntBounds( 'limit', 0, 500 );
58
59
                return $opts;
59
60
        }
60
61
 
66
67
        public function feedSetup() {
67
68
                global $wgFeedLimit, $wgRequest;
68
69
                $opts = $this->getDefaultOptions();
69
 
                $opts->fetchValuesFromRequest( $wgRequest, array( 'days', 'limit', 'hideminor' ) );
 
70
                # Feed is cached on limit,hideminor; other params would randomly not work
 
71
                $opts->fetchValuesFromRequest( $wgRequest, array( 'limit', 'hideminor' ) );
70
72
                $opts->validateIntBounds( 'limit', 0, $wgFeedLimit );
71
73
                return $opts;
72
74
        }
108
110
                        foreach( $rows as $row ) {
109
111
                                $batch->add( NS_USER, $row->rc_user_text  );
110
112
                                $batch->add( NS_USER_TALK, $row->rc_user_text  );
 
113
                                $batch->add( $row->rc_namespace, $row->rc_title );
111
114
                        }
112
115
                        $batch->execute();
113
116
                }
114
 
 
 
117
                $target = isset($opts['target']) ? $opts['target'] : ''; // RCL has targets
115
118
                if( $feedFormat ) {
116
119
                        list( $feed, $feedObj ) = $this->getFeedObject( $feedFormat );
117
 
                        $feed->execute( $feedObj, $rows, $opts['limit'], $opts['hideminor'], $lastmod );
 
120
                        $feed->execute( $feedObj, $rows, $opts['limit'], $opts['hideminor'], $lastmod, $target );
118
121
                } else {
119
122
                        $this->webOutput( $rows, $opts );
120
123
                }
267
270
 
268
271
                $tables = array( 'recentchanges' );
269
272
                $join_conds = array();
 
273
                $query_options = array( 'USE INDEX' => array('recentchanges' => 'rc_timestamp') );
270
274
 
271
275
                $uid = $wgUser->getId();
272
276
                $dbr = wfGetDB( DB_SLAVE );
274
278
                $namespace = $opts['namespace'];
275
279
                $invert = $opts['invert'];
276
280
 
 
281
                $join_conds = array();
 
282
 
277
283
                // JOIN on watchlist for users
278
284
                if( $uid ) {
279
285
                        $tables[] = 'watchlist';
280
 
                        $join_conds = array( 'watchlist' => array('LEFT JOIN',
281
 
                                "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace") );
282
 
                }
 
286
                        $join_conds['watchlist'] = array('LEFT JOIN',
 
287
                                "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace");
 
288
                }
 
289
                if ($wgUser->isAllowed("rollback")) {
 
290
                        $tables[] = 'page';
 
291
                        $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
 
292
                }
 
293
                // Tag stuff.
 
294
                $fields = array();
 
295
                // Fields are * in this case, so let the function modify an empty array to keep it happy.
 
296
                ChangeTags::modifyDisplayQuery( $tables,
 
297
                                                                                $fields,
 
298
                                                                                $conds,
 
299
                                                                                $join_conds,
 
300
                                                                                $query_options,
 
301
                                                                                $opts['tagfilter']
 
302
                                                                        );
283
303
 
284
304
                wfRunHooks('SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts ) );
285
305
 
286
306
                // Is there either one namespace selected or excluded?
 
307
                // Tag filtering also has a better index.
287
308
                // Also, if this is "all" or main namespace, just use timestamp index.
288
 
                if( is_null($namespace) || $invert || $namespace == NS_MAIN ) {
 
309
                if( is_null($namespace) || $invert || $namespace == NS_MAIN || $opts['tagfilter'] ) {
289
310
                        $res = $dbr->select( $tables, '*', $conds, __METHOD__,
290
 
                                array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit,
291
 
                                        'USE INDEX' => array('recentchanges' => 'rc_timestamp') ),
 
311
                                array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
 
312
                                $query_options,
292
313
                                $join_conds );
293
314
                // We have a new_namespace_time index! UNION over new=(0,1) and sort result set!
294
315
                } else {
372
393
                                }
373
394
                                $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
374
395
                        }
375
 
                        $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ) );
 
396
                        $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
376
397
                        --$limit;
377
398
                }
378
399
                $s .= $list->endRecentChangesList();
453
474
                        $extraOpts['category'] = $this->categoryFilterForm( $opts );
454
475
                }
455
476
 
 
477
                $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
 
478
                if ( count($tagFilter) )
 
479
                        $extraOpts['tagfilter'] = $tagFilter;
 
480
 
456
481
                wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
457
482
                return $extraOpts;
458
483
        }
587
612
                $options = $nondefaults + $defaults;
588
613
 
589
614
                $note = '';
 
615
                if( !wfEmptyMsg( 'rclegend', wfMsg('rclegend') ) ) {
 
616
                        $note .= '<div class="mw-rclegend">' . wfMsgExt( 'rclegend', array('parseinline') ) . "</div>\n";
 
617
                }
590
618
                if( $options['from'] ) {
591
619
                        $note .= wfMsgExt( 'rcnotefrom', array( 'parseinline' ),
592
620
                                $wgLang->formatNum( $options['limit'] ),
593
621
                                $wgLang->timeanddate( $options['from'], true ) ) . '<br />';
594
622
                }
595
 
                if( !wfEmptyMsg( 'rclegend', wfMsg('rclegend') ) ) {
596
 
                        $note .= wfMsgExt( 'rclegend', array('parseinline') ) . '<br />';
597
 
                }
598
623
 
599
624
                # Sort data for display and make sure it's unique after we've added user data.
600
625
                $wgRCLinkLimits[] = $options['limit'];
609
634
                        $cl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
610
635
                                array( 'limit' => $value ), $nondefaults, $value == $options['limit'] ) ;
611
636
                }
612
 
                $cl = implode( ' | ', $cl );
 
637
                $cl = $wgLang->pipeList( $cl );
613
638
 
614
639
                // day links, reset 'from' to none
615
640
                foreach( $wgRCLinkDays as $value ) {
616
641
                        $dl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
617
642
                                array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] ) ;
618
643
                }
619
 
                $dl = implode( ' | ', $dl );
 
644
                $dl = $wgLang->pipeList( $dl );
620
645
 
621
646
 
622
647
                // show/hide links
641
666
                if( $wgUser->useRCPatrol() )
642
667
                        $links[] = wfMsgHtml( 'rcshowhidepatr', $patrLink );
643
668
                $links[] = wfMsgHtml( 'rcshowhidemine', $myselfLink );
644
 
                $hl = implode( ' | ', $links );
 
669
                $hl = $wgLang->pipeList( $links );
645
670
 
646
671
                // show from this onward link
647
672
                $now = $wgLang->timeanddate( wfTimestampNow(), true );