3 * This is to display changes made to all articles linked in an article.
4 * @addtogroup SpecialPage
10 require_once( 'SpecialRecentchanges.php' );
14 * @param string $par parent page we will look at
16 function wfSpecialRecentchangeslinked( $par = NULL ) {
17 global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest;
18 $fname = 'wfSpecialRecentchangeslinked';
20 $days = $wgRequest->getInt( 'days' );
21 $target = isset($par) ?
$par : $wgRequest->getText( 'target' );
22 $hideminor = $wgRequest->getBool( 'hideminor' ) ?
1 : 0;
24 $wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) );
25 $sk = $wgUser->getSkin();
27 if (is_null($target)) {
28 $wgOut->errorpage( 'notargettitle', 'notargettext' );
31 $nt = Title
::newFromURL( $target );
33 $wgOut->errorpage( 'notargettitle', 'notargettext' );
36 $id = $nt->getArticleId();
38 $wgOut->setSubtitle( htmlspecialchars( wfMsg( 'rclsub', $nt->getPrefixedText() ) ) );
41 $days = (int)$wgUser->getOption( 'rcdays', 7 );
43 list( $limit, /* offset */ ) = wfCheckLimits( 100, 'rclimit' );
45 $dbr = wfGetDB( DB_SLAVE
,'recentchangeslinked' );
46 $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
48 $hideminor = ($hideminor ?
1 : 0);
50 $mlink = $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchangeslinked' ),
51 wfMsg( 'show' ), 'target=' . htmlspecialchars( $nt->getPrefixedURL() ) .
52 "&days={$days}&limit={$limit}&hideminor=0" );
54 $mlink = $sk->makeKnownLink( $wgContLang->specialPage( "Recentchangeslinked" ),
55 wfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
56 "&days={$days}&limit={$limit}&hideminor=1" );
59 $cmq = 'AND rc_minor=0';
62 list($recentchanges, $categorylinks, $pagelinks, $watchlist) =
63 $dbr->tableNamesN( 'recentchanges', 'categorylinks', 'pagelinks', "watchlist" );
65 $uid = $wgUser->getID();
68 GROUP BY rc_cur_id,rc_namespace,rc_title,
69 rc_user,rc_comment,rc_user_text,rc_timestamp,rc_minor,rc_deleted,
70 rc_new, rc_id, rc_this_oldid, rc_last_oldid, rc_bot, rc_patrolled, rc_type, rc_old_len, rc_new_len
71 " . ($uid ?
",wl_user" : "") . "
72 ORDER BY rc_timestamp DESC
75 // If target is a Category, use categorylinks and invert from and to
76 if( $nt->getNamespace() == NS_CATEGORY
) {
77 $catkey = $dbr->addQuotes( $nt->getDBKey() );
78 $sql = "SELECT /* wfSpecialRecentchangeslinked */
97 " . ($uid ?
",wl_user" : "") . "
98 FROM $categorylinks, $recentchanges
99 " . ($uid ?
"LEFT OUTER JOIN $watchlist ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . "
100 WHERE rc_timestamp > '{$cutoff}'
102 AND cl_from=rc_cur_id
108 "SELECT /* wfSpecialRecentchangeslinked */
127 " . ($uid ?
",wl_user" : "") . "
128 FROM $pagelinks, $recentchanges
129 " . ($uid ?
" LEFT OUTER JOIN $watchlist ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . "
130 WHERE rc_timestamp > '{$cutoff}'
132 AND pl_namespace=rc_namespace
133 AND pl_title=rc_title
138 $res = $dbr->query( $sql, $fname );
140 $wgOut->addHTML("< ".$sk->makeLinkObj($nt, "", "redirect=no" )."<br />\n");
141 $note = wfMsgExt( "rcnote", array ( 'parseinline' ), $limit, $days, $wgLang->timeAndDate( wfTimestampNow(), true ) );
142 $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
144 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
145 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
148 $wgOut->addHTML( $note."\n" );
150 $list = ChangesList
::newFromUser( $wgUser );
151 $s = $list->beginRecentChangesList();
152 $count = $dbr->numRows( $res );
157 if ( 0 == $count ) { break; }
158 $obj = $dbr->fetchObject( $res );
160 $rc = RecentChange
::newFromRow( $obj );
161 $rc->counter
= $counter++
;
162 $s .= $list->recentChangesLine( $rc , !empty( $obj->wl_user
) );
166 $wgOut->addWikiText( wfMsg('recentchangeslinked-noresult') );
168 $s .= $list->endRecentChangesList();
170 $dbr->freeResult( $res );
171 $wgOut->addHTML( $s );