Commit graph

960 commits

Author SHA1 Message Date
jenkins-bot 4c2e69fadb Merge "Add cross-wiki proxying to the action=markasread API" 2018-09-05 12:40:30 +00:00
jenkins-bot 9cc47ceac8 Merge "Rename ApiCrossWikiBase -> ApiCrossWiki and make it a trait" 2018-09-05 12:35:29 +00:00
Roan Kattouw 55a5823d45 Add cross-wiki proxying to the action=markasread API
Add support for POST requests and tokens to EchoForeignRequest
and ApiCrossWiki, and add the ApiCrossWiki trait to ApiEchoMarkRead.

Change-Id: Idadaacd0d0c4a957bf2499049fc105a60c73bc52
2018-09-03 08:07:39 -07:00
libraryupgrader 4728b3332c build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
And updating CoC link to use Special:MyLanguage (T202047).

Change-Id: Ic18c7ae9b70c18ffb321967aae7e9a684acfc625
2018-09-03 01:46:10 +00:00
jenkins-bot c9afa64579 Merge "Always place items outside menu if there's less than two of them" 2018-08-30 21:10:31 +00:00
Roan Kattouw a90890582a Rename ApiCrossWikiBase -> ApiCrossWiki and make it a trait
That way we'll be able to mix it into non-query modules as well.

Unfortunately, PHP traits don't let overridden methods call their
original versions, which had to be worked around in a few places:
- $this->foreignNotifications can't be initialized in the constructor
  any more, so it's now lazy-created through $this->getForeignNotifications()
- Adding the 'wikis' parameter to getAllowedParams() now happens by
  calling getCrossWikiParams() rather than calling the parent
- Overriding getForeignQueryParams() can't call the parent anymore, so
  instead we just inline it

Change-Id: I415e6d921819fc1f7869c7d2f8bb62830a84c2a1
2018-08-29 18:03:16 -07:00
jenkins-bot a5d17463d4 Merge "Escape messages used in HTMLSelectField 'options'" 2018-08-29 10:52:44 +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
jenkins-bot 229471d1b0 Merge "Fix page-linked notifications" 2018-08-28 00:14:22 +00:00
Roan Kattouw a01ebbc045 Fix page-linked notifications
These were broken because e8632ab0f6 in MW core stopped passing a
triggering user to LinksUpdate.

This commit takes the user from the Revision object instead. In weird
cases that might be different from what LinksUpdate says, but
page-linked notifications don't use the agent in their rendering anyway.

Also remove the code that refused to route events to a page creator if
they didn't have an agent. It's perfectly legitimate for events not to
have an agent, that shouldn't preclude them from using non-agent-related
locators.

Bug: T200119
Change-Id: Ia31131b1d1b2640d962ab7f3e573599c43ae50d4
2018-08-27 10:46:39 -07:00
jenkins-bot 6072511b47 Merge "Fix common typos in code" 2018-08-27 11:33:30 +00:00
jenkins-bot 8a759ce1b7 Merge "Split long lines over 140 chars" 2018-08-26 18:35:58 +00:00
jenkins-bot b7815f435b Merge "Remove count() of null value" 2018-08-26 07:42:35 +00:00
Zoranzoki21 00dfbd1af7 Fix common typos in code
Bug: T201491
Change-Id: Ibd287f220720c33b82847475fbe88b586557de69
2018-08-25 17:35:13 +00:00
Umherirrender 5daca5ee1a Escape messages used in HTMLSelectField 'options'
Change-Id: I10aaa57d376f611997f47fa1fe3bff859370820b
2018-08-25 13:20:01 +02: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 b6bfaa2e2c Merge "Explicit convert Message objects when used as string" 2018-08-25 06:17:21 +00:00
Stephane Bisson a5ececbb7e Initialize $success
Followup I85452d0f0afe974d26a575e000f6ae2ceeddf06c

* initialize "$success = true" before using it in
  a loop to keep track of the overall success of
  all batches.

