Commit graph

84 commits

Author SHA1 Message Date
Chlod Alejandro 41d31c3076
Use revision table instead of recentchanges
This switches Nuke over to using the `revision` table instead
of `recentchanges`, allowing a wider timespan of pages to be
deleted. As a DoS prevention measure, this adds the
`$wgNukeMaxAge` config option (defaulted to the value of
`$wgRCMaxAge`) and a max execution time for the SELECT
(set to `$wgMaxExecutionTimeForExpensiveQueries`).

This also adds a relevant test.

Partially based off of I6c2b7e6b695d58a7dcba93ccaeba9ed35d81cf80.

Bug: T379147
Co-Authored-by: Kgraessle <kgraessle@wikimedia.org>
Change-Id: I5d68d2663751783bcc773799e951f74866ceb722
2024-11-13 02:14:03 +08:00
Kosta Harlan f1d53c8244
SpecialNuke: Display username next to pages for temp accounts
Why:

- When deleting pages created by temporary accounts via inputting an IP
  address, it's useful to see which temporary accounts were involved in
  creating the pages. This is currently not displayed because
  $row->rc_user_text is not set

What:

- Fetch the actor_name field unconditionally
- Display the page using the actor_name field
- Update tests for the change

Bug: T342785
Change-Id: Ic4112985874343ede78c4571bdfccc58977c5345
2024-10-28 21:06:57 +01:00
jenkins-bot dd5715525e Merge "Tag deletion logs performed with Nuke" 2024-10-22 03:38:45 +00:00
Kosta Harlan 0923015f4a SpecialNuke: Don't add actor names WHERE if no names supplied
Why:

- If submitting the form with no conditions, the `$actornames` variable
  will be an array with a single empty string, which means the WHERE
  clause won't find any matches

What:

- Only add actor names to the WHERE clause if the array contains names
  to check

Bug: T342785
Change-Id: I7f407695583c1d7ebaf81d116578bd336adc5c7f
2024-10-21 14:55:54 +00:00
jsn 98aa8d9942
Enable temp account lookup by IP address
- Adds a soft dependency on CheckUser
- Lists pages created by IP user or temp acccounts associated with IP
  address when the lookup is available

Bug: T342785
Depends-On: I45a18f1fcf1a17bdaeefabebcd2f67a946a2cc2e
Change-Id: Idcdd7d787180e8e99fdcbe856e4fc237d9721824
2024-10-21 10:18:32 +02:00
Umherirrender a31ea99a89 Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: I8d0663b6d5c79c2177f8c6bee4fa97efe4f958de
2024-10-20 09:31:41 +02:00
Kgraessle e42a881976 Tag deletion logs performed with Nuke
Bug: T366068
Change-Id: I3455fab45698884d0b32f0065aaaf9fe7c0c6916
2024-10-17 08:53:59 -05:00
Bartosz Dziewoński 44005c405e Use stable andExpr() / orExpr() methods
Change-Id: Iacabf4a896d2c8460d84fa3d0a57aa640794e5c7
2024-07-11 16:38:34 +00:00
Umherirrender faea05e4d1 Use namespaced HTMLForm class
Change-Id: Ifeac10c6d07d492e42a5a20fbc3b93a396329650
2024-06-09 18:58:16 +02:00
jenkins-bot 2794f04b35 Merge "Add more tests" 2024-05-20 20:18:10 +00:00
Chlod Alejandro 19c6fb0125
Add more tests
- Add tests to reach 100% coverage
- Ignore some methods which are simple enough
- Change some tests to fit with the new ones

Change-Id: Ic15d4431dc8509ac2732ebce7517522e27d8f5a3
2024-05-13 15:30:08 +08:00
Chlod Alejandro b7a0be19c5
Explain capitalization process
Add comments into the code for converting page cases
from lowercase (first letter) to uppercase.

Change-Id: I3ae3602d826e232adc1ce6063ac6b50eac01d5bc
2024-05-12 17:50:12 +08:00
jenkins-bot 77f19d09dd Merge "Cleanup code comment on Special:Nuke" 2024-05-05 12:23:00 +00:00
jenkins-bot 9663707fba Merge "Replace rc_new for rc_source in DB query" 2024-05-05 11:43:53 +00:00
Samwalton9 8385ddbb74 Add talk page link to Nuke confirmation form
Added talk page links to aid in uncovering which talk pages may require further inspection. Also reorganised the information a little, made some terminology consistent, and added a .less file to store Nuke styles.

Bug: T364143
Change-Id: I76b9bbb939afde1d7d951925818fd15f40022ead
2024-05-05 10:55:52 +03:00
suecarmol 4873bf7040 Cleanup code comment on Special:Nuke
Removed a comment that no longer applied to Nuke

