Commit graph

100 commits

Author SHA1 Message Date
Matěj Suchánek d8168ca071 Do minor code cleanup
Change-Id: I0beba40920e5ddc0abbf49f9765a1ef9e3d3d1e5
2022-06-24 13:25:43 +02:00
Umherirrender 592e53a925 Call IDatabase::timestamp before inserting notification_read_timestamp
This is needed for proper cross-RDBMS support

This reapply a change from I46206e0b3a687dff3168a81cf0020e669133e876,
reverted with I1c8c409b7820512b3e31246a7f3d8c1cf4db209c.

Bug: T244898
Change-Id: I8b1387aff18d88088a993bc099165e9882658ac0
2022-03-23 22:09:19 +01:00
Hashar 9433b83f2d Revert "Call IDatabase::timestamp before inserting rows"
This reverts commit 4eb8fa23e4.

Reason for revert:

 Wikimedia\Timestamp\ConvertibleTimestamp::getTimestamp:
 The timestamp cannot be represented in the specified format

Bug: T304307
Change-Id: I1c8c409b7820512b3e31246a7f3d8c1cf4db209c
2022-03-21 13:28:37 +00:00
Umherirrender 4eb8fa23e4 Call IDatabase::timestamp before inserting rows
This is needed for proper cross-RDBMS support

Bug: T244898
Change-Id: I46206e0b3a687dff3168a81cf0020e669133e876
2022-02-11 23:22:17 +00:00
James D. Forrester a47a421696 Alter use of deprecated methods to ones called 'Primary'
This extension already depends on MW 1.37, so all these methods exist.

Bug: T254646
Depends-On: I9a90b4f74eb65cd9e20ae9faa6d1949be96543c0
Change-Id: Iebfdd33d3a967c87fbf87382a010a01da5cd4fc8
2021-09-03 17:46:20 -07:00
DannyS712 2e1757eaaf NotificationMapper: accept UserIdentity objects
No need for a full User, only the user's id is retrieved

Change-Id: Ibf4005c83d66d846b7e1ab711cd135c9ae08964a
2021-06-29 05:53:41 +00:00
Umherirrender 37c602c532 Replace uses of DB_MASTER with DB_PRIMARY
Change-Id: I20abc845a3c74173ec4a111874c20cdeb1abd1d9
2021-05-13 02:04:54 +02:00
James D. Forrester 4dd2a651e1 phpcs: Auto-fix MediaWiki.Usage.StaticClosure.StaticClosure
Change-Id: I6a02902ffaa8a9b497d60b573a0b8e3dbc207ee5
2021-05-04 09:06:42 -07:00
libraryupgrader b3f948c59c build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: I4b2fb7f46b6c0a5c33a6ad25f085de8ae13eb084
2021-05-04 09:05:15 -07:00
Tim Starling e1d2001040 EchoEventMapper: use DISTINCT instead of GROUP BY
I think the problem the GROUP BY was trying to solve was the potential
for there to be multiple rows with the same (etp_page,etp_event) pair.
There's no unique index to prevent that, and it would cause the event to
be duplicated in the result set. DISTINCT fixes that without generating
an error with sql_mode='ONLY_FULL_GROUP_BY'.

Per https://dev.mysql.com/doc/refman/8.0/en/distinct-optimization.html
DISTINCT is effectively shorthand for a GROUP BY with all the fields.

Bug: T281329
Change-Id: I6a0d578d729c33241a5c5fbd3f4e83f0e5fab83f
2021-04-30 09:40:25 +02:00
Umherirrender ddf5b4bd24 Remove wrong return null from function documentation
Change-Id: I1a702bbdd4378a35216641ec73fbe318f02bde69
2021-02-03 21:59:07 +01:00
Reedy 257de880c1 Make use of BatchRow(Iterator|Writer)::setCaller
Bug: T261014
Change-Id: I51df93a9ed998c25e632c35b0fcc531615ddfb80
2020-09-05 03:45:55 +00:00
DannyS712 9564e1ae50 Docs: Use replica instead of slave
Bug: T254646
Change-Id: I06387e33c5207ea59db34dba3b482893ff103288
2020-06-08 23:49:00 +00:00
Umherirrender 2fe223e45c Pass function name to database functions
Useful for logging

Change-Id: I95d466224ff984653051990b540f29e243915e3f
2020-06-07 03:35:53 +02:00
libraryupgrader ef3d2b886d build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Change-Id: I03333636654eff80d4fe7fa543ac9e6c321af891
2019-12-29 11:59:32 +00:00
Thiemo Kreuz 0efef4faf3 Add strict "array" type hints to code expecting arrays
I found candidates for this by looking for parameters names that end
with a plural "s".