* Add check for readOnly db in markUnRead() and
  markAllRead(), like it was done in markRead()

Bug: T202672
Change-Id: Ifdfa93059268d5b02ba3e0e885661ce593845791
2018-08-24 06:15:12 -04:00
jenkins-bot c419bcf45e Merge "Drop $wgNotificationSender, written to but never configurable" 2018-08-23 20:58:49 +00:00
jenkins-bot b0d83815b9 Merge "Don't send email notifs to blocked users if $wgBlockDisablesLogin is true" 2018-08-23 19:02:48 +00:00
Roan Kattouw 2b0929a4b1 Don't send email notifs to blocked users if $wgBlockDisablesLogin is true
Bug: T199993
Change-Id: I47ed3599d61ca8177cdd0820dea4089fdb087d82
2018-08-23 11:39:25 -07:00
Umherirrender 516eeda19e Remove count() of null value
php7 gives:
count(): Parameter must be an array or an object that implements
Countable
null or [] are both evaluate to false, so just remove the count

Change-Id: Id92dbd48f308d1e9dffa086699e0e944744aeeaa
2018-08-23 18:07:22 +02:00
Umherirrender a0ad95b63f Split long lines over 200 chars
This makes the code easier to read even on big screens

Change-Id: Iebc2ca785690abc6e7998c6f6078daf0bd01ccf8
2018-08-23 10:33:25 +02:00
Umherirrender e89206ce4a Explicit convert Message objects when used as string
This makes clear which escaping should be used.
In all cases it needs Message::text, because there are used inside
Html::element. There is no visual different.

Change-Id: I17474a7d5f057321e8c759d4bf94c8234c7a89c7
2018-08-21 14:16:22 +02: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
Timo Tijhof 2142be10b0 cache: Reduce responsibility of subclass and remove unused parts
* Reduce responsibility of resolve() methods to only supplying
  the resolves values.
  Moved logic for populating the cache and clearing the queue
  to the base class, and made 'lookups' private.

* The second parameter to LocalCache::add() is unused, and never passed.
  Removed to avoid confusion.

* The getTargets() method is unused. Removed.

* The getLookups() method is unused. Removed.

* The internal 'lookups' member was being used both for its keys and its
  values, but never at the same time. This seemed risky, especially in
  EchoRevisionLocalCache::resolve() where the associative array was passed
  directly to the 'where' clause of IDatabase::select(), which shouldn't
  espect keys when creating the 'IN' clause.

  Using only values would keep value types flexible, but would require
  use of the less efficient in_array().
  Keeping both keys and values and calling array_values() would work.
  Using only keys also works and is simpler, so long only ints are used.

* The tests were swapping 'targets' MapCacheLRU with a HashBagOStuff.
  Following-up 4939bff7, this was forgotten, but works because the two
  called methods (get and set) exist in both, but still seems odd.

  Fixed by using TestingAccessWrapper to act on the existing object
  instead of swapping it out.

* Improved tests by asserting more of the observed behaviour and impact.

Change-Id: I530eeac8bf3b407b8c633e0e20c7d35cc49f7a9f
2018-08-17 03:28:02 +00:00
jenkins-bot af2b92856f Merge "Fix missing/mismatching type hints PHPDoc tags" 2018-08-16 08:39:29 +00:00
Thiemo Kreuz 2d7096bcff Fix missing/mismatching type hints PHPDoc tags
This fixes some issues I found while updating this code base, e.g.
this removes types a method really does not return.

