Commit graph

125 commits

Author SHA1 Message Date
Fomafix
6866cfec37 Simplify PHP by using ?? and ?:
Also remove not necessary surrounding parentheses.

Change-Id: I0eb5c9c1bdfb09a800258379cdcefb5fd4d3d21c
2018-07-10 20:03:17 +00:00
Umherirrender
ae2f5d6232 Add missing use statements
Swap some ResultWrapper/Database to interface IResultWrapper/IDatabase

Change-Id: I312cb3cca5742f72efdb0965ba35362f2eb1129d
2018-06-27 20:49:23 +02:00
Fomafix
125cbd8c01 Use \u{00A0} instead of   or  
Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0) instead of
the HTML/XML entities   or   or  .

With the UTF-8 character the generated HTML is shorter and better to read.

Also change the special value for the label in HTMLForm from   to
U+00A0 but also support   for backward compability.

Bug: T154300
Change-Id: I882599ac1120789bb4e524c4394870680caca4f4
2018-06-24 01:20:13 +00:00
Fomafix
e1630b6a53 PHP: Use short ternary operator (?:) where possible
Change-Id: Idcc7e4fcdd4d8302ceda44bf6d294fa8c2219381
2018-06-11 11:26:35 +02:00
Erik Bernhardson
4a1a21591b Resolve required parameter after optional in specials
Change-Id: If2c85d97d68b24fc5cb2bec19804034b994b348d
2018-06-08 15:26:03 -07:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Framawiki
7de963cb83 Add checkbox in Special:ListUsers to display only users in temporary user groups
New checkbox "temporaryGroupsOnly" with new message "listusers-temporarygroupsonly"

Bug: T174313
Change-Id: I388a8aab1145dc958ee110da324aeeb03660ff40
2018-05-13 11:51:50 +02:00
Aashaka Shah
ee07911229 Special:ListFiles: Convert to use OOUI
Bug: T117743
Change-Id: I1e61dc80e83f0aac9ec6a4e98837ca730b6946de
2018-05-07 14:42:44 +05:30
Jayprakash12345
2ce103833b Remove cssclass in the favor of 'type' => 'user'
* Special:ListFiles uses ImageListPager class as Object.
  Changes ImageListPager will happen there

Bug: T192694
Change-Id: I671c0659bd3f28f4369e2c86b06bb434dbd8430b
2018-04-22 05:17:07 +05:30
Amir Sarabadani
6a2cd1c5c2 Use constants for rc_patrolled values instead of numbers
These are recently introduced, better to use them

Change-Id: Id904ff09081cb5a1fe2f1c24c5d415da18fd2294
2018-04-13 23:56:35 +02:00
Umherirrender
a3da44c7df Change ResultWrapper to IResultWrapper in pagers and special pages
There is no need for a specific type, the interface implementation is
enough

Change-Id: I22ec4d3a9a19fc86efc9a2deb06f810695d38c85
2018-04-04 14:52:10 +02:00
Gergő Tisza
3577973107
Fix variable name in NewFilesPager::getQueryInfo
Bug: T189846
Change-Id: I11763ecbfd391deea0494386c0d7c1cb9861aa81
2018-03-15 17:40:32 -07:00
Brad Jorsch
3d20679f2d Typo fix
Bug: T189251
Change-Id: I5e7af2629d566181f3280049b6847c0126850ff2
2018-03-08 16:46:53 -05:00
Brad Jorsch
bac54c271c Restore index forcing in ContribsPager
For now at least this will avoid a filesort for some cases. But it might
start misbehaving again when $wgActorTableSchemaMigrationStage is set to
WRITE_BOTH or WRITE_NEW.

Bug: T189026
Change-Id: Idd987181b17b824fdf1094f5c3b1c689b1792eb0
2018-03-06 12:10:57 -05:00
daniel
218e8311d5 Pass '' instead of false for the $conds parameter in select calls.
Per documentation on IDatabase, $conds must be a string or an array.
Passing false for conds is confusing, since it's unclear whether this
should match everything or nothing.

