Commit graph

107 commits

Author SHA1 Message Date
C. Scott Ananian
b702f5a659 Use Html:rawElement() where possible in special pages.
Gently discourage building HTML by raw string concatenation.

Fixes for Special{Contributions/Recentchanges*/Undelete/Upload}.

Change-Id: I4a128e902dcce93372b2f188a1f37223c58ebe9a
2018-10-26 13:52:22 -04:00
Stephane Bisson
82622146f8 RCLFilters specific message for invalid target page
* always hide the big red .errorbox when rcfilters
  is enabled

* always identify the changes-list section with
  .mw-changeslist or .mw-changeslist-empty

* conditionally add .mw-changeslist-empty-<reason>
  to the changeslist section when the reason for it
  being empty is known

* handle RCL being empty because the specified title
  is invalid or inter-wiki

Bug: T184952
Change-Id: I5dd974f5f769503e89301dd22bdfd3d49b0dd11f
2018-02-23 06:02:22 +00:00
Stephane Bisson
21c7cd7109 RecentChangesLinked: Include title without subpage in form
When the 'title' hidden field contains the subpage, the 'target'
input field is never taken into account since the subpage always
takes precedence in ChangesListSpecialPage->setup()

I75cfb2b56a4da6357e6117b3f34f3178bfb2c90c introduced
SpecialRecentChangesLinked->getPageTitle which overrides
SpecialPage->getPageTitle to include the subpage by default.

This helped with redirecting to the right page when parsing
a saved query on the server but changed the behavior everywhere
that function was used in the context of RCL. That includes
SpecialRecentChanges.php:545 where the option form is built.

Bug: T183437
Change-Id: Id39d1887719ecb6900b25fefbb133dff9c4d0456
2017-12-21 11:30:22 -05:00
Stephane Bisson
19f8608e29 RCLFilters: UI tweaks
Follow-up to I96af7ba583d03e6ff9833ac3b5f4b80cfd0ee626

* Reword 'Recentchangeslinked-summary'
* Bold ToOrFrom selector label
* Bold 'FROM' in 'rcfilters-filter-showlinkedfrom-option-label'
* Bold 'TO' in 'rcfilters-filter-showlinkedto-option-label'
* Reword target page selector placeholder
* Prevent title suggestions from showing duplicate entries
* Show a specific message when there is no results
  because no target page is specified.

Bug: T172161
Change-Id: I1b1ee793b3eff4183039acc27fe6cca042ee57d0
2017-12-06 11:33:45 -05:00
Moriel Schottlender
a538407bc9 RCFilters: Followup I75cfb2b56a: Fix function declaration
Bug: T181671
Change-Id: Ie69e9f0f77b2c463bc2e4d41cd9a1b8e87f7efef
2017-11-30 11:13:07 -08:00
Moriel Schottlender
28132fb14a RCFilters: Respect subpage in RCLinked
Make sure that when we redirect a URL when there's a saved query,
we retain the information about a subpage.

Then, normalize the URL to always use &target=xxx so that the
system knows to correct the value if the user uses the form that
is, for the moment, outside the regular RCFilters interface.

Bug: T181100
Change-Id: I75cfb2b56a4da6357e6117b3f34f3178bfb2c90c
2017-11-22 10:02:25 -08:00
jdlrobson
4e7021a231 Provide message/warning/error box abstraction
This will help us consolidate the various uses into one single
method which will help us drive standardisation of these defacto
widgets.

Hopefully, by being a method of the Html class, which has a very
low barrier for use will drive down the inconsistent display of
warning/error boxes across MediaWiki's products

Various usages of warningbox and errorbox have been ported over.
I've retained some more complicated usages which make use of the
parser (wrapWikiMsg) and any where id and class are medled with
- we'll probably want to consider whether we want to encourage
those going forward as they encourage adjusting the styling.

Bug: T166915
Change-Id: I2757e1f4ff2599e93a7257fc644cab69063896d2
2017-11-13 23:19:45 +00:00
Brad Jorsch
3488f49532 Replace selectFields() methods with getQueryInfo()
Several classes have a "selectFields()" static method to tell callers
which fields to select from the database. With the recent comment table
change and the upcoming actor table change, this pattern has become too
simplistic as a SELECT will need to join several tables to be able to
retrieve all the needed fields.

Thus, we deprecate the selectFields() methods in favor of getQueryInfo()
methods that return tables and join conditions in addition to the
fields.