Change-Id: I61c706eb4dfbdadceb0129afd724e6ce1eb4f4a8
2019-10-24 15:18:58 +00:00
Derick Alangi f402ecd31f Echo: Fix case mismatch for function/method calls
PHP doesn't care much about the name (in terms of case sensitivity)
but I think we should make sure the names of the method should be as
they're in their definition.

Change-Id: I6e38d8be64efaec4200471f2d3007275d7ddecec
2019-06-11 22:46:24 +01:00
Thiemo Kreuz be5919f623 Make use of the PHP 7 ?? operator where it makes sense
To my knowledge in all the places I'm touching in this patch the new
code is functionally identical to the old one.

Change-Id: I0ffa96d2f9cb9bf932f68b689244051c96c17ad9
2019-05-09 15:57:16 +00:00
Derick Alangi c4890ca86f Remove usage of deprecated database access code from Echo
Bug: T221164
Change-Id: Ib7cfe384f4104dbaeed5ba6659e81555eb810f97
2019-05-07 20:46:07 +00:00
Roan Kattouw 0e4f4ffad9 Proactively delete echo_event rows when they become orphaned
When deleting echo_notification or echo_email_batch rows, also delete
the corresponding echo_event rows if no other echo_notification rows
or echo_email_batch rows refer to them.

Bug: T221262
Change-Id: I416ff107bd000a0cfac102408c993f8bec2d0286
2019-05-01 11:23:27 -07:00
Stephane Bisson 61a839315a Use echo_event.event_page_id to find events to moderate
When pages are deleted or undeleted, their associated
Echo notifications also need to be marked as deleted
or undeleted. This is done by looking up the
echo_target_page table.

With this change, echo_event.event_page_id is also included
in the search. This way, all the events that don't use
target pages are also moderated when needed.

Bug: T217452
Change-Id: I277fca68ce088ab564e76ed9dfb2134ab3be4c4a
2019-04-11 10:48:49 -04:00
Daimona Eaytoy e21e3b4a8d Add phan
Change-Id: I65ae6adc10941c05a2646e551b1baa829e4e8654
2019-04-10 18:51:59 +02:00
Umherirrender c3d0760405 Use php null coalesce operator ??
Change-Id: Icb7d61b0b9040ee08caedef90b4dd2b65d403540
2019-03-12 21:04:00 +01:00
Roan Kattouw 91465ef753 Remove notification_bundle_display_hash
Also remove fetchNewestByUserBundleHash() because it's now unused,
and remove the echo_notification_user_hash_timestamp index which
existed specifically to support that function's DB query.

Bug: T143763
Change-Id: I74be8f156bc14d0e189d328953d17dc26cdb697b
2019-03-06 10:29:05 -08:00
Roan Kattouw ae75a8118a Remove notification_bundle_base
No longer used in the new bundling system.
Also removes indexes that contain bundle_base.

Bug: T143763
Bug: T131415
Change-Id: Ibf94cdc471a11cb14995fee6a55af0d227b50aa5
2019-03-04 13:22:17 -08:00
Umherirrender 1b5308ba81 Use explicit columns and avoid SELECT *
Change-Id: Ibde033784aee5adc13fae6f1d395d9464f54fefd
2019-03-02 22:39:53 +01:00
jenkins-bot 155d582026 Merge "Avoid use of IDatabase::delete() return values" 2018-10-28 21:42:10 +00:00
jenkins-bot 512a0904c5 Merge "Avoid use of IDatabase::insert() return value" 2018-10-28 21:42:07 +00:00
Aaron Schulz bbf0e1fade Avoid use of IDatabase::insert() return value
Change-Id: I36a18d9ff315928555bef7ab93283ec72aeef9f7
2018-10-26 15:44:57 -07:00
Aaron Schulz 9aa1344808 Avoid use of IDatabase::delete() return values
Change-Id: If5e28fc640199c22dfe8ae3ab3ffadf4859fa7a1
2018-10-26 15:25:15 -07:00
Aaron Schulz 9cca289625 Avoid use of IDatabase::update return value
Change-Id: I6780b4ca7051daee38d9155632a556455c434b67
2018-10-26 12:46:58 -07:00
Umherirrender 2cd8d9d0eb Split long lines over 140 chars
This makes the code easier to read even on big screens

