Commit graph

269 commits

Author SHA1 Message Date
addshore
e5879da149 Pass $key into CommentStore methods and use MediawikiServices
This allows CommentStore to be added to MediaWikiServices
without the need of an aditional Factory.

This change includes a compatability layer to allow the behaviour
from 1.30 to continue to be used while deprecated.

CommentStore::newKey has been deprecated.
Keys are now passed into the public methods of CommentStore
where needed.
The following CommentStore methods have had their signatures changed
to introduced a $key parameter, but when used in conjunction with
CommentStore::newKey behaviour will remain unchanged:
  * CommentStore::getFields
  * CommentStore::getJoin
  * CommentStore::getComment
  * CommentStore::getCommentLegacy
  * CommentStore::insert
  * CommentStore::insertWithTemplate

Change-Id: I3abb62a5cfb0dcd456da9f4eb35583476ae41cfb
2018-02-05 15:34:12 +00:00
Umherirrender
3124a990a2 Use ::class to resolve class names in includes files
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
2018-01-27 20:34:29 +01:00
Timo Tijhof
bee9f4db96 Remove various redundant '@license' tags in file headers
Redundant given this is the project-wide license already,
especially in file headers that already include the GPL license
header.

This and other minor fixups based on feedback from Ie0cea0ef5027c7e5.

* Add @file where missing.
* Move @ingroup and @deprecated from file to class doc where needed.

Change-Id: I7067abb7abee1f0c238cb2536e16192e946d8daa
2018-01-12 18:15:11 +00:00
Thiemo Mättig
ef470ebf7f Remove @param comments that literally repeat what the code says
These comments do not add anything. I argue they are worse than having
no comments, because I have to read them first to understand they
actually don't explain anything. Removing them makes room for actual
improvements in the future (if needed).

Change-Id: Iee70aad681b3385e9af282d5581c10addbb91ac4
2018-01-10 14:14:26 +01:00
mainframe98
70e92cdad5 Fix additional usage of incorrect case
Courtesy of the PhpStorm inspection Case mismatch in method call or
class usage.

Bug: T166759
Change-Id: I27c53658b99048fa0dd8f9d6ef1398620386e1cc
2017-12-15 11:58:11 +01:00
Aaron Schulz
c8d82c02c3 Use WANObjectCache::makeKey() in ChangesFeed
Change-Id: Ia029873e5d0883d177007555ad494cae9e00c407
2017-11-27 12:03:47 -08:00
Aaron Schulz
bb462e5193 Fix some broke cache key generations
Change-Id: Ib724fe0cfa866351caee89d3451b6c4b7b6a4578
2017-11-19 21:30:45 -08:00
Max Semenik
72b15b96e7 Fix function annotiation
Change-Id: I4dfc62c8ef2226b46aa1eed508816377f6599ab2
2017-11-04 00:35:39 -07:00
Brad Jorsch
c2f432625f Add deprecation notices for selectFields() methods deprecated in Idcfd1556
Now that WMF-deployed extensions have been updated to no longer call
them.

Change-Id: I04942ca1b95baa2126f2dcf4d0975536f4dd07c7
Depends-On: I300130c7b952a353ac28989d39d7f01366da2a37
Depends-On: Ia81bf6a655af800ce8ac19940d851e65746e1f77
Depends-On: I0d869aacaaad85cdd34361a611ac8348bdbb757d
Depends-On: I7b05a99e23da296a673eb0bd34f18344618c8be3
Depends-On: I42237e8e29497bbc56606f6ad01de3d525bf8b2a
Depends-On: If75d2e76c2f166bc40a544dd502da43171ce1e7b
Depends-On: I401809d2638b11e6c77a318fc8fbbc41fa639083
Depends-On: I5d62ad76fdb64a9c6efd228f27e9b5f512f17d5e
Depends-On: I488afaa991e3d26b638a4f588f70db455959eadf
Depends-On: Ibe82dadb0f2d1c5dbc38b96731c6e443c5469ff0
Depends-On: Id25b86dd415e2e3c6190a91faee2a3b815e50f61
2017-11-01 14:50:56 +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
Stephane Bisson
b31c87ab91 RCFilters: define consistent interface in ChangesListFilterGroup
Get rid of isPerGroupRequestParameter and define a consistent
interface that all filter groups can implement.