Bug: T234726
Change-Id: I560666e0ec47fb48acc51baaa46ebd4767e84fad
2024-05-04 20:07:53 +03:00
Samwalton9 e506e68969 Italicize redirects in Nuke page list
When pages are redirects, admins may not want to delete them, as they are less likely to contain bad content. This patch highlights them by using the allpagesredirect styling which provides the same italicizing behaviour for Special:AllPages.

Bug: T278625
Change-Id: I027cad868ed13190424612d1f9c2bdaf6456f49e
2024-05-04 18:21:26 +03:00
suecarmol 00894a4484 Replace rc_new for rc_source in DB query
Replaces the rc_new field for rc_source because rc_new has become obsolete.

Bug: T36320
Change-Id: I821332c2484850dd3ad293703faafbd29379a83e
2024-05-04 16:15:28 +03:00
Seb35 fb60b51cd8
Permit spaces in the SQL LIKE pattern
The search is against the MediaWiki-DB-encoded title (with '_' for space
and initial uppercase letter): these constraints are converted in this
patch to let the user use MediaWiki-displayed titles if they want.

It was taken care about of the configuration-specific case where some
namespaces are first-case-insensitive but other namespaces are first-case-
sensitive, by partitioning the namespace space into to distinct spaces.

Bug: T234726
Co-authored-by: Chlod Alejandro <chlod@chlod.net>
Change-Id: Id83832c256660b691a896113c98641700ed02707
2024-05-04 16:15:24 +03:00
xiplus 52352320c2
Query current page name for moved pages
Join "page" table to query current page name for moved pages.

Bug: T43351
Co-authored-by: Chlod Alejandro <chlod@chlod.net>
Change-Id: I127bc413c8ef25bbc24cb27b2cdc6d1ec08142ab
2024-05-03 13:39:07 +03:00
jenkins-bot 2982814a9b Merge "Modernize the code a little bit" 2024-04-21 10:32:58 +00:00
thiemowmde 9fb95da819 Modernize the code a little bit
For example:
* Remove redundant PHPDoc blocks that just duplicate existing
  information and aren't needed any more with our current PHPCS
  rule set.
* Add some very obvious type declarations.
* Use ??= where it makes sense.

Change-Id: I5c182cc961c6eeccead79ff49b0376eee2418acf
2024-04-19 15:10:15 +02:00
thiemowmde ea573ea99e Replace trivial Xml::… methods with Html::…
This code isn't even generating XML. I'm intentionally leaving a few
Xml::… usages behind that are more complicated. This is for later
patches.

Bug: T341775
Change-Id: Icc693968f0cf726b8ed616c38b7cfd422f481da5
2024-04-19 14:54:09 +02:00
Umherirrender 373042d9d0 Fix casing of dropdown-related methods
Methods gets renamed to lowercase variant in core (f1d7e68c)

Follow-Up: Ifda13ba9dee316709c424636ec3b285de8d0e9b1
Change-Id: I9a1e6d191bc5217e555d23746793ddee472faf47
2024-03-09 15:45:40 +01:00
Bartosz Dziewoński 80bdcd3004 Restore support for matching 'LIKE' patterns/wildcards
Follow-up to 910ce4c870.

Add a test so that we don't break this again.

Bug: T355478
Change-Id: I98620dd66a3c3a6913f999d6f96eef0ef69271d1
2024-01-22 11:30:50 +00:00
Novem Linguae 2f16b24b08 Links to redirects should have ?redirect=no
Bug: T351575
Change-Id: I8bced40d8f86010ec74ebc5ea81211bd7aaf3803
2023-12-22 02:15:33 -08:00
Amir Sarabadani 910ce4c870 Migrate to query builder and expression builders
As an Iranian, I'm a big fan of this extension so I decided to update
some parts of it to use new rdbms APIs.

Bug: T350984
Bug: T312361
Change-Id: Id374fc9143d40ac0c65ae99ffab945cde51f77d5
2023-12-19 17:03:57 +01:00
Func b5b1b11608 SpecialNuke: Escape the page title for messages
The page title should be substituted into the link syntax before the
wikitext is parsed, so we should use wfEscapeWikiText() instead of
plaintextParams.

Bug: T310015
Change-Id: Iad216ded7e25c7f84b6b9ae619ddd51b9140bd24
2023-12-06 03:31:20 +00:00
Fomafix 4ce660a73c Use namespaced classes
Change-Id: I7ed3d04a7c4922d6ccfd21dc275751155da9e643
2023-10-02 21:09:38 +00:00
gerritbot 376dd4b74b Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: Ib8ea0118fa7946d8070b8894fa9d67a29191945a
2023-08-19 04:17:58 +00:00
gerritbot 2418468b84 Migrate ILB::getConnectionRef() calls to ILB::getConnection()
Deprecated since 1.39 (I6e7544763bd)