Change-Id: I14bfb97b2986f389ad11a6ddc97ba61468774782
2018-08-25 12:51:14 +02:00
jenkins-bot d53af8b8d3 Merge "Use "false" as type hint in PHPDoc tags" 2018-08-16 01:00:05 +00:00
Thiemo Kreuz 8a7c3a78a9 Use "false" as type hint in PHPDoc tags
Most modern IDEs as well as documentation generators understand the
keywords "false" and "true", when a bool can only be one of the two.

Change-Id: I83dd1f0cc0802fa74ee35e7ca7425615230a767f
2018-08-13 15:31:13 +00:00
Thiemo Kreuz c1c3c7b672 Make "@… array" type hints more specific
There are about 200 of such generic "array" type hints in this code base,
the majority in @param tags. I started with what I found most relevant:
@var and @return tags. I might continue working on this later, but
wanted to stop for now to keep this patch moderately small.

Change-Id: Iff0d9590a794ae0f885466ef6bb336b0b42a6cd3
2018-08-13 09:27:37 +02:00
Roan Kattouw fe17b49fcd NotificationMapper: Use batching in deleteByUserEventOffset()
Also test it more meaningfully by setting up a mock database and
asserting that the right DELETE queries are issued.

Change-Id: Id39723b92118e98d9c9f0cd7381e9396dce67c17
2018-08-08 14:57:58 -07:00
Thiemo Kreuz 6aa6824f96 Update some PHPDoc tags for improved type safety
Change-Id: I7573ab01e88c86c25180bc56b3874505aa00a047
2018-06-17 19:04:54 +02:00
Umherirrender b166664efc Fix parameter docs
Change @param to @var
Add |null to nullable arguments
Removed comment out code

Change-Id: I535ad4d544284c1e0fb6f39c254761f0810b4cc7
2018-04-06 08:17:17 +00:00
Umherirrender 7e40fcc6ca Add missing use for namespace Wikimedia\Rdbms
Changed to interface, because the result of IDatabase::select is
directly returned and now the same type

Change-Id: Ib77e1f5c26ebf0b474dc944b15d6ef671a88e836
2018-04-06 07:56:13 +00:00
Umherirrender 08cb7a470a Change doc type from DatabaseBase to IDatabase
Change-Id: I853b7cef85fdd77c28a947a8f3601f84ba17359a
2017-12-22 23:20:13 +01:00
Umherirrender 546e3bdd55 Improve some parameter docs
Change DB_SLAVE in comments

Change-Id: Idd5787928b87f5af63864dc626cb603f281515d7
2017-10-18 18:44:52 +02:00
jenkins-bot 746b965fb2 Merge "Fix PHPDoc Documentation" 2017-10-02 22:53:47 +00:00
David Barratt d76ff6e32f Fix PHPDoc Documentation
Documentation is throwing linter errors and needs to be fixed.

Bug: T173475
Change-Id: Ic120b6a7a1f29ea90a939c4348202c09d47c38f5
2017-10-02 18:40:46 -04:00
libraryupgrader 7a23ddf4b0 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I7b19fab3b1100c4973600ec95ee24160e141c5ac
2017-09-24 09:49:43 +00:00
Brad Jorsch 1f9eedf40f Remove reference to deprecated IDatabase->nextSequenceValue()
The method was deprecated and made unnecessary in Ib308190c.

Change-Id: I47aca6a7c77821119f52e639d0e74a1e6302532a
2017-09-06 13:05:14 -04:00
Umherirrender 5b4730c9bc Improve some parameter docs
Change-Id: Ie71fb080926781f2905e6264be060203c56185ea
2017-08-09 17:21:10 +02:00
Umherirrender 79b6f470af build: Updating mediawiki/mediawiki-codesniffer to 0.10.1
Change-Id: I2326cf81e907f2a02615f96f922b66fd2806defd
2017-07-26 21:34:44 +02:00
Brad Jorsch d7a77b0aba Fix usage of $db->nextSequenceValue()
The return value from the method is only suitable for passing to
$db->insert(). To get the inserted ID, you need to call $db->insertId()
even if $db->nextSequenceValue() returned non-null.

Bug: T164900
Change-Id: I466fd372804927b3ad72125c7a69d253bd7a24f8
2017-05-10 17:46:07 -04:00
Roan Kattouw 2e4e14498a EventMapper: Don't retry failed lookup queries on the master on GET
Only retry lookups if there are multiple DB servers and
changes were made in this request. This same logic is used
in a couple of places in MW core, like WikiPage::loadPageData()
and Revision::newFromConds().

Bug: T164505
Change-Id: If1af363f9687019864b5eaef72ffe0bc824a2223
2017-05-04 17:49:33 -07:00
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00