Commit graph

76 commits

Author SHA1 Message Date
thiemowmde de1dbd70ec Make EventLogging code more robust
This code started to fail when executing the FileImporter tests.
FileImporter triggers a hook that ends here.

Two suggestions:
* I think we don't need/don't want to have log entries for PHPUnit
  test runs.
* In test scenarios getSkin() might return null. Since getSkinName
  is also allowed to be null I believe it's fine when we log null in
  such a situation.

Bug: T337270
Change-Id: I9bf946c150d99ab97b4cdf128fac87158c633331
2023-07-28 16:49:42 +02:00
ksarabia d7993a35b8 Update reference in WikiEditor
Logs data from WikiEditor

Bug: T337270
Change-Id: I69b4ea31397915ce1e90cff91e44b3648d57f389
2023-07-25 10:55:35 -05:00
DLynch 3e568552b6 Revert "Remove hacks that avoid duplicate event logging with MobileFrontend"
This reverts commit 929e8463fb.

Reason for revert: we're still seeing double-logging of some events, so this is apparently still needed until we can track down what's causing that.

Change-Id: Ifc32dfc7aa2ca67169759ecd8c278f1aea2dbef8
2023-06-09 15:20:01 -05:00
Sam Smith 457366c2cf Hooks: Also log EditAttemptStep events via Metrics Platform
The EditAttemptStep instrument is a candidate for migration to the
Metrics Platform [0]. The first step of the migration is to log events
both using the Event Platform (i.e. EventLogging::submit()) and using
the Metrics Platform Client (i.e. via
EventLogging::submitMetricsEvent()).

The Metrics Platform Client can mix in additional information -
so-called context attributes [1] - based on the stream configuration.
Since the majority of the default values mixed into each event in
Hooks::doEventLogging() are already known to the Metrics Platform
Client, the majority of Hooks::doMetricsPlatformLogging() is concerned
with remove those values from the event.

[0] https://wikitech.wikimedia.org/wiki/Metrics_Platform
[1] https://gerrit.wikimedia.org/g/mediawiki/libs/metrics-platform/+/aed6738b845/js/src/StreamConfig.d.ts#31
[2] https://wikitech.wikimedia.org/wiki/Metrics_Platform/Creating_a_Stream_Configuration

Bug: T309985
Change-Id: I052159884a9a8b21b3dc9ee01e2cafdbb173ca26
2023-05-16 15:33:06 -06:00
gerritbot 1271e13c56 Update moved class EditPage
See T321882. Moved in Ibefc44eb64aed

Bug: T321681
Change-Id: Ia2582eefeed7c0a70fcc89857fb30995a6c0f1ed
2023-05-06 22:38:36 +00:00
jenkins-bot e312f83cb0 Merge "Remove hacks that avoid duplicate event logging with MobileFrontend" 2023-04-14 16:36:02 +00:00
Bartosz Dziewoński 0c287ea755 Update EditAttemptStep and VisualEditorFeatureUse for IP masking
Bug: T332437
Bug: T332436
Change-Id: I630822accb1ba7332aeca997fa72d0190ed5e75e
2023-04-11 21:58:42 +02:00
Bartosz Dziewoński 929e8463fb Remove hacks that avoid duplicate event logging with MobileFrontend
This reverts 843efa2f46,
no longer needed after I6028fa4a34916a6cd20161009cf5893492286c2d.

Bug: T334263
Depends-On: I6028fa4a34916a6cd20161009cf5893492286c2d
Change-Id: Ie4506d46d350fb53d6d0264763c2d55fc142997e
2023-04-06 22:49:06 +00:00
Bartosz Dziewoński b484833c7d Skip server-side event logging unless WikimediaEvents is installed
The corresponding client-side event logging is implemented in the
WikimediaEvents extension, so logging server-side events only doesn't
make sense.

Bug: T322602
Change-Id: I79b55adca1da0d9abfe60943dfa4f8c86ecb9626
2023-04-06 21:12:04 +02:00
Sam Wilson 56b4ba8476 Realtime Preview: remove Beta Feature and onboarding popup
Delete almost all code realting to the onboarding popup (blue
pulsating dot) and Beta Feature. Leave only one line to delete
any existing localStorage item that was used to remember the
dismissal of the onboarding popup.

