Commit graph

78 commits

Author SHA1 Message Date
Amir Sarabadani
5f4a89d1c3 Remove logging table index hint
It's not an issue anymore and keeping such hard-coded index is harmful

Bug: T270620
Change-Id: I9198c29aa5e773a7521711ce4ef089a208f241ed
2021-06-21 12:47:31 +02:00
daniel
60734d3b19 LogPager: replace Title in method signatures
Bug: T278459
Change-Id: Icd273b598fefe5e5d18aef4e4d12adfbf88e291a
2021-05-07 17:12:23 +02:00
daniel
4dce6dd0c3 Deprecate UserIdentity::getActorId()
Note: User::getActorId() is not (yet) deprecated.

Bug: T274179
Change-Id: Ic2ca6d489db821fc2334e53bf2496c7b0d3ea5b1
2021-03-13 19:45:57 +01:00
Petr Pchelko
3a5c8f0f25 Convert logging namespace to Authority
Change-Id: Icb44acf275a7f9231c4d229b3886ed8a36d5cbd4
2021-02-23 21:58:37 +00:00
Amir Sarabadani
ae59076f2c Check for the index name while it's being renamed
Bug: T271259
Change-Id: If434ce229fbd06b958fbda407fb2ca54410a47c6
2021-01-05 22:48:31 +01:00
Ammarpad
071fcc0cfc Reflect name change of logging indexes in code
Bug: T270769
Follow-Up: I17028bba489d04b01d22c39dc8935a4f0f771c7e
Change-Id: I9d820dbd315fb793ccdb8b5591240328686a8c2e
2020-12-23 19:48:41 +01:00
DannyS712
ec3514343c LogPager: if log_id is set, don't use public exclude clause
Allow viewing private logs, like suppression, from just the logid
(if the user can see them)

Bug: T269761
Change-Id: Ief2f31c2339c3866d7629c5d09d8ec5caef3d960
2020-12-16 16:07:29 +00:00
jenkins-bot
26849c6438 Merge "Inject services into SpecialLog" 2020-11-20 18:59:09 +00:00
Umherirrender
6e70213453 Do not create title when calling LinkBatch in pagers
Title::makeTitleSafe is expensive and there is no need to create the
title to just pass namespace and dbkey to the LinkBatch
The underscore/space normalisation is done in LinkBatch::add

Also combine the linkbatch on Special:Undelete, because the user of
files are often the same as of the (null) revision
On Special:Log use log_user_text for the preload, it is always set

Change-Id: Iff8797df11d18107005402ba88b4a0e4beb3dd7d
2020-11-18 19:48:34 +00:00
Umherirrender
7d14ded394 Inject services into SpecialLog
This covers only directly used services by this special page and pager
Services used by the base class are not part of this patch set

Bug: T259960
Change-Id: Ib4b5edf6b4c56ef626875df8d95496225cddf501
2020-10-26 16:25:17 +00:00
Umherirrender
42507e73cd Use LinkBatchFactory in pagers, special pages and actions
Change-Id: I299900316c8d3129844a047228cd1c15ae7dff63
2020-09-06 01:26:09 +02:00
Reedy
1af2020739 Fix numerous Squiz.Scope.MethodScope.Missing
Change-Id: I7a5aa8555e94a0bcb97b37ec6f8ca854de7c5575
2020-05-15 21:12:30 +00:00
James D. Forrester
0958a0bce4 Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNull
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
2020-01-10 14:17:13 -08:00
jenkins-bot
27bc271f74 Merge "Use config in LogPager" 2020-01-02 15:25:45 +00:00
Brad Jorsch
fd72284446 LogPager: Add IGNORE INDEX to avoid another MariaDB optimizer bug
This is very similar to I53a7ed59 (T223151). In that bug it was choosing
the `times` index when it should have used `actor_time` due to a
non-empty performer. This time it's choosing `times` when it should be
using `type_time` due to a non-empty set of types being queried.

Bug: T237026
Change-Id: I02c77dde6b5b54d7bea801135051b006d39459b0
2019-11-14 09:58:33 +00:00
Brad Jorsch
c0ea9c285d LogPager: Add IGNORE INDEX to avoid MariaDB optimizer bug
This is basically the same thing we fixed for ApiQueryLogEvents in
I16dba2158.

Bug: T223151
Change-Id: I53a7ed59de3eed2b0b4f1b1fb7f6d302b1de276c
2019-09-24 13:58:22 +00:00
Matěj Suchánek
15cc583cb6 LogPager: separate getter from query filter
The method LogPager::getFilterParams combines data aggregation and query
modification which is problematic: it starts with "get" and is public
but has a side-effect. Instead, make a dedicated private method for
building the query and remove the side-effect.

The new private method is now dedicated to building the query, and so
it can also make sure whether selection by log id is requested. If it's
the case, it won't filter the log types out (fix for T220834).

Also remove redundant comment: it's irrelevant to require callers to
call a private method.

Bug: T220834
Change-Id: I0fb6e6ee30ac626192cdf4ef920a731c03b2732f
2019-09-19 18:32:09 +00:00
Matěj Suchánek
8704ba4d12 Use config in LogPager
This reduces use of globals.