Change-Id: Idcfd15568489d9f03a7ba4460e96610d33bc4089
2017-10-30 22:57:33 +00:00
Roan Kattouw
b0897c3dee SpecialRecentchangeslinked: Unconditionally join on the page table
As we do on SpecialRecentchanges and SpecialWatchlist already,
because the last revision filter needs it.

Bug: T176228
Change-Id: I65f0f971df24853999ca445f968dd49fb0640066
2017-09-19 10:22:47 -07:00
Umherirrender
bf61a77431 Change @inheritdoc to @inheritDoc
Only @inheritDoc works for the Sniff
MediaWiki.Commenting.FunctionComment

Change-Id: I91fc02cda6701d790e4334fc2bc47f230955545c
2017-08-11 16:49:52 +02:00
Roan Kattouw
1c816f483f Follow-up 2a04f2d: don't pass [''] as tag filter when tagfilter=''
Change-Id: I472ff9524840c01131995a884283ca426e133879
2017-07-25 17:45:00 -07:00
Roan Kattouw
2a04f2dbf9 RCFilters: Filter duplicates when filtering for multiple tags
When filtering for multiple tags, add DISTINCT to the query.
To make this not result in terrible query performance, we also
have to add the rc_id to the end of the ORDER BY, and add
a GROUP BY equal to the ORDER BY.

Make ChangeTags::modifyDisplayQuery() take an array of tags
instead of a pipe-separated string. This allows each caller
to explicitly opt into supporting multi-tag filters and the
conditional GROUP BY mess that that entails.

Only support multi-tag filters in SpecialRecentChanges and
SpecialRecentchangesLinked. This means we don't have to adapt
the queries in HistoryAction, ContribsPager, LogPager and
NewPagesPager to deal with a possible DISTINCT modifier.

Example query with no tag filters:
SELECT rc_id, ... FROM recentchanges ... ORDER BY rc_timestamp DESC

Example query with one tag filter:
SELECT rc_id, ... FROM recentchanges JOIN change_tag ON ...
WHERE ... AND ct_tag='foo' ORDER BY rc_timestamp DESC

Example query with two tag filters:
SELECT DISTINCT rc_id, ... FROM recentchanges JOIN change_tag ON ...
WHERE ... AND ct_tag IN ('foo', 'bar') GROUP BY rc_timestamp, rc_id
ORDER BY rc_timestamp DESC, rc_id DESC

Bug: T168501
Change-Id: I54a270a563d99b143b55ce83c7d6f70ac4861c64
2017-07-24 10:34:20 -07:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Matthew Flaschen
aa063f4c5a Back-end of new RecentChanges page, refactoring
Generate old RC, Related changes (it was already displayed and working
on 'Related changes' before this change), and Watchlist/etc. and data
for new UI from back-end.

This moves everything used for defining the old (unstructured) and new
(structured) filters into unified objects, ChangesListFilter and
ChangesListFilterGroup (and sub-classes).

This includes the query logic (see below) and logic for adding
CSS attribution classes.

This is a breaking change (for subclasses of ChangesListSpecialpage)
due to the signature (and name) change of buildMainQueryConds and
doMainQuery.  An alternative that I don't think is a breaking change
would be to put the filter->DB logic in runMainQueryHook, but then it's
doing more than just running a hook.

This is because it used to only build $conds here, but it's clear from
filterOnUserExperienceLevel filters need more than this.  I added all
the DB parameters from the hook, but this could be debated.

I have an checked and fixed the WMF-deployed extensions affected by
this.

Other than that, there should be full back-compat (including legacy
filters not using the new system).

* add hidepatrolled/hideunpatrolled to new UI.

* Move userExpLevel from RC to ChangesListSpecialPage.  Although for
now the structured UI only displays on RC anyway, when it displays on
watchlist, it seems we'll want userExpLevel there.

  Change this to make 'all' exclude unregistered users.

* Don't have front-end convert none-selected to 'all' on string_options.

* Needs the hideanons/hideliu special redirect to be done before this
is merged (T151873)

Bug: T152754
Bug: T152797
Change-Id: Iec2d82f6a830403d1c948a280efa58992e0cdee7
2017-03-11 01:42:01 +00:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Reedy
1834ee3d8e Fix numerous class/function casing
Change-Id: I23982bfa0548c9ea3bdb432be7982f1563930715
2016-03-18 23:14:49 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Stanislav Malyshev
027972a20f Include completion search into SearchEngine
By default it still uses PrefixSearch and supports PrefixSearchBackend
but it can be deprecated and phased out and SearchEngine extensions used
instead.

