Commit graph

63 commits

Author SHA1 Message Date
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
Derick Alangi 3971e32f1b Code improvements for includes/ **only** directory
This code improvements seeks to improve on code readability, consistency,
maintainability and efficiency.

Change-Id: I4f07886044e9a75824f9e7ddad039f3112b1c4a1
2019-03-05 18:58:52 +01:00
Umherirrender 1b5308ba81 Use explicit columns and avoid SELECT *
Change-Id: Ibde033784aee5adc13fae6f1d395d9464f54fefd
2019-03-02 22:39:53 +01:00
Umherirrender 8da7e5b04a Pass string as field to IDatabase::selectField and ::selectRowCount
It is documented as string, because it can only select one field,
not a list of fields

Change-Id: Iad8ff691e642220359f45f97359aa624261af673
2019-03-02 17:29:29 +00:00
James D. Forrester 918a19efac Drop $wgNotificationReplyName, instead let just show the e-mail
This is what MediaWiki itself does. It's not great, and isn't any more
translatable than a config setting, but consistency isn't valueless. In
future, with T202326 we may wish to vary this, but for now this is
simpler.

Change-Id: I76fca8ee255c65ab9b7e988d44de0d0fbd3c84b7
2018-08-29 01:03:54 +00:00
James D. Forrester 92b2df6f3e Use $wgNoReplyAddress rather than $wgPasswordSender for generic Reply-To
Change-Id: I4712d4fe02caf019a3b45f6efe82453eec59a50f
2018-08-28 21:54:47 +00:00
James D. Forrester d2ab6527e9 Drop $wgNotificationSenderName
Instead just use the system message `emailsender` like we do for all other
e-mails, which is thus translatable.

Change-Id: I7e58a3a4e224d551c6fae4a76fcba19fe838d3e9
2018-08-28 18:06:59 +00:00
James D. Forrester eefeb6d031 Drop $wgNotificationSender, written to but never configurable
Instead just use $wgPasswordSender explicitly. This also allows us to drop the
extension registration callback function, which is a performance improvement.

Bug: T200390
Change-Id: I08d2f040c5ad8feb395a2e8e176f91636efe1d3d
2018-08-20 13:41:05 -07: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
Fomafix 99173922c1 Directly use Language::factory instead of wfGetLangObj
Other places like Message::inLanguage also use
Language::factory( $user->getOption( 'language' ) ).

Change-Id: I911dc2319e1922276daa3eb3614a350c80b8b57f
2018-06-05 11:00:14 +02: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 52e91a605a Fix return type of EmailBatch::newFromUserId
Use | as separator for multiple classes

Change-Id: I246443b058436bec6b17675d4be46e130a4c075b
2018-04-04 12:35:54 +00: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
Kunal Mehta aaf061c725 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.ExtraParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I8401abf121a7413fa191d7bc535e0ddd6cf8c3f7
2017-06-22 14:13:28 +00: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
jenkins-bot 731cde01b8 Merge "Dynamic bundles" 2016-06-28 19:34:42 +00:00
Stephane Bisson cf7bee76ee Don't send empty emails
If no notification can be rendered,
don't send an email at all.

Bug: T137012
Change-Id: I57944e7af275ddecdffc82de8c050d8baa357660
2016-06-28 09:19:01 -04:00
Stephane Bisson 24caf50ff6 Dynamic bundles
To allow individual notifications to be
marked as read/unread or moderated,
bundles are created by grouping associated
notifications when they are fetched for display
instead of when they are created.

From a product perspective, this change doesn't
introduce moderation or expandable bundles but
it counts each individual notifications.
For instance, the bundled notification
"3 new topics on PageA" now counts as 3
notifications.

Bug: T93673
Bug: T120153
Change-Id: Iacd098573efd92bb1e3fcd7da4cd40cea9522f15
2016-06-27 09:49:13 -04:00
jenkins-bot 397d402a5b Merge "Avoid exceptions when event_extra can't be unserialized" 2016-05-14 00:45:56 +00:00
Kunal Mehta 64127cd815 Avoid exceptions when event_extra can't be unserialized
Check for proper unserialization in EchoEvent::loadFromRow(), and return
false if not possible. Callers were updated to check for a false return.