Depends-On: Ibf4546141b0af8c615ca141b0e979aa4696d9b8a
Change-Id: Ib7a7cb55aa334661a5b430d48cf31e5965a4e059
2019-09-14 18:56:28 +02:00
jenkins-bot
d2f799f103 Merge "Declare dynamic properties" 2019-09-13 21:49:14 +00:00
Daimona Eaytoy
9699158f74 Declare dynamic properties
This is for all classes with 2 or more undeclared properties.

Change-Id: I1d80deb31f331bcc277b33f9e9f74857ba825637
2019-09-13 17:54:37 +00:00
Petr Pchelko
7b4eafda0d Replace usages of deprecated User::isAllowed. Step 2.
Bug: T220191
Depends-On: I509cd88355cfd0cc074f4135ec86399b4075f89f
Change-Id: I2341e6f1d108c92924620fba3c64ec090cb09918
2019-09-11 16:00:03 -07:00
Umherirrender
54190757bb Unpack arrays on variadic arguments
This avoids extra handling in the function to unpack an array

Change-Id: I93277599bc8125e23fca53d43a728fb7e9e39aad
2019-08-31 23:23:50 +00:00
Petr Pchelko
fd130247c2 Deprecate and replace usages of User:isAllowed{All,Any}
Bug: T220191
Change-Id: I197b8fadaa93e7b320fc19c10e3e09387fe09ad2
2019-08-21 18:36:16 -07:00
Brad Jorsch
77ca1430e4
SECURITY: LogPager: Don't STRAIGHT_JOIN when using log_search
We'll hope MariaDB doesn't trigger T221458 in that situation.

Bug: T222324
Signed-off-by: Scott Bassett <sbassett@deploy1001.eqiad.wmnet>
Signed-off-by: James D. Forrester <jforrester@wikimedia.org>
Change-Id: I06364e9d0bce45bd97b2ec837d1f479feff76699
2019-05-02 10:54:42 -07:00
Brad Jorsch
3d1fb0c044 Add STRAIGHT_JOIN to ApiQueryLogEvents and LogPager to avoid planner oddness
For some unknown reason, when the `actor` table has few enough rows (or
few enough compared to `logging`) MariaDB 10.1.37 decides it makes more
sense to fetch everything from `actor` + `logging` and filesort rather than
fetching the limited number of rows from `logging`.

We can work around it by telling it to not reorder the query.

Bug: T220999
Bug: T221458
Change-Id: I9da981c09f18ba72efeeb8279aad99eb21af699a
2019-04-23 10:00:21 -04:00
Aaron Schulz
cb15755e92 Normalize use of "INNER JOIN" to "JOIN" in database queries
The ANSI SQL default join type is INNER and this might save
some line breaks here and there.

Change-Id: Ibd39976f46ca3f9b71190d3b60b76ca085787a00
2019-03-06 09:17:30 -08:00
Alangi Derick
62bf6cad3d logging: Correct $logId default value in LogPager.php
$logId holds the log entry ID of some specific log and the datatype
is an integer (int) which is correct but looking at the constructor,
it does take a bool (false) which contradicts the docs above. So per
@Thiemo's advice after review of prev PS, it would be better to replace
false with 0 and leave the docs untouched.

Change-Id: Ieceb79a6cbaa248e1b7a7d3c1d51eb26bb3a2d84
2019-01-02 11:58:32 +00:00
Thiemo Kreuz
5b1cda7ae1 Mark protected IndexPager properties also as protected in subclasses
I'm intentionally only touching these protected properties and nothing
else, because I believe these are uncontroversial. They should be protected
according to modern SOLID standards, and actually are declared as
protected in the base class. What this patch effectively does is documenting
this fact, but it does not change anything.

Change-Id: I625307b58bd419c4a72e9842b2b46c08ed9b4f8e
2018-12-20 18:25:19 +01:00
Prateek Saxena
8aaa50b6ef LogPager: Add backwards-compatibility for hide_[type]_log URL params
Also, the $default value in LogEventsList#getFiltersDesc was not
being generated properly and would have always been an empty array.

Bug: T199856
Change-Id: Id286c76259406521f12cda67a4a715032e022637
2018-07-20 07:18:46 +05:30
Prateek Saxena
38756eae46 Special:Log: Convert to HTMLForm
* All Xml generation code has been removed.

* The LogEventsListGetExtraInputs hook now needs a form
  descriptor array and not plain HTML.
  See I37e0d3e81a46239750465b9299279fbbd7c7f87a.

* LogPager and LogEventList also take the $day parameter
  for 'From date (and earlier)' and pass it to getDateCond
  as well.

* Since FormOptions can't automatically extract the date
  from the request this is being done manually in the
  execute method of Special:Log using MWTimestamp.

Bug: T117737
Change-Id: Iba3c6aa5ac40dcdee0792c2d045b238b02d76521
2018-07-10 16:55:33 +05:30
Matěj Suchánek
1000236bb9 Prevent "Undefined offset notice"
The number provided by the query can be arbitrary, so let's narrow the
input validation to booleans.