Bug: T188314
Change-Id: I8be1ac4cbdaafc41aadc2a658be8a99b754b0268
2018-03-02 02:32:54 +00:00
Brad Jorsch
d6992713fd NewPagesPages: Use array_merge rather than + for RC query info fields
Unlike CommentStore::getJoin() and ActorMigration::getJoin(), the tables
and fields of various ::getQueryInfo() methods aren't guaranteed to be
safe to use with array '+'.

Bug: T188555
Change-Id: Ibe99edcb93d1729935fed6232ba4fe2e7d39cea6
2018-03-01 14:22:45 +00:00
Brad Jorsch
27c61fb1e9 Add actor table and code to start using it
Storing the user name or IP in every row in large tables like revision
and logging takes up space and makes operations on these tables slower.
This patch begins the process of moving those into one "actor" table
which other tables can reference with a single integer field.

A subsequent patch will remove the old columns.

Bug: T167246
Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50
Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
2018-02-23 10:06:20 -08:00
Reedy
39f0f919c5 Update suppressWarning()/restoreWarning() calls
Bug: T182273
Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
2018-02-10 08:50:12 +00:00
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
jenkins-bot
a18476eab3 Merge "Remove @param comments that literally repeat what the code says" 2018-01-11 23:48:03 +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
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
jenkins-bot
58f37bd13c Merge "Remove self-explaining "section heading" comments from classes" 2017-12-30 21:25:15 +00:00
Thiemo Mättig
fa15c98787 Improve (weak and strict) type hints invarious places
Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab
2017-12-28 16:31:56 +01:00
Thiemo Mättig
544122a6c2 Remove self-explaining "section heading" comments from classes
I can see that "parent::__construct" literally calls the parent
constructor. I can see that stuff preceeded by the keyword "protected"
is protected. I really (really) don't need comments explaining such.

Change-Id: I7458e714976a6acd3ba6a7c93fdc27d03903df83
2017-12-28 16:12:08 +01:00
Thiemo Mättig
2e94e4d790 Document "arrays of UserGroupMembership objects" as such
Change-Id: I3c60fb977a329e39933d50e275a738296bc17599
2017-12-27 12:53:17 +00:00
Brad Jorsch
149081f1a7 ImageListPager: Don't stomp on $join_conds
When adding a join to the oldimage table to get counts, don't stomp on
any existing values in $join_conds. Just add the condition.

Bug: T182245
Change-Id: I4cd3332355f9974bdf35dc083be5bba537fcfb5f
2017-12-07 10:14:35 -05:00
Brad Jorsch
f866dd9db9 Put page_is_new back into ContribsPager query
Accidentally removed in Idcfd15568.

Bug: T179467
Change-Id: I0a26da37638352d4a4dca08c0ef3eb9f99c7100a
2017-11-01 10:05:39 -04: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
Ori Livneh
a603ae73a7 Fix letter-case of several namespace and class names
'Mediawiki\Widget\SelectWithInputWidget' is the only one that shows up
in the logs, but I tidied up a few others I came across.

Change-Id: I700dec858007a8013e6d7b9e37ddf518f223d8b7
2017-10-14 21:43:05 -04:00
jenkins-bot
23f0ce46d4 Merge "ContribsPager: Check if target is an IP range outside foreach loop" 2017-09-19 20:31:15 +00:00
jenkins-bot
5179c299bc Merge "Remove use of implicitGroupBy() in ActiveUsersPager" 2017-09-18 21:43:50 +00:00
Aaron Schulz
057667cd6c Remove use of implicitGroupBy() in ActiveUsersPager
Bug: T160298
Change-Id: Id8963924f036e9ed3fcdde3a8e54b7126b72356e
2017-09-09 14:33:38 -07:00
Aaron Schulz
c02c962bf0 Remove implicitGroupby() use in ImageListPager
Note this only effects wikis with miser mode disabled, so there
is less risk of a poor query plan.

Change-Id: I692b23f176489b9a0907bcc65b4ca93f10367c48
2017-09-09 14:05:58 -07:00
MusikAnimal
7dbe3faa67 ContribsPager: Check if target is an IP range outside foreach loop
Follow up to https://gerrit.wikimedia.org/r/#/c/376449/