Change-Id: Ib904bcdc697c65722a0041ac611d1e00c577389f
2017-10-18 12:44:51 -07:00
Stephane Bisson
4b82dc1bee RCFilters: Don't let new params filter out old page
Bug: T177884
Change-Id: Id0ace30b837cf6c5fa7159aa40d80392187c4e16
2017-10-16 15:56:37 -04:00
jenkins-bot
7d8766e80e Merge "RCFilters: Allows specifying default highlights from the server" 2017-10-04 20:58:42 +00:00
Stephane Bisson
8937a72df7 RCFilters: Allows specifying default highlights from the server
Bug: T172757
Change-Id: I0545b4e0222e14be99d567e7890ccf33722a5d1e
2017-10-04 13:51:23 -07:00
Stephane Bisson
dbc83d9c43 RCFilters: Avoid adding raw filter and group objects to js vars
Bug: T176236
Change-Id: I0c68ea0e090cfb065d2e3e8acad7025c61c344ca
2017-10-04 11:08:51 -04:00
Moriel Schottlender
a8497a3dd0 RCFilters: Output namespace class on log actions as well
Bug: T174732
Change-Id: Icaf7117d9566bb2bb31c69cf86078491d6c217cc
2017-09-13 17:18:11 -07:00
Moriel Schottlender
4596728148 RCFilters: Actually apply proper classes to grouped pages
Bug: T174734
Change-Id: Ie0a8f5587103c3caed31d29585db78017ac4ab4c
2017-09-13 10:22:25 -07:00
Umherirrender
f739a8f368 Improve some parameter docs
Add missing @return and @param to function docs and fixed some @param

Change-Id: I810727961057cfdcc274428b239af5975c57468d
2017-09-10 20:32:31 +02:00
Matthew Flaschen
91c2f9a6d5 RCFilters: Remove getValue and use FormOptions
Ensure the default is boolean, then FormOptions will
do the rest for us.

Bug: T174725
Change-Id: I92f2f77e1225f536a38f592578012855b948050c
2017-09-08 21:26:20 +00:00
Stephane Bisson
5e12ab58be WLFilters: Respect default values
Followup to I3e48a9f2d9b70f0b9f6d7c6329db9c8e8001ee49
Reported in T174725#3590145

Comparing current value and active value with
different representation ("1" !== true) leads to
not applying filters that are ON by default.

Bug: T174725
Change-Id: If083610c0294756589adfc32a59388cc7422ad5d
2017-09-08 10:01:00 -04:00
Mark A. Hershberger
4fd44dcd26 Note whether a category was added in a machine readable way
CategoryMembershipChange is great, but it doesn't have a
machine-readable way to see if the category has been added or removed
from the page. We could parse the comments, but that would rely on
reading the comments and matching the message against the translated
strings.

This patch adds a couple of parameters and notes whether the change
was an addition or removal in rc_params.

Also, puts the evaluation of the AbortEmailNotification hook before
the check of rc_type in the hopes that the extension CatWatch can send
out emails at the right time.

Bug: T175052
Change-Id: I3e2ac0cc148b9d618e2f8b7853b14bff827ee443
2017-09-06 09:03:54 +00:00
jenkins-bot
a17d459d4b Merge "Handle comment truncation in CommentStore" 2017-09-05 18:39:21 +00:00
Kunal Mehta
0cb2a09b6d Always put type information before variable name for @var tags
Like other tags, @var should have the type information before the
variable name.

<https://docs.phpdoc.org/references/phpdoc/tags/var.html>