New APIs:
- SearchEngine
	public function defaultPrefixSearch( $search );
	public function completionSearch( $search );
	public function completionSearchWithVariants( $search );

Search engines should override:
protected function completionSearchBackend( $search );

Bug: T121430
Change-Id: Ie78649591dff94d21b72fad8e4e5eab010a461df
2016-02-03 23:41:49 +00:00
umherirrender
345356c747 No prefix suggestion of special and media namespace on special pages
As mention in comments of I71f77c3001a12d75b901807c20115cead9c64e93 the
added prefix suggestion can get called recursive.
Avoid this by disable prefix suggestion for media and special namespace,
because a special page cannot be used on that special pages.

Follows I71f77c3001a12d75b901807c20115cead9c64e93

Change-Id: I8978e3bd0783f62bc25b32a0fdaa90361abefcf3
2015-12-13 18:39:14 +01:00
Albert221
f1d8e12c50 Resolve code invoking Title::newFromURL
Bug: T65424
Change-Id: I6c97245faccd8b34557eb3be4150867fd9b37992
2015-12-12 12:00:37 +01:00
umherirrender
95b432758c Allow auto suggestion for subpages of some special pages
The autocomplete search allows special pages to define the list of
subpages to be excepted. Fill up the function to show auto suggestion
for subpages of the following special pages:

Special:AllPages
Special:ChangeContentModel
Special:FileDuplicateSearch
Special:Movepage
Special:PageLanguage
Special:Prefixindex
Special:Recentchangeslinked
Special:Undelete

This makes it easier to navigate to this special pages with a prefilled
title/target field.

Change-Id: I71f77c3001a12d75b901807c20115cead9c64e93
2015-12-06 18:29:08 +01:00
Federico Leva
8d08910bfa Add help link for 8 more special pages
* Links can now be customised on-wiki via system message:
  e928d5bdd0
* Most help pages chosen here are good for any MediaWiki install
  and have been imported on MediaWiki.org. Their license has been
  noted in the appropriate template, only future contributions
  will be in public domain (CC-0) unless we reach old authors.
  An update/discussion was opened at the project talk:
  https://www.mediawiki.org/wiki/Project_talk:PD_help
* The 6 pages on MediaWiki.org have been marked for translation;
  import of previous translations is ongoing. 2 pages are left on Meta
  because importing translatable pages with all translation units may
  be overkill.

Bug: T45591
Change-Id: I5dd91a0b7233556f2da06b65205fee72ea65a55f
2015-05-15 11:25:27 +00:00
umherirrender
ad855f9ae0 Set relevant title on Special:RecentChangesLinked
This adds title related tabs like watch on the special page
Same as on Special:MovePage

Change-Id: I0e8ef723b44069945d4e39566225ec77b2f85e10
2014-08-13 04:44:12 +00:00
Reedy
e3825bf76d Remove duplicate override in SpecialRecentchangeslinked.php
Causes bug in FR

Change-Id: I5efa8953e6e6717ba043fa13a652f1dfcf936bf2
2014-08-12 19:48:29 +01:00
Thiemo Mättig
4c972c834b Fix messed up parameters in Recentchanges hook
Ouch. Sorry.

Bug: 68938
Bug: 68943

Change-Id: I3c02c2ff06a3e8ee02136c876276cb63de03bcc7
2014-08-01 15:41:23 +00:00
Thiemo Mättig
08fee4ce2f Fix deprecated hooks not having a non-deprecated alternative
The implementation in ChangesListSpecialPage::doMainQuery() is
dead code. It's never executed because the relevant subclasses
override the method completely without ever calling
parent::doMainQuery().

This means that the deprecation of the hooks in the subclasses
leaves us with no alternative. Which is a real problem in
Wikibase, see I27716275e966147ee26d81d8ce3f14951937e718.

The same deprecation in ChangesListSpecialPage::getCustomFilters()
works because all suclasses I'm aware of call the parent method.
But please note that extensions may still break if they do this
different. I can not checked them all.

If you want to be sure you should just revert patch
I9cceda5d2dcfc53c852c5682c466b48ad8f31202 that introduced this
non-functional hook. I'm sorry to say that but I wonder how this
passed review.