Change-Id: I19457e7bf88945eec958bf53e0b76a7585715a45
2018-08-16 07:07:20 +00:00
jenkins-bot d53af8b8d3 Merge "Use "false" as type hint in PHPDoc tags" 2018-08-16 01:00:05 +00:00
jenkins-bot ef233becf5 Merge "Make "@… array" type hints more specific" 2018-08-16 00:57:12 +00:00
jenkins-bot cc1a3aaa6b Merge "Escape message used in html" 2018-08-16 00:16:09 +00:00
jenkins-bot b0e11b45f0 Merge "Make use of inline {@see …} tags" 2018-08-15 22:18:56 +00:00
jenkins-bot e23cf162fe Merge "Migrate EchoLocalCache to MapCacheLRU" 2018-08-15 21:45:02 +00:00
Umherirrender e499631a37 Escape message used in html
Change-Id: Iee1c2bebec8756c5672e36c837fe9c2065479673
2018-08-15 20:19:51 +00:00
Aaron Schulz 4939bff723 Migrate EchoLocalCache to MapCacheLRU
Change-Id: Ie007bc5ec1db4d9686ced724b87f9cbc328aa339
2018-08-15 12:30:51 -07:00
Thiemo Kreuz 63eee2b9a1 Remove two unused properties from AttributeManager
These two properties are protected. I used
https://codesearch.wmflabs.org/search/?q=EchoAttributeManager%5B%5ET%3A%5D
to make sure no subclass exists that might use them.

Change-Id: I37c71db55bc4832968a1812142588dddaa81724a
2018-08-15 09:29:54 +00:00
Thiemo Kreuz e5546e50b6 Add missing strict "array" type hints to DiscussionParser
This patch adds a few strict type hints on the language level, not
only on the PHPDoc level as my other patches do.

Change-Id: Ie66f9ebf80317dcaf13e2e96a93332a1a93cebbe
2018-08-15 09:03:33 +00:00
jenkins-bot 15b15adcb3 Merge "Remove $wgEchoNewMsgAlert and 'echo-show-alert' preference" 2018-08-15 01:19:38 +00:00
jenkins-bot 7d305a77d0 Merge "Use ContentLanguage service instead of global $wgContLang" 2018-08-13 23:39:27 +00:00
Fomafix f8341386a0 Replace deprecated Linker::link() with LinkRenderer
Bug: T149346
Change-Id: Icfb0a96735f8f69d73c8d597e6c7b033ca3bcf1f
2018-08-13 23:36:47 +02:00
Fomafix a1f72bbfa0 Use ContentLanguage service instead of global $wgContLang
This change requires MediaWiki 1.32 which is already required in
extension.json.

Change-Id: I61856796d864c9493c1a7a875cb2415f11f081a9
Depends-On: I193f5b9a95430b0a05573c361715e053e5411e32
2018-08-13 23:30:34 +02:00
Paladox bacee60d42 Fix "PHP Warning: count(): Parameter must be an array or an object that implements Countable"
Change-Id: I6169f4226acd41c77d0b4b7710064dce45761bbd
2018-08-13 16:37:44 +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 fc59da2cca Add missing newlines before "use" sections
Change-Id: I15b4aaac007379370f832bc24e3cebfe54dda754
2018-08-13 09:29:32 +02: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
Thiemo Kreuz cf4ba1e6b8 Make use of inline {@see …} tags
Tested with the quick preview (Ctrl+Q) feature in PHPStorm.

I'm also updating a few type hints I could not split off into a separate
patch, because the lines are to close to each other.

Change-Id: I312ec601a5f443c2b12515e34c574b8889c4c128
2018-08-13 09:17:15 +02:00
Kunal Mehta b0687600a2 Remove $wgEchoNewMsgAlert and 'echo-show-alert' preference
Unconditionally enable it for all users.

Bug: T58845
Change-Id: Ie3ba685cef8979fe750c449fec01992b32df0fba
2018-08-12 20:25:15 -07:00
Umherirrender dbfcd23b3b Pass correct IContextSource to HTMLForm
The special page is only a MessageLocalizer, not a IContextSource.
Its implements all methods of IContextSource, but are delegated to the
underlayed IContextSource. So pass it directly make phan happy, while
the current code works as expected

Change-Id: Ia9d83f2f71a466a2ba74540f96f165c96fb7ca00
2018-08-11 05:44:52 +00:00