Bug: T73489
Change-Id: I33867aa9bbbc5f0ecfe0d2a9e1b03eb1a937ae83
2016-05-13 16:39:17 -07:00
Stephane Bisson 6f6e10084c HTML email formatter using presentation model
Bug: T121067
Change-Id: I77f466f0b507ffa49a9714ddba95bea8db1d8438
2016-05-12 09:29:24 -04:00
Kunal Mehta b6f742bc46 Add plain text email formatter
Formatters based on presentation models for
individual event emails and digest (daily, weekly)
plain text emails.

Bug: T121067
Change-Id: I4eceaf521315adab7429a8a73ffca70ebcddab86
2016-05-04 13:35:37 -04:00
Matthew Flaschen cac85b635f Make plural support for large values (100 or more) explicit in l10n
This involves:

* Making this value no longer admin-configurable.
* Changing getNotificationCountForOutput to return only a single value
  Since there is no + in the formatted value anymore, we can actually
  use the same value for both.

  This is a B/C break, but hopefully worth it to simplify the method
  call.

  For now, the excess parameter is just marked unused.  It could be
  removed at some point if the translations are updated.

This must be merged at the same time as:
* Flow - Ibfa56b1af9e8c56b4c5f900e0d487bc09688b2a2
* MobileFrontend - Ibf784b279d56773a227ff261b75f2b26125bbb63 (well, MF
  can be merged first)
* translatewiki - I2a4b6938aed49e4101deb6b9351c43656a863490

Also, change 1 to One/one, per Siebrand on the task.  This can easily
be dropped/undone if we don't want it.

Also, remove reference to no-longer-existent notification-page-linked-bundle

Bug: T127288
Change-Id: Iabeaae747f99980c0610d552f6b38f89d940b890
2016-03-16 18:43:16 -04:00
Kunal Mehta 210f3a1d4a Clean up some code in EchoEmailBatch
* Address TODO to use a constant instead of hardcoding
* Only call User::getOption() once

Change-Id: I52d8c3698f8d915ec9d96de0976d242009b3df39
2016-03-08 15:37:34 -08:00
Justin Du 67d8394cd0 Deprecated use of 5th parameter in UserMailer::send
*In EmailBatch.php line 287

Bug: T123641
Change-Id: I7f75448b0f6839c6d104eedca0f0c2f7d0780337
2016-01-18 21:19:42 +00:00
Kunal Mehta 558cc64bc2 IDatabase::delete() does not take a fourth parameter
And don't use the deprecated getDB() function.

Change-Id: I824fb1e69262298d6b76fb22b499d961c1189f98
2015-10-30 10:49:59 -07:00
Siebrand Mazeland 33126b69aa Update formatting
In preparation of Code Sniffer based updates.

Change-Id: Id5d43332b44a37665d57dc24ef8c432bc65b2f6a
2015-10-03 23:28:54 -04:00
Kunal Mehta d072a9a47b Add some type-hinting and doc fixes
And remove some useless code as well.

Change-Id: I97a2ca08a1d4ef0b59535c1c002840f108defe4a
2015-08-06 15:36:05 -07:00
Kunal Mehta 58b7cc7cfd Use intval() to make string concatenation in DB query less scary
Change-Id: I51d7744b8c7f967e47777b5f3a6e491f4e65f5c8
2015-06-08 14:36:08 -07:00
Kunal Mehta 24cd62e322 Merge MWDbEchoEmailBatch into MWEchoEmailBatch, remove abstraction layer
Change-Id: Ib1ae17326443d2143346bcd2e4204defa2dab4c3
2015-06-08 11:54:25 -07:00
jenkins-bot 956a3c608a Merge "Standardize doc spacing" 2015-06-01 19:26:23 +00:00
Matthew Flaschen 96c0bed332 Standardize doc spacing
Change-Id: I478da2a0ca37e42ad6a7af77082fa6f1ef61bade
2015-06-01 15:22:59 -04:00
Kunal Mehta e11fa6e094 Kill $wgEchoBackendName
All uses of $wgEchoBackendName were hardcoded to 'Db' and removed.