Bug: T194616
Change-Id: If03e6e2d5bbcf4f2d85047cc23ee5388b39fe114
2018-06-29 07:42:36 +00:00
Bartosz Dziewoński
286cdb8382 LogPager/LogEventsList: Correct docs about $pattern parameter
$pattern is a boolean, it is documented as "Do a prefix search rather
than an exact title match". However, its type was incorrectly
documented to be a string, and the default value was '' instead of
false (which was harmless, as it is correctly treated as a boolean
value everywhere).

Change-Id: Id093d12891a231d5934f9908e619065afff7380e
2018-05-10 19:46:59 +00:00
Sam Wilson
8e04e60113 Add 'logid' parameter to Special:Log
Make it possible to get a URL for a single log entry,
as an alternative to using Special:Redirect/logid/123.

The existing single-log-entry link of Special:Redirect/logid/123
is also simplified to be a redirect to this new parameter.

Bug: T191608
Bug: T187638
Change-Id: I5f2e52531cd2ba617a25570e40aa8c5168e284d9
2018-05-04 09:52:55 +08:00
Brad Jorsch
fff578a12d Don't target log_user_text for registered users
Apparently when log_user_text was added no one bothered to populate it
for existing rows. Sigh, #Technical-Debt.

Bug: T188826
Change-Id: Ice1e6454e439a4abdf9594f6e964478dd484bc20
2018-03-06 16:22:35 +00:00
Brian Wolff
60aa905006 SECURITY: Fix revdel checks in LogPager
Follow-up to ce881e02e8 where the check for performer
restrictions and action restrictions was reversed.

Bug: T188145
Change-Id: I85a44f925212929ac87fb7a7e494023258f2d148
2018-03-05 22:48:43 +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
51fb1e29a0 Fix undefined $db
Bug: T181565
Change-Id: I286374d4ca0ab9435d7d54c4f8b9660a60e5f1e3
2017-11-29 00:21:59 +00:00
cenarium
ce881e02e8 logging: Abstract LogPager enforcing of action and performer restrictions
This avoids duplicating the code in the future, such as proposed for
I3ea2c050b6dd6c (T16711).

Change-Id: Ic53b074f542014f156b006864d91a138ba5fb22b
2017-11-27 19:01:46 -08:00
Brian Wolff
eb1caed560 No longer special case 'patrol' in $wgFilterLogTypes
Previously, if you did not have the right to patrol/view patrolmarks,
you were not allowed to filter Special:Log to remove autopatrol
entries.

Now if wikiadmins want to disable the filtering, they have to
directly change the config value.

This was stupid because:
* Users without patrol rights are just as likely to not care about
  autopatrol spam as users with the priv.
* Sometimes wikiadmins want to hide old patrol log entries even
  after they disabled the patrol feature.

It should be noted there have been two previously attempts at fixing
this issue that didn't go anywhere:
* I9de17fc197a06402a4999a9fb792b86657641f76
* I88448ca0f09069943fd514a5b8213dfdafa57299

Bug: T44246
Change-Id: I590db72c169f3a9ad96c710f088923419d40e48d
2017-10-28 13:08:43 +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
Aaron Schulz
82e2c924e4 Remove "@author Aaron Schulz" annotations
Bug: T139301
Change-Id: Ib5248e8e27d60611c7373bce4b29dd5e85aa3489
2017-06-27 15:24:14 -07:00
Roan Kattouw
a70ef33e00 Use IGNORE INDEX(ls_log_id) instead of FORCE INDEX(ls_field_val)
ls_field_val was renamed to PRIMARY, but this is only partially
complete in WMF production. There is only one other index on the
log_search table, so ignoring that one is equivalent to forcing
the other one.

Bug: T17441
Change-Id: I63182a9f94eabb4cc47414d86b02c82bde1e58b0
2017-05-03 08:00:08 -07:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +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
Glaisher
27d95e02fc LogPager: Use normalized value for log_user_text in query condition
Bug: T142755
Change-Id: Ia08be456cafa2133e5ea0e521161d6939e839fb2
2016-09-02 08:23:23 +00:00
rillke
208a99091e Do not validate relevant user name
- This makes Special:Log's behaviour consistent with other special
  pages, e.g. Special:Contributions.

Change-Id: Ic0a9322d920d7514bacac1f29a1da4fe57cae854
2016-04-09 23:51:32 +00:00
cenarium
807650f458 Move action filter logic to LogPager
This moves the action filtering logic from SpecialLog to LogPager,
in a limitAction function, as this seems to be how this is done
for other params (title, performer, etc).
This also uses $pager->getPerformer and getTagFilter() for resp.
performer and tag filter as the options to show, rather than the
raw request values (in a WYSIWYG logic).

Change-Id: I4918a8a2dca3fdbadd7d65c9c9972e6f67a1761b
2016-03-31 22:51:37 +02:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +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
Siebrand Mazeland
21b0801a2c Fix PHP CS warning in LogPager.php
Change-Id: I31f074ad77309bf02163810eb6689dc0bb56460e
2015-09-28 13:44:39 +02:00