Change-Id: I7ba3ea64cb145c06011a856e5b56399da4f42339
2014-06-30 17:08:15 +02:00
Bartosz Dziewoński
a4aa71c6cf ChangesListSpecialPage: Implement two new hooks superseding 4 old ones
Old hooks (called by SpecialWatchlist, SpecialRecentChanges and
SpecialRecentChangesLinked) have been deprecated, but I'm not planning
to remove them anytime soon. (They have lots of usages in extensions
as of this writing.)

The new hooks (and their deprecated friends) are:

* ChangesListSpecialPageFilters:
  * Replaces: SpecialRecentChangesFilters and SpecialWatchlistFilters
  * The signature for this one is exactly the same as signatures for
    the other two. We might want to pass something else than $this
    here…

* ChangesListSpecialPageQuery
  * Replaces: SpecialRecentChangesQuery and SpecialWatchlistQuery
  * These hooks have wildly different signatures. The new one is a
    superset of the old ones, in a more reasonable order, with the
    addition of the name of the special page we're doing right now.

Change-Id: I9cceda5d2dcfc53c852c5682c466b48ad8f31202
2014-04-11 22:53:35 +02:00
Siebrand Mazeland
374cce86c8 Update formatting for includes/specials/
Change-Id: I478dedd0b692eae002a0ca9b0ec15cb2c357411f
2014-03-23 11:19:12 +00:00
Siebrand Mazeland
b6adafc146 Fix CodeSniffer errors and warnings
For the files touched in I06ee0f01d8 as logged at
https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs-strict-HEAD/7798/console

Change-Id: I811884f7a5ada4d0551552d0a2c2775d6b17b59f
2014-03-12 12:50:43 +01:00
Bartosz Dziewoński
fc20c30d20 ChangesListSpecialPage: Separate all functionality for generating feeds
I should have done it at the beginning instead of trying to
extract it from recent changes.

Same for SpecialRecentChanges and SpecialRecentChangesLinked
(subclasses).

Created a new API module for it: ApiFeedRecentChanges.
It's somewhat un-API-like and hackish, but all feed modules are.

Old URLs redirect to new ones, so this should be fully
backwards-compatible assuming sane feed reader clients.

Change-Id: I06ee0f01d896bc66545a1800b24693ce7524e433
2014-03-12 12:31:41 +01:00
Bartosz Dziewoński
b941fcb094 ChangesListSpecialPage and subclasses: Reorder functions
No functional nor cleanup changes, just reordering. This should
make further refactoring (and reviewing it) easier.

In ChangesListSpecialPage placed them in "call-graph" order
instead of somewhat randomly.

In subclasses placed ChangesListSpecialPage functions first in the
same order, feed-related things later, and internal functions last.

Change-Id: I0cccfdb7c5ecd99a92d09d835211153279d71846
2014-01-16 19:30:15 +01:00
umherirrender
65a4ae9fe9 Change Title::getInterwiki() in conditions to Title::isExternal()
Change-Id: Icce26e6194ae96f262029554e05b49117d5e112e
2014-01-02 11:59:10 +01:00
Kunal Mehta
bc798535fd Deprecate SpecialPage::getTitle
Callers should use SpecialPage::getPageTitle, which is
exactly identical.

This is so that in the future we can turn SpecialPage
into a ContextSource, which requires getTitle to return
getContext()->getTitle.

Change-Id: Icdcf5d5295ef5e7f08b1d403e0c123f78738fd40
2013-12-24 12:53:11 -08:00
Patrick Westerhoff
51d73d9808 Integrate feed-specific setup into general setup
The special page setup was previously handled separately for feed output
to restrict the request arguments to a small subset of possible filter
options. This behavior was removed in 52b59f0685.

This makes the main difference between the normal and the feed setup that
custom filter options were not loaded for feed output. Support for custom
filter options was introduced with fcbdd58326 but did not touch the feed
setup, preventing filters from being initialized when requesting a feed
(see bug 57201).

After adding support for custom filters to the feed setup, the only
remaining difference is a different default limit, and the support for
subpage syntax for non-feed output.

This commit merges the feed setup with the standard setup.

Furthermore, in `SpecialRecentchangeslinked`, the extra argument parsing
was made also redundant with 52b59f0685.

Bug: 57201
Change-Id: Ia8ba28efb96da9df5d7252278d46ff88a143368c
2013-12-19 18:16:49 +01:00
Bartosz Dziewoński
f2e55d1273 Rename SpecialRecentchangeslinked class to SpecialRecentChangesLinked
For consistency with SpecialRecentChanges.

This introduces no incompatibilities as PHP classes are case-insensitive.

