Commit graph

12 commits

Author SHA1 Message Date
Bartosz Dziewoński 6b633803c8 ThreadItemStore: Add details to row insertion exceptions
Bug: T343859
Change-Id: Ic0d741c192f42a3bd54276259820f25edcb0705b
2023-09-14 19:05:04 +00:00
Umherirrender e5cbc838a8 Use HookHandlers for BetaFeatures hook
Bug: T273303
Change-Id: I685eb618b7ca2dc5b10bc5f08bfd235f682ff3c5
2023-08-16 05:23:25 +00:00
Bartosz Dziewoński af68c835bb Update exception handling for new code conventions
Change code to match the documented consensus formed on T321683:
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Exception_handling

* Do not directly throw Exception, Error or MWException
* Document checked exceptions with @throws
* Do not document unchecked exceptions

For this extension, I think it makes sense to consider DOMException an
unchecked exception too (in addition to the usual LogicException and
RuntimeException).

Depends-On: Id07e301c3f20afa135e5469ee234a27354485652
Depends-On: I869af06896b9757af18488b916211c5a41a8c563
Depends-On: I42d9b7465d1406a22ef1b3f6d8de426c60c90e2c
Change-Id: Ic9d9efd031a87fa5a93143f714f0adb20f0dd956
2023-01-22 18:17:11 +00:00
Reedy 253531fff4 .phan/config.php: Fix string interpolation
Bug: T314096
Change-Id: Ia65d6a598bdeb5abfbab6fc8c7a8f7ed0a600061
2022-11-05 10:45:01 -06:00
Bartosz Dziewoński e6fff19e7e Prevent using the reply tool together with Convenient Discussions gadget
Parts of the implementation copied from the Popups extension.

Bug: T298909
Change-Id: I2c42c6ff1c5d84da9333f8f74a4aec5c8fea704b
2022-08-17 01:40:43 +02:00
jenkins-bot 0e8c9b9536 Merge "Update DiscussionTools phan configuration to match new Parsoid DOM alias config" 2022-01-20 23:34:25 +00:00
C. Scott Ananian c643669dbd Update DiscussionTools phan configuration to match new Parsoid DOM alias config
Bug: T240775
Followup-To: I99e1768c4dcbe84d73d13ddd34a181d68e9fcb5e
Depends-On: I68228213a2af937923751dcc2c121551396c6498
Change-Id: I9c5d1fc4c59469f0af9da81f94aac0ccd779d4df
2022-01-20 17:16:35 -05:00
David Lynch df47f9fda3 Logging for new comments
Bug: T286076
Change-Id: Ic78a49aedcb03d160d74ba3fa9660f3583f0e568
2021-10-28 21:50:23 +00:00
C. Scott Ananian 25272e7a4a Don't refer directly to PHP dom extension classes; avoid nonstandard behavior
These changes ensure that DiscussionTools is independent of DOM
library choice, and will not break if/when Parsoid switches to an
alternate (more standards-compliant) DOM library.

We run `phan` against the Dodo standards-compliant DOM library,
so this ends up flagging uses of non-standard PHP extensions to
the DOM.  These will be suppressed for now with a "Nonstandard DOM"
comment that can be grepped for, since they will eventually
will need to be rewritten or worked around.

Most frequent issues:

* Node::nodeValue and Node::textContent and Element::getAttribute()
can return null in a spec-compliant implementation.  Add `?? ''` to
make spec-compliant results consistent w/ what PHP returns.

* DOMXPath doesn't accept anything except DOMDocument.  These uses
should be replaced with DOMCompat::querySelectorAll() or similar
(which end up using DOMXPath under the covers for DOMDocument any way,
but are implemented more efficiently in a spec-compliant
implementation).

* A couple of times we have code like:
  `while ($node->firstChild!==null) { $node = $node->firstChild; }`
and phan's analysis isn't strong enough to determine that $node is still
non-null after the while.  This same issue should appear with DOMDocument
but phan doesn't complain for some reason.

One apparently legit issue:

* Node::insertBefore() is once called in a funny way which leans on
the fact that the second option is optional in PHP.  This seems to be
a workaround for an ancient PHP bug, and can probably be safely
removed.

Bug: T287611
Bug: T217867
Change-Id: I3c4f41c3819770f85d68157c9f690d650b7266a3
2021-07-30 18:15:40 -04:00
C. Scott Ananian 5203d30ea6 Use DOMCompat::newDocument() to create a new Document
For compatibility with Parsoid's document abstraction (Parsoid may
switch to an alternate DOM library in the future), don't explicitly
create a new document object using `new DOMDocument`; instead use
the Parsoid wrapper `DOMCompat::newDocument()`.  This ensures that
the Document object created will be compatible with Parsoid.

There are a number of other subtle dependencies on the PHP `dom`
extension in DiscussionTools, like explicit `instanceof` tests; those
will be tweaked in a follow-up patch
(I3c4f41c3819770f85d68157c9f690d650b7266a3) since they do not affect
correctness so long as Parsoid is aliasing Document to a subclass of
the built-in DOMDocument.  Similarly, the Phan warnings we suppress
do not cause runtime errors (because of the fixes included in
c5265341afd9efde6b54ba56dc009aab88eff83c) but phan will be happier
once the follow-up patch lands and aligns all the DOM types.

Bug: T287611
Depends-On: If0671255779571a91d3472a9d90d0f2d69dd1f7d
Change-Id: Ib98bd5b76de7a0d32a29840d1ce04379c72ef486
2021-07-30 18:15:11 -04:00
Ed Sanders 0a39c11914 Echo wiring for topic subscriptions
Depends-On: I60818d57552946857077dee93b0adb036621b791
Change-Id: I7e0996843cdd70141e19d5c7ce66122204efa1b7
2021-04-06 23:28:28 +02:00
Umherirrender 48e860916a build: Add mediawiki/mediawiki-phan-config
Replace phan-taint-check-plugin by phan, it is now included

Change-Id: I0e682a83afd30faa8967e3c586431be4ae9a29b3
2020-06-10 22:21:07 +02:00