Bug: T327515
Change-Id: I8d05e143858a2269dd6f3302dcc6cee6b0855ffd
2023-03-17 15:22:32 +08:00
David Lynch 843efa2f46 Don't do logging if MobileFrontend is active for the current page
Visiting a ?action=edit URL can, depending on user settings, result in
the MobileFrontend overlay appearing on top of WikiEditor. In these
cases, don't log anything.

Bug: T320281
Change-Id: Ib98d2cd6f2e541423e5aeebd3093bad97d6fcc4f
2023-03-07 11:58:43 -06:00
Sam Wilson 68c6d366ce Add config var to disable Beta Feature
Add new $wgWikiEditorRealtimePreviewBeta configuration variable
to make it possible to turn off the RTP Beta Feature even when
the BetaFeatures extension is installed.

Bug: T323033
Change-Id: Ib79f4eaee9cee7404ff883f5e0685610d9dba9d9
2023-01-09 13:08:55 -05:00
Sam Smith 96e5f4e6f3 Hooks: Use $revId of -1 for ::logEvent() calls
EventLogging::logEvent() overwrides the $revId parameter when the schema
has been migrated to the Event Platform. Add a note and use a $revId of
-1 to make this consistent with other calls to EventLogging::logEvent()
for schemas that have been migrated to the Event Platform [0].

[0] https://codesearch.wmcloud.org/search/?q=%3A%3AlogEvent%5C(%20%27%5Cw%2B%27%2C%20-1

Bug: T318263
Change-Id: I5b58161a81ce1f4886f23500ee33ed74397d7107
2022-10-19 14:10:09 +00:00
James D. Forrester 0e3f7c44b2 inEventSample: Avoid invalid character warning from sampling code, hash into hex
Bug: T314896
Change-Id: I377bbe54686fdb9d765543320aef14a99ee2cd7f
2022-08-10 09:24:43 -04:00
David Lynch fd0841a899 Log if an edit attempt began from the sticky header
Bug: T298634
Depends-On: I871494b6e783018b1433f294e09b0d53dded6c3d
Change-Id: I07d3c91a63e78f091a1046ca49830e141f6ef8d4
2022-06-15 02:54:03 -05:00
jenkins-bot b62c5cf06a Merge "Use new ResourceLoader namespace" 2022-05-25 02:16:51 +00:00
Tim Starling 6b2cca3b2b Use new ResourceLoader namespace
Extensions using Phan need to be updated simultaneously with core due
to T308443.

Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: I289b8cb5e74b5d87e26bfe6b779a22eaaa1071ee
2022-05-24 22:59:49 +00:00
David Lynch ce2ecf084f Update schema logging of bucket for new DiscussionTools A/B test
Bug: T304030
Depends-On: I5e57bb9b7958576f3a04373748331a86f4626fb5
Change-Id: I084d26c95d5be78eddb4edd1b42aa52eef909356
2022-05-19 09:50:04 -05:00
MusikAnimal b8bdd64ee5 Realtime Preview: add as a Beta Feature
For MW installations where BetaFeatures is not available, Realtime
Preview is enabled solely with the $wgWikiEditorRealtimePreview
configuration setting.

Bug: T304596
Change-Id: I880022883bf526a2aef237f4a75e790b0f9bd4e5
2022-04-06 13:45:44 -04:00
Sam Wilson e6b77fb2ab Persist Realtime Preview state in a user preference
Store the current state (enabled/disabled) of Realtime Preview in
a new user preference `wikieditor-realtimepreview` and set it
when enabling or disabling the preview pane.

Bug: T294599
Change-Id: Id5f51c6d77ed0077906d5d5178cbfa785cc04dcf
2022-03-31 21:01:36 +08:00
MusikAnimal fe81f28aae Add Realtime Preview vars to the virtual package's versionCallback
This should fix the caching issue we're seeing on Beta

Follow-Up: Iaf49f076c5a290ab9049267b0aede1e6b13a9136
Change-Id: Ibe2fc1b48f4ccc22138f6c16d8170a74500d68e6
2022-03-30 16:54:16 -04:00
MusikAnimal f1a2ba96eb Realtime Preview: disable if average response time is very slow
$wgWikiEditorRealtimeDisableDuration is introduced which allows
sysadmins to control the average time after which Realtime Preview
should be disabled. For now, this shows a simple error message that is
intentionally not localized. In a future patch, we will force the
user into a 'manual preview' workflow. See T304568 for more.

