34 parent::__construct(
'Recentchangeslinked' );
38 $opts = parent::getDefaultOptions();
39 $opts->add(
'target',
'' );
40 $opts->add(
'showlinkedto',
false );
46 $opts[
'target'] = $par;
55 $target = $opts[
'target'];
56 $showlinkedto = $opts[
'showlinkedto'];
57 $limit = $opts[
'limit'];
59 if ( $target ===
'' ) {
63 $title = Title::newFromText( $target );
64 if ( !$title || $title->isExternal() ) {
65 $outputPage->addHTML(
'<div class="errorbox">' . $this->
msg(
'allpagesbadtitle' )
66 ->parse() .
'</div>' );
71 $outputPage->setPageTitle( $this->
msg(
'recentchangeslinked-title', $title->getPrefixedText() ) );
83 $id = $title->getArticleID();
84 $ns = $title->getNamespace();
85 $dbkey = $title->getDBkey();
91 $uid = $this->
getUser()->getId();
92 if ( $uid && $this->
getUser()->isAllowed(
'viewmywatchlist' ) ) {
94 $select[] =
'wl_user';
95 $join_conds[
'watchlist'] = [
'LEFT JOIN', [
98 'wl_namespace=rc_namespace'
104 $join_conds[
'page'] = [
'LEFT JOIN',
'rc_cur_id=page_id' ];
105 $select[] =
'page_latest';
107 $tagFilter = $opts[
'tagfilter'] ? explode(
'|', $opts[
'tagfilter'] ) : [];
117 if (
$dbr->unionSupportsOrderAndLimit() ) {
118 if ( count( $tagFilter ) > 1 ) {
123 'GROUP BY' =>
'rc_timestamp, rc_id',
124 'ORDER BY' =>
'rc_timestamp DESC, rc_id DESC'
127 $order = [
'ORDER BY' =>
'rc_timestamp DESC' ];
142 $link_tables = [
'categorylinks' ];
143 $showlinkedto =
true;
146 $link_tables = [
'pagelinks',
'templatelinks' ];
148 if ( $ns ==
NS_FILE || !$showlinkedto ) {
149 $link_tables[] =
'imagelinks';
153 if ( $id == 0 && !$showlinkedto ) {
160 'templatelinks' =>
'tl',
161 'categorylinks' =>
'cl',
167 foreach ( $link_tables as $link_table ) {
168 $pfx = $prefix[$link_table];
172 if ( $link_table ==
'imagelinks' ) {
174 } elseif ( $link_table ==
'categorylinks' ) {
180 if ( $showlinkedto ) {
183 if ( $ns != $link_ns ) {
186 $subconds = [
"{$pfx}_to" => $dbkey ];
188 $subconds = [
"{$pfx}_namespace" => $ns,
"{$pfx}_title" => $dbkey ];
190 $subjoin =
"rc_cur_id = {$pfx}_from";
193 $subconds = [
"{$pfx}_from" => $id ];
194 if ( $link_table ==
'imagelinks' || $link_table ==
'categorylinks' ) {
195 $subconds[
"rc_namespace"] = $link_ns;
196 $subjoin =
"rc_title = {$pfx}_to";
198 $subjoin = [
"rc_namespace = {$pfx}_namespace",
"rc_title = {$pfx}_title" ];
203 array_merge(
$tables, [ $link_table ] ),
207 $order + $query_options,
208 $join_conds + [ $link_table => [
'INNER JOIN', $subjoin ] ]
211 if (
$dbr->unionSupportsOrderAndLimit() ) {
218 if ( count( $subsql ) == 0 ) {
221 if ( count( $subsql ) == 1 &&
$dbr->unionSupportsOrderAndLimit() ) {
225 $sql =
$dbr->unionQueries( $subsql,
false ) .
' ORDER BY rc_timestamp DESC';
226 $sql =
$dbr->limitResult( $sql, $limit,
false );
229 $res =
$dbr->query( $sql, __METHOD__ );
231 if (
$res->numRows() == 0 ) {
232 $this->mResultEmpty =
true;
241 $this->
getOutput()->addBacklinkSubtitle( $target );
242 $this->
getSkin()->setRelevantTitle( $target );
253 $extraOpts = parent::getExtraOptions( $opts );
255 $opts->consumeValues( [
'showlinkedto',
'target' ] );
257 $extraOpts[
'target'] = [ $this->
msg(
'recentchangeslinked-page' )->escaped(),
258 Xml::input(
'target', 40, str_replace(
'_',
' ', $opts[
'target'] ) ) .
259 Xml::check(
'showlinkedto', $opts[
'showlinkedto'], [
'id' =>
'showlinkedto' ] ) .
' ' .
260 Xml::label( $this->
msg(
'recentchangeslinked-to' )->
text(),
'showlinkedto' ) ];
270 if ( $this->rclTargetTitle ===
null ) {
272 if ( isset( $opts[
'target'] ) && $opts[
'target'] !==
'' ) {
273 $this->rclTargetTitle = Title::newFromText( $opts[
'target'] );
275 $this->rclTargetTitle =
false;
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
getOptions()
Get the current FormOptions for this request.
static selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object.
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
getSkin()
Shortcut to get the skin being used for this instance.
msg( $key)
Wrapper around wfMessage that sets the current context.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
prefixSearchString( $search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
This is to display changes made to all articles linked in an article.
setTopText(FormOptions $opts)
Send the text to be displayed above the options.
doMainQuery( $tables, $select, $conds, $query_options, $join_conds, FormOptions $opts)
@inheritDoc
parseParameters( $par, FormOptions $opts)
Process $par and put options found in $opts.
getDefaultOptions()
Get a FormOptions object containing the default options.
bool Title $rclTargetTitle
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
getExtraOptions( $opts)
Get options to be displayed in a form.
A special page that lists last changes made to the wiki.
runMainQueryHook(&$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts)
Represents a title within MediaWiki.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query