Change-Id: I5855074deed52fd7492f033c8a8fced8af647602
2013-12-18 20:00:34 +00:00
umherirrender
f5809f3031 Avoid strip markes on transcluded Special:RecentChanges[Linked]
OutputPage::wrapWikiText results in a Parser::parse call, which should
not be done recursively. Using workaround from the warning under
https://www.mediawiki.org?oldid=807703#OutputPage-.3EaddWikiText.28.29

This only was happen, when the special page has no result or for
RecentChangesLinked a bad title was given.

Bug: 56167
Change-Id: I334bc6c36800af80e311301d46c7d48be1b6a055
2013-10-31 10:41:13 +00:00
jenkins-bot
eb52fff1c4 Merge "RecentChanges, RecentChangesLinked, Watchlist: message when no items" 2013-07-01 14:31:50 +00:00
MatmaRex
e0c3170455 RecentChanges, RecentChangesLinked, Watchlist: message when no items
Use consistent message in RecentChanges, RecentChangesLinked, and
Watchlist when there are no items to be shown.

Previously RecentChanges just showed empty space and
RecentChangesLinked and Watchlist used two different messages.
Harmonized both the text and the code.

Message added: 'recentchanges-noresult'
Messages removed: 'recentchangeslinked-noresult', 'watchnochange'

Change-Id: Idf9f7a8422d9ad13dc46c69ee284b04cbbe211b7
2013-07-01 16:27:04 +02:00
jenkins-bot
db77dcc731 Merge "Add user rights 'viewmywatchlist', 'editmywatchlist'" 2013-06-26 23:19:28 +00:00
Derk-Jan Hartman
7e0072fd17 Remove unnecessary clears
This is a followup to Ibb9371ee.

Bug: 33438
Change-Id: I0b39138967f2d29d5e50db0a5990d175fcc81a8e
2013-06-26 23:53:46 +02:00
Brad Jorsch
18062eb3b0 Add user rights 'viewmywatchlist', 'editmywatchlist'
These are needed for OAuth grants.

Note that, even if 'editmywatchlist' is not granted, various actions
will still allow for adding but not removing of pages.

Change-Id: Ie33446a228dd6ed0114730935c1bf65667f5ce01
2013-06-26 10:20:40 -04:00
MatmaRex
feb4ffcf72 Don't reinvent the wheel in SpecialRecentchangeslinked::getExtraOptions
Just call parent::getExtraOptions() first and then simply add the one
additional field. The 'SpecialRecentChangesPanel' hook wasn't called
from SpecialRecentchangeslinked previously, I've wrapped the call in
an if to keep the behavior the same.

Changes this causes:
* If $wgAllowCategorizedRecentChanges is true, Recentchangeslinked
  will include the category filter form as well.
* The target filter on Recentchangeslinked will be displayed at the
  end of the form, below the tag filter.

Change-Id: I4436a63356adb1e0b0daa1aa52c179974a036fa1
2013-05-24 21:29:44 +02:00
umherirrender
e51885d86e Fixed spacing in specials folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I7873c656b16f6e905bb5abb2c2db6f6e84c11430
2013-04-20 10:20:51 +02:00
Alexandre Emsenhuber
df5265e14d Fix case of some Title methods
Change-Id: I37ce7fe392f4941c500fa0a88007664501d7e338
2013-03-27 14:36:05 +01:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
umherirrender
453264f904 fix some spacing
Change-Id: I2a59eb22bb8acf01b560507a48d6be55d9c87de7
2013-01-31 20:06:37 +00:00
umherirrender
824fad9956 fix some spacing
Change-Id: I78a97ad87e0bfe724fc851daf6ffeeed81887800
2013-01-26 19:15:35 +01:00
umherirrender
31f3f93d9f Use array for join condition
Change-Id: I52875ebd5fc67e74439faf703b8119fedd70bfc9
2013-01-19 12:20:37 +01:00
mrbluesky
bb8ae34172 (bug 28401) Make RC en RCL honour options for rss/atom
RecentChanges and RecentChangesLinked should link to atom/rss feeds using the same options as specified for the pages themselves. E.g. if somebody is looking at Special:RecentChanges&hideliu=1&namespace=1 the feed(s) should link to Special:RecentChanges&feed=atom&hideliu=1&namespace=1. All options available on RC and RCL are already supported by their feeds, except the maximum number of changes in feeds is bound by $wgFeedLimit.

Change-Id: I8fb00ccd7efdd962a8a42f0bce3eac5177e2cfbd
2012-12-16 10:34:23 +00:00