This exposed a interesting bug in MWEchoEmailBundler which was
instantiating a subclass using the parent class's private constructor, a
"feature" of PHP which is supported in 5.2.6+ (http://3v4l.org/h4Mq3).
While it worked, PHPStorm complained about it so I made the constructor
protected, which makes more sense anyways.

Both EmailBatch and EmailBundler need further refactoring, but that will
be done in follow up patches.

Change-Id: I2032f5b2f4f3a62f830cc5344b25a92074bd0c61
2015-06-01 12:13:11 -07:00
Stephane Bisson 3bfa823922 Maintenance script sends notifications immediately
Update the "processEchoEmailBatch" to allow sending all
notifications immediately even if configured to be
daily or weekly.

Change-Id: I6ebeea86708247700d1950e0f6471c7b3d1fecd2
2015-05-27 14:02:51 +02:00
Chad Horohoe 4a09f730e3 Remove obvious function-level profiling
Change-Id: I498d79d99ab6016cadf502f4c606a7a911470250
2015-02-10 14:32:58 -08:00
Kunal Mehta d196cbf94e Use MailAddress::newFromUser()
Change-Id: I7c6ce9aade27dae66732274979d8baa9eeb0b17c
2014-09-21 18:25:14 -07:00
Nemo bis 940ea72ab5 Remove trailing whitespace, followup 0b1275b9e3
Change-Id: I1d48f9c3c0af68496bf0672c76202bf00063cb34
2014-08-28 12:06:06 +03:00
Kunal Mehta 631d0252f7 Fix Echo breaking
Bug: 66992
Change-Id: I7add48c55e04ef4ea5d0f537c6a1a1ba959f628e
2014-08-08 21:35:58 +01:00
Thiemo Mättig e205992d0b Remove unused code and fix missing/broken documentation
General code cleanup as reported by the PHPStorm static code
analysis. I hope it's not a problem that I made a lot of very
different (but all very tiny) changes in a single patch. If you
want to merge this but you think it's better to split it into
several patches first, please tell me.

Change-Id: I2e2c4bb47f8d20e038d28e236e2ff813b30504af
2014-06-04 04:54:00 +00:00
Yuki Shira 32087f7605 Add full-stops & fix quotation marks
Spotted by Siebrand
http://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Echo-email-footer-default-html/en
http://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Echo-email-batch-body-intro-daily/en
http://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Echo-email-batch-body-intro-weekly/en
http://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Notification-mention/en

Change-Id: Ia1c61c4f78f7b93343ba1174b7446829c216cbfa
2013-08-02 08:05:59 +09:00
bsitu 2c7ec70dc6 The email should be sent in the recipient's language
At the moment it is sent in the sender's language.

Bug: 52298
Change-Id: I7f689963105585cf74a902cf975fffb592135ed4
2013-07-31 02:47:15 +00:00
bsitu 7f33cc98fa (bug 46665) Add HTML email support to email digest
Change-Id: I3b881acbcf4b18fc0401364ea0a6bc993d2c2246
2013-07-23 13:20:33 +02:00
jenkins-bot 108d525159 Merge "Copy tweaks to Echo Notification Emails" 2013-05-22 19:53:46 +00:00
lwelling fa84e0edb7 Copy tweaks to Echo Notification Emails
Bug: 47846
Change-Id: Ia054daa8053032e5b71a7724c22897655a7fc326
2013-05-20 12:07:15 -07:00
bsitu ce78c973f3 Add new EventLogging schema: EchoMail along with code refactor
Change-Id: I7f9ec99d27b69abb14aa89540e424f1e0bcd8160
2013-05-07 16:59:24 -07:00
jenkins-bot 5f21312587 Merge "Email digest header tweaks" 2013-04-18 18:20:57 +00:00
lwelling e1f03a8c0e Split out notification emails to a separate from address so they can
be configured as specified for launch.

Part of https://bugzilla.wikimedia.org/show_bug.cgi?id=46670

Change-Id: I06a73aae95bc4b6776a0554b624eccfc4602bc65
2013-04-18 13:55:13 -04:00