Change-Id: I9eca6957b1990fa8cc687103dc02ee38af5f9086
2017-09-04 11:06:51 -07:00
Brad Jorsch
6ec1a31502 Handle comment truncation in CommentStore
Since the caller doesn't (and shouldn't) know whether CommentStore is
using the old or the new schema, it should leave truncation of comments
to CommentStore.

Change-Id: I92954c922514271d774518d6a6c28a01f33c88c2
2017-09-01 15:03:45 -04:00
Brad Jorsch
01a10dba5a Remove reference to deprecated IDatabase->nextSequenceValue()
The method was deprecated and made unnecessary in Ib308190c.

Change-Id: I1729ac0b3a88270a4c2f064187a2472112aaeb1e
2017-09-01 12:28:39 -04:00
Brad Jorsch
11cf01dd9a Add comment table and code to start using it
A subsequent patch will remove the old columns.

Bug: T166732
Change-Id: Ic3a434c061ed6e443ea072bc62dda09acbeeed7f
2017-08-30 15:05:00 +10:00
Stephane Bisson
ba86bd1d64 WLFilters: Use displaysOnUnstructuredUi instead of isVisible
Follow up I3e48a9f2d9b70f0b9f6d7c6329db9c8e8001ee49

Bug: T171134
Change-Id: Ife0b10265c34d2dfd9a4d234f4a5409382530cc9
2017-08-29 08:05:17 -04:00
Stephane Bisson
6314a9026f WLFilters: set default values
* Respect different default values for 'limit' and 'day'
  in RC and WL.

* Make 'latestrevision' respect 'watchlistextended'

Introducing 2 properties to ChangesListBooleanFilter
* activeValue: The value that defines when a filter is active.
  Most filters are active when they are set to 'true' but
  'extended' has no effect when it is 'true' and applies
  filtering when it is set to false.

* isVisible: Whether this filter is visible anywhere.
  'extended' is not visible in the legacy form but
  it is activated from preference or URL. When
  understanding form submission, it should not be assume
  to be 'false' when not present in the request.

Bug: T171134
Change-Id: I3e48a9f2d9b70f0b9f6d7c6329db9c8e8001ee49
2017-08-28 12:57:39 -04:00
jenkins-bot
72e689e843 Merge "RCFilters: Add marker between old and new changes in enhanced mode" 2017-08-17 05:56:42 +00:00
Geoffrey Mon
700e49dddd Unwatch link for pages in Special:Watchlist
When the 'watchlistunwatchlinks' preference option is enabled, this
adds a '×' link to each entry of the watchlist that unwatches the page
of that entry. When clicked, it changes into a '+' which can be used to
re-watch the page (effectively undoing the earlier unwatch).
When a page is unwatched, its entries and the entries of its associated
talk page (or vice versa) become translucent and are struck through.

Without JS, '×'/'+' link to action=(un)watch for the relevant page.

In addition, ChangesList classes have been modified to allow a prefixer
that adds a prefix to each line (used in this case to put the unwatch
link) and to add HTML data attributes to reliably determine the target
page of each entry. Unit tests have been updated accordingly.

Bug: T2424
Change-Id: I450b2901413d7e75c11de2a446829fdbb22d31e1
2017-08-12 19:36:29 -04:00
jenkins-bot
cc4115e87f Merge "Add missing @param and @return documentation" 2017-08-11 21:32:58 +00:00
WMDE-Fisch
6df9ed1ad6 update mediawiki-codesniffer to 0.11.0 and fix issues
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
2017-08-11 22:27:51 +02:00
Umherirrender
718e63694d Add missing @param and @return documentation
Change-Id: I1d1098eec3933df6561cceef646576013ddc08c8
2017-08-11 22:17:01 +02:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
jenkins-bot
b5ddc3a4b4 Merge "Make phpcs pass" 2017-08-11 15:18:48 +00: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
Umherirrender
43e8cd0579 Make phpcs pass
Reenable MediaWiki.WhiteSpace.SpaceBeforeClassBrace.NoSpaceBeforeBrace,
because the mentioned bug is fixed