Change-Id: I5151c10569a92805f79b59f68f9c57c451dc4598
2017-09-06 22:29:36 -04:00
Kunal Mehta
c994e92d99 ContribsPager: Batch page existence lookup for IP range contributions
When looking up contributions for a range of IP addresses, include the
IP's talk page in page existence lookup batch so it doesn't get looked
up individually.

Change-Id: I5151c10569a92805f79b59f68f9c57c451dc4597
2017-09-06 17:08:29 -07:00
Kunal Mehta
325e6a1b9d ContribsPager: Don't call non-static function statically
Change-Id: Ic0753e96009f65f1599c9952784c52034b4ec096
2017-09-06 17:07:20 -07:00
MusikAnimal
d09554b6ef Add basic IP range support to Special:Contributions
This works by using the new table introduced with T156318.

The only thing that differs from normal Special:Contribs is we are
showing the IP address next to each entry. This is it how it is
displayed if you request to see newbie contributions:
https://en.wikipedia.org/wiki/Special:Contributions?contribs=newbie

For the time being, Special:DeletedContributions does not support
IP ranges. Various other irrelevant links such as Uploads and Logs
are also hidden.

Refer to P4725 for a way to automate creation of edits by random
IPs in your dev environment.

IP::isValidBlock() has been deprecated with this dependent change:
https://gerrit.wikimedia.org/r/#/c/373165/

Bug: T163562
Change-Id: Ice1bdae3d16cf365da14c6df0e8d91d2b914e064
2017-09-05 16:15:33 -04: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
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
jenkins-bot
84b6d5c2e5 Merge "Add missing type to @param documentation" 2017-08-11 21:31:51 +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
5544cef16b Add missing type to @param documentation
Change-Id: I6b2c9c7af9a281fe457099cc3a336a60a25e74aa
2017-08-11 20:37:35 +02:00
jenkins-bot
5f22cbca94 Merge "Special:Contribs: Ensure 'start' and 'end' are never undefined" 2017-08-04 00:50:52 +00:00
Matthew Flaschen
21cc36f87e Special:Contribs: Ensure 'start' and 'end' are never undefined
Bug: T172438
Change-Id: I7359fd489134cb2fff9715af9e675f8cbb706b7a
2017-08-03 17:44:49 -04:00
Max Semenik
fd6e9ef2d4 Human-readable section ID support
It adds the ability to replace the current section ID escaping
schema (.C0.DE) with a HTML5-compliant escaping schema that is
displayed as Unicode in many modern browsers.

See the linked bug for discussion of various options that were
considered before the implementation. A few remarks:
* Because Sanitizer::escapeId() is used in a bunch of places without
  escaping, I'm deprecating it without altering its behavior.
* The bug described in comments for Parser::guessLegacySectionNameFromWikiText()
  is still there in some Edge versions that display mojibake.

Bug: T152540
Change-Id: Id304010a0342efbb7ef2d56c5b8b244f2e4fb2c5
2017-08-01 20:32:20 -07:00
jenkins-bot
23719cdcc4 Merge "Fix Special:ListUsers "subpage parameter" handling" 2017-07-28 07:05:54 +00:00
Prateek Saxena
6fbe2e16fe UserPager: Call text() on message, don't use it directly
Bug: T171806
Change-Id: Ib9a1ae7b65f8a01542c61b192252f3bb3ded1236
2017-07-27 13:41:55 +05:30
Bartosz Dziewoński
f684e673c0 Fix Special:ListUsers "subpage parameter" handling
* Set the form action to avoid the subpage being "stuck". This is
  apparently a common problem and a common workaround, hmm. The $self
  variable, curiously unused, seems to have been meant for this.
* Fix incorrect parameter name to display values from subpage
  parameters in the form, and preserve them after submission.

Bug: T171657
Change-Id: Ibeee545a1e9932dfe44165c34cb55ad87268b705
2017-07-26 02:28:06 +02:00