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() ) {
66 Html::errorBox( $this->
msg(
'allpagesbadtitle' )->parse() )
71 $outputPage->setPageTitle( $this->
msg(
'recentchangeslinked-title', $title->getPrefixedText() ) );
83 $id = $title->getArticleID();
84 $ns = $title->getNamespace();
85 $dbkey = $title->getDBkey();
87 $rcQuery = RecentChange::getQueryInfo();
89 $select = array_merge( $rcQuery[
'fields'], $select );
90 $join_conds = array_merge( $join_conds, $rcQuery[
'joins'] );
93 $uid = $this->
getUser()->getId();
94 if ( $uid && $this->
getUser()->isAllowed(
'viewmywatchlist' ) ) {
96 $select[] =
'wl_user';
97 $join_conds[
'watchlist'] = [
'LEFT JOIN', [
100 'wl_namespace=rc_namespace'
106 $join_conds[
'page'] = [
'LEFT JOIN',
'rc_cur_id=page_id' ];
107 $select[] =
'page_latest';
109 $tagFilter = $opts[
'tagfilter'] ? explode(
'|', $opts[
'tagfilter'] ) : [];
110 ChangeTags::modifyDisplayQuery(
119 if (
$dbr->unionSupportsOrderAndLimit() ) {
120 if ( count( $tagFilter ) > 1 ) {
125 'GROUP BY' =>
'rc_timestamp, rc_id',
126 'ORDER BY' =>
'rc_timestamp DESC, rc_id DESC'
129 $order = [
'ORDER BY' =>
'rc_timestamp DESC' ];
144 $link_tables = [
'categorylinks' ];
145 $showlinkedto =
true;
148 $link_tables = [
'pagelinks',
'templatelinks' ];
150 if ( $ns ==
NS_FILE || !$showlinkedto ) {
151 $link_tables[] =
'imagelinks';
155 if ( $id == 0 && !$showlinkedto ) {
162 'templatelinks' =>
'tl',
163 'categorylinks' =>
'cl',
169 foreach ( $link_tables as $link_table ) {
170 $pfx = $prefix[$link_table];
174 if ( $link_table ==
'imagelinks' ) {
176 } elseif ( $link_table ==
'categorylinks' ) {
182 if ( $showlinkedto ) {
185 if ( $ns != $link_ns ) {
188 $subconds = [
"{$pfx}_to" => $dbkey ];
190 $subconds = [
"{$pfx}_namespace" => $ns,
"{$pfx}_title" => $dbkey ];
192 $subjoin =
"rc_cur_id = {$pfx}_from";
195 $subconds = [
"{$pfx}_from" => $id ];
196 if ( $link_table ==
'imagelinks' || $link_table ==
'categorylinks' ) {
197 $subconds[
"rc_namespace"] = $link_ns;
198 $subjoin =
"rc_title = {$pfx}_to";
200 $subjoin = [
"rc_namespace = {$pfx}_namespace",
"rc_title = {$pfx}_title" ];
205 array_merge(
$tables, [ $link_table ] ),
209 $order + $query_options,
210 $join_conds + [ $link_table => [
'INNER JOIN', $subjoin ] ]
213 if (
$dbr->unionSupportsOrderAndLimit() ) {
220 if ( count( $subsql ) == 0 ) {
223 if ( count( $subsql ) == 1 &&
$dbr->unionSupportsOrderAndLimit() ) {
227 $sql =
$dbr->unionQueries( $subsql,
false ) .
' ORDER BY rc_timestamp DESC';
228 $sql =
$dbr->limitResult( $sql, $limit,
false );
231 $res =
$dbr->query( $sql, __METHOD__ );
233 if (
$res->numRows() == 0 ) {
234 $this->mResultEmpty =
true;
243 $this->
getOutput()->addBacklinkSubtitle( $target );
244 $this->
getSkin()->setRelevantTitle( $target );
255 $extraOpts = parent::getExtraOptions( $opts );
257 $opts->consumeValues( [
'showlinkedto',
'target' ] );
259 $extraOpts[
'target'] = [ $this->
msg(
'recentchangeslinked-page' )->escaped(),
260 Xml::input(
'target', 40, str_replace(
'_',
' ', $opts[
'target'] ) ) .
261 Xml::check(
'showlinkedto', $opts[
'showlinkedto'], [
'id' =>
'showlinkedto' ] ) .
' ' .
262 Xml::label( $this->
msg(
'recentchangeslinked-to' )->
text(),
'showlinkedto' ) ];
272 if ( $this->rclTargetTitle ===
null ) {
274 if ( isset( $opts[
'target'] ) && $opts[
'target'] !==
'' ) {
275 $this->rclTargetTitle = Title::newFromText( $opts[
'target'] );
277 $this->rclTargetTitle =
false;
298 if ( $targetTitle ===
false ) {
300 '<div class="mw-changeslist-empty mw-changeslist-notargetpage">' .
301 $this->
msg(
'recentchanges-notargetpage' )->parse() .
304 } elseif ( !$targetTitle || $targetTitle->isExternal() ) {
306 '<div class="mw-changeslist-empty mw-changeslist-invalidtargetpage">' .
307 $this->
msg(
'allpagesbadtitle' )->parse() .
311 parent::outputNoResults();
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
runMainQueryHook(&$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts)
getOptions()
Get the current FormOptions for this request.
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.
outputNoResults()
Add the "no results" message to the output.
getExtraOptions( $opts)
Get options to be displayed in a form.
A special page that lists last changes made to the wiki.
Represents a title within MediaWiki.
this hook is for auditing only 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