Bug: T302282
Change-Id: I2f01eef19fe81c19efedcc0073a28884f0055359
2022-03-30 12:28:23 -04:00
MusikAnimal 68e6561857 RealtimePreview: add config setting for debounce time
Change-Id: Iaf49f076c5a290ab9049267b0aede1e6b13a9136
2022-03-24 02:00:19 -04:00
Sam Wilson 411be83bc3 Add toggle button and two-pane layout for realtime preview
* Toolbar button to toggle a two-pane layout on and off.
* Resizable bar for the width of the two panes.
* Resizable bar for the edit box height, even when realtime preview is off.
* Only enabled when $wgWikiEditorRealtimePreview = true.
* Fires JS hooks when enabled, resized, and disabled.

Bug: T293347
Change-Id: Id09d44519249c0b7f5c33d48d524b7c92a5a9106
2022-03-13 07:28:01 +08:00
Reedy 07c823679c Use namespaced EventLogging class
Change-Id: Ia5a0ba6846ee1bd6a5436e003d65be955a06d565
2022-03-06 16:15:32 +00:00
Reedy 51c3fe42bd Swap to AutoloadNamespaces
Change-Id: I4eb121b4e81b4ec4833ce0bea81ae041abbdacc9
Follows-Up: I0be9b88accafce97f7e9b7524ec740fb576fa11c
2022-02-06 13:55:54 +00:00
David Lynch fda6c3c117 New bucket for abtest data
Bug: T291308
Change-Id: I7aa47139e3fe552833798d6b8daacc1b30517915
2022-02-02 15:50:21 -06:00
jenkins-bot 9a065b82ee Merge "build: Load ConfirmEdit as phan dependency" 2021-12-13 09:48:13 +00:00
Ed Sanders b4f144057e Tag WikiEditor edits with a hidden tag
Bug: T249038
Change-Id: Ia4267bc430ba0f12cce496ebf6f8c1773ae355a6
2021-12-07 23:30:27 +00:00
jenkins-bot 7fbd917c15 Merge "Use HookHandlers, implement hook interfaces and inject services" 2021-11-25 22:02:37 +00:00
Fomafix 0d4d037968 Use HookHandlers, implement hook interfaces and inject services
The static function WikiEditorHooks::editPageShowEditFormInitial is
kept for compatibility because there are usages in other extensions.

Change-Id: I7ba9f56fd3d00d575696f00f9f1c868fa7ad223b
2021-11-25 19:12:16 +00:00
Umherirrender c062d047ce build: Load ConfirmEdit as phan dependency
Bug: T296287
Depends-On: I549a97923fe994820358c65ee1cd725f6d9bba1a
Change-Id: If45b296a24e86d7ef6c581b3d822eb0adfa1f245
2021-11-23 19:30:25 +01:00
Alexander Vorwerk 538e543a32 Fix namespace for ConfirmEditHooks
ConfirmEdit should be added as a phan dependency, so thing like this no
longer happen in the future.

Bug: T296287
Change-Id: Ic9942b3a6d872c0d3c0e3a53d9462df6f82b06c6
2021-11-23 12:09:44 +01:00
Fomafix 4da6f5b3b5 Use namespace MediaWiki\Extension\WikiEditor in PHP
Change-Id: I0be9b88accafce97f7e9b7524ec740fb576fa11c
2021-11-20 09:30:11 +00:00
Sam Wilson 3f275059df Add logging for non-live previews
This isn't strictly WikiEditor business, but other logging is done
here, and soon real-time previewing will be built in WikiEditor,
so it makes sense to keep all the logging for the different types
of preview together.

Bug: T290521
Change-Id: If42697e43c1bec95d743244d0acf96c47df8b681
2021-11-18 08:24:37 +08:00
jenkins-bot fd74287b2f Merge "Replace WebRequest::getVal by WebRequest::getRawVal" 2021-11-12 18:25:38 +00:00
Roman Stolar b76f02e580 Replace usage of ConfirmEdit_ActivateCaptcha random properties.
Use CacheKeyHelper to get a status from SimpleCaptcha instead of it.