Bug: T172933
Change-Id: I1593bdba2295ebed401b921f2beabed69dba7638
2017-08-11 16:22:42 +02:00
Stephane Bisson
d65f49aa78 RCFilters: Add marker between old and new changes in enhanced mode
For both "Live Update" and "View newest changes", add a marker
between old and new groups when changes are grouped by page.

Bug: T163426
Change-Id: I00947d05e9b6022604a2a6b94eec94f6ed747c96
2017-08-07 14:52:42 -04:00
Stephane Bisson
e2bea6350c RCFilters: show new changes
When "live update" is off and new changes are detected,
show a link to load and prepend the changes to the list.

Also adding a line between old and new changes
when grouping by pages is off.

Bug: T163426
Change-Id: I6a111d23956bdc04caa4c71e9deede056779aafa
2017-07-31 08:50:09 -04:00
jenkins-bot
244e29b2c9 Merge "EnhancedChangesList: Don't render headings for empty days" 2017-07-25 12:55:18 +00:00
Kunal Mehta
d1cf48a397 build: Update mediawiki/mediawiki-codesniffer to 0.10.1
And auto-fix all errors.

The `<exclude-pattern>` stanzas are now included in the default ruleset
and don't need to be repeated.

Change-Id: I928af549dc88ac2c6cb82058f64c7c7f3111598a
2017-07-22 18:24:09 -07:00
jenkins-bot
e72303c9f3 Merge "Remove auto-generated "Constructor" documentation on constructors" 2017-07-21 13:19:44 +00:00
Thiemo Mättig
91a920fd85 Remove auto-generated "Constructor" documentation on constructors
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.

This is similar to I994d11e. Even more trivial, because this here is
about comments that don't say anything but "constructor".

Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
2017-07-21 12:19:30 +02:00
Roan Kattouw
11f9d532b4 EnhancedChangesList: Don't render headings for empty days
EnhancedChangesList renders an <h4> for every day, but it
does so before it starts rendering the changes for that day.
If all of the changes for a different day fail to render
(due to permissions issues, extension hooks, or whatever)
this would result in an empty heading.

Instead, render the heading after formatting is complete,
so that if all changes for a given day are dropped,
the heading is also dropped.

Bug: T171078
Change-Id: I8a0c6cbd679976d18d2c2e6e9ac972fb7b294a42
2017-07-20 11:38:52 -07:00
Roan Kattouw
59c94b1c9d ChangesListStringOptionsFilter: Make isSelected() respect ALL
ChangesListStringOptionsGroup::modifyQuery checks for ALL and
behaves accordingly, but isSelected() didn't. This broke conflict
detection when an entire non-full-coverage group was selected.

Bug: T162630
Change-Id: Ie241744201380ca5450d5edbb3eba971194f3df4
2017-07-17 16:52:51 -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
Umherirrender
be42e09aa8 build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168

Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||

Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
2017-06-26 17:14:31 +00:00
jenkins-bot
246bc1a78d Merge "Fix enhanced RC data attribute sanitizing" 2017-06-21 19:38:48 +00:00
jenkins-bot
7bb26739ec Merge "Add a message to localize strings like "2×" and use it in enhanced RC" 2017-06-19 18:50:35 +00:00
Gergő Tisza
94749fa62e Fix enhanced RC data attribute sanitizing
We push 'class' in the attribute array so the hook
can manipulate it, so it needs to be added to the attribute
whitelist as well.

Broken in I6dd006d0b1b0fd35c0020f0f9eea9113eca30b35.

Bug: T167922
Bug: T167535
Change-Id: Ic24400382a9dcbb990e12dfddae4ab7db14553cc
2017-06-15 00:02:44 +00:00