Bug: T343277
Change-Id: I575b724b8d098165abbf6043aa5e531e0f1d6f73
2023-08-01 20:59:12 +00:00
Alexander Vorwerk 0b5bb5ccd7 Fix case in use statement
Bug: T336083
Change-Id: Icda9d979d9fb97cbd832d53fa8c5bb6847aaa63b
2023-05-05 22:23:03 +02:00
jenkins-bot 139c485cea Merge "SpecialNuke: inject services" 2023-04-28 17:46:31 +00:00
Alexander Vorwerk b88f9e2279 SpecialNuke: inject services
Change-Id: Ib57944f0fb7e512456318519acf27c5874160b1b
2023-04-28 17:24:41 +00:00
gerritbot f191f1bd34 Update moved class FileDeleteForm
See T321882. Moved in Ibeb488ba322c6

Bug: T321681
Change-Id: Ifcc26c56fd5d9d1708ea219dd25a90a6048aaf6c
2023-04-25 09:48:10 +00:00
jenkins-bot 87d106f51d Merge "Inject services" 2022-11-05 12:47:53 +00:00
jenkins-bot 160e3d8e48 Merge "Remove phpcs exclude rules and update PHP code" 2022-11-05 12:44:15 +00:00
jenkins-bot ef0a197e58 Merge "Use WebRequest::getIntOrNull and avoid ctype_digit" 2022-11-04 18:08:44 +00:00
Fomafix 698188afd4 Use WebRequest::getIntOrNull and avoid ctype_digit
This avoids the deprecation warning:
ctype_digit(): Argument of type null will be interpreted as string in the future

Bug: T322079
Change-Id: Id1e7ec7d73028339b53047ebfd6a975d23c3d180
2022-11-04 13:17:05 +00:00
Fomafix 42ef4ee402 Remove phpcs exclude rules and update PHP code
Change-Id: Ifecf2f8a053b9304a8e9e6558cd7c1f570f15084
2022-11-04 13:09:25 +00:00
Fomafix 49df51e106 Inject services
Change-Id: I7f11825af2bb96ad61aa2cefcc47fcad706388af
2022-11-04 11:21:00 +00:00
Fomafix 35abb011cf Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

Change-Id: Ia857f37abdb17fe88e91ae17a5610c027c97376e
2022-11-04 10:47:02 +00:00
jenkins-bot d7f428d5e1 Merge "Use WebRequest::getRawVal instead of WebRequest::getText" 2022-09-01 21:58:53 +00:00
Fomafix 7cd544c4ca Use \u{00A0} instead of &#160;
Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0)
instead of the HTML entity &#160;.

Bug: T154300
Change-Id: I2f50fd24772eacd0bddf90c982fd7112196e6ad2
2022-08-30 13:24:53 +00:00
Fomafix cfc33f1a2a Use WebRequest::getRawVal instead of WebRequest::getText
The UTF-8 normalization for the URL attributes `action` and `namespace`
are not needed.

Also use === instead of ==.

Change-Id: I03a844d58b11f45dc67f3dfb861d8f6e9ffcc18d
2022-08-30 08:47:34 +00:00
Reedy cbbf2cc376 SpecialNuke: Null coalescence in execute()
Bug: T313146
Change-Id: I40850e2f126728ab09ab89fc666241a7f041c7ee
2022-07-17 20:43:16 +01:00
TerraCodes 029111351c Add class to nuke contribs link
Continuation of MW core patch 603941

Change-Id: I3ae1aeddbd0c00ffecf7b8b8115cf161b0e15202
2022-06-17 18:53:57 +00:00
DannyS712 6620e7e686 SpecialNuke: use Message::plaintextParams() for page titles
So that their contents do not get parsed

Bug: T304777
Change-Id: I6f031d1b857ee0955b8966f5f63c63e269306568
2022-03-27 00:34:46 +00:00
Func bfe4c13c0b SpecialNuke: Don't set edit token in HTMLForm twice
HTMLForm would set it for post form, use setTokenSalt() to amend.

Change-Id: Ia79dbd261e9f0a34bf9f10660a1043355ab72ede
2022-03-18 12:03:12 +00:00
DannyS712 022da28e19 Unsuppress MissingDocumentationProtected and add docs
Change-Id: I169df0d822232c74ad5069141e032dbb10af6ac1
2022-03-12 01:45:39 +00:00