Bug: T275710
Depends-On: I7942ccd6b58584f436f872bf7c9deb63ab84482a
Change-Id: Id35ef3bcf30ddc0581c79cc10fa80e54d5352758
2021-11-11 17:11:27 +02:00
Fomafix 05f15dc79f Merge "Use Html::hidden instead of Xml::element" 2021-11-07 17:46:29 +00:00
jenkins-bot c0967dbe3a Merge "Don't add logging-related form inputs if not required" 2021-11-07 13:55:27 +00:00
Fomafix 758d0fb84a Use Html::hidden instead of Xml::element
This change replaces in the HTML

 <input type="hidden" name="wikieditorJavascriptSupport" id="wikieditorJavascriptSupport" value="" />

by

 <input id="wikieditorJavascriptSupport" type="hidden" name="wikieditorJavascriptSupport"/>

but the behavior is still the same.

Change-Id: Icc9b9c9480be3b220148466d3f93746e14de280a
2021-11-05 18:18:35 +00:00
Fomafix fae34607a7 Replace WebRequest::getVal by WebRequest::getRawVal
The UTF-8 normalization of getVal is not needed here.

Also explicit check for !== null instead of truthy because in PHP is
"0" != true.

Change-Id: I77a8a2c149045f677ff2a1f0e42d9ca9dccde321
2021-11-05 17:57:52 +00:00
Sam Wilson d23389cd06 Avoid User::getEditCount() and ::getOption()
The latter is deprecated, and the former is just a wrapper for
UserEditTracker::getUserEditCount().

Bug: T290521
Change-Id: Id3f2b9a007fe299d74d5957cbd3e31b11adb2790
2021-11-05 11:52:00 +08:00
Sam Wilson b980affad6 Don't add logging-related form inputs if not required
Change-Id: I71d7f9b741cb60d0bbb8f0fbd6e8ac0967ee1492
2021-11-03 13:40:19 +08:00
Sam Wilson 0744773321 Fix excluded phpcs rules
Change-Id: Ie0d0a00e2a12dc50bd2ed9ba00b8e7f339227a56
2021-11-02 13:48:27 +08:00
David Lynch 385903a3f0 PHP VisualEditorFeatureUse logging: properly record session id
EditAttemptStep and VisualEditorFeatureUse have this one very annoying
inconsistency.

Bug: T281409
Depends-On: I96e07e10943d330efcf47e0a2989ea3b73bae428
Change-Id: I3bddd3096625466fc5b6c88b64a570a389b87a05
2021-05-12 19:46:36 +00:00
David Lynch cb1c5d49aa Log whether Javascript was supported on saveSuccess
Adds a hidden field to the edit page form, with JS that will set its
value. Server-side then checks for that value and logs whether it was
correctly set.

Bug: T263505
Change-Id: I8be06385aa6d97e5536cfc252d34297e1c000a32
2021-04-30 17:45:40 -05:00
jenkins-bot 5791ee3d51 Merge "Update save failure logging for EditAttemptStep schema" 2021-02-01 18:17:59 +00:00
David Lynch 36a58b5599 Logging init mechanism for new section direct navigation
Support the `url-new` mechanism so we can distinguish between
new/existing sections in direct navigation.

Bug: T272544
Change-Id: I2c431592035c7ccedbbe612bc97f63141fc4dab7
Depends-On: I3cee7a3a4c4b646692dce4a1180c4ba18a61f4bc
2021-01-29 20:56:14 -06:00
David Lynch e052e46f94 Log the DiscussionTools a/b test bucket for relevant schemas
If someone is enrolled the DT a/b test, we want to know about their
editing here as well.

Bug: T273096
Change-Id: If2bb04011c8ca54e8c7ffd073e21bec45e92460c
2021-01-29 20:56:14 -06:00
Bartosz Dziewoński dc93bf1b37 Parse alternative magic word translations when prefilling image fields
In some languages, image options like 'alt' or 'thumb' can have
multiple synonyms. They were only handled for English (and were
hard-coded).

Change-Id: Ib03932d3d85a5540bea325f2717da3365756a90e
2021-01-22 22:15:16 +01:00