29 global
$wgVersion, $wgWMESchemaEditAttemptStepSamplingRate;
31 if ( !$extensionRegistry->isLoaded(
'EventLogging' ) ) {
35 $samplingRate = $wgWMESchemaEditAttemptStepSamplingRate ?? 0.0625;
36 $inSample = EventLogging::sessionInSample( 1 / $samplingRate, $data[
'editing_session_id'] );
37 $shouldOversample = $extensionRegistry->isLoaded(
'WikimediaEvents' ) &&
38 WikimediaEventsHooks::shouldSchemaEditAttemptStepOversample( $article->getContext() );
39 if ( !$inSample && !$shouldOversample ) {
43 $user = $article->getContext()->getUser();
44 $page = $article->getPage();
45 $title = $article->getTitle();
50 'is_oversample' => !$inSample,
51 'editor_interface' =>
'wikitext',
52 'platform' =>
'desktop',
53 'integration' =>
'page',
54 'page_id' => $page->getId(),
55 'page_title' =>
$title->getPrefixedText(),
56 'page_ns' =>
$title->getNamespace(),
57 'revision_id' => $page->getRevision() ? $page->getRevision()->getId() : 0,
58 'user_id' => $user->getId(),
59 'user_editcount' => $user->getEditCount() ?: 0,
63 if ( $user->isAnon() ) {
64 $data[
'user_class'] =
'IP';
67 return EventLogging::logEvent(
'EditAttemptStep', 18530416, $data );
84 $request = $article->getContext()->getRequest();
87 $user = $article->getContext()->getUser();
88 if ( $user->getOption(
'usebetatoolbar' ) ) {
89 $outputPage->addModuleStyles(
'ext.wikiEditor.styles' );
90 $outputPage->addModules(
'ext.wikiEditor' );
99 if ( $request->getVal(
'section' ) ) {
100 $data[
'init_type'] =
'section';
102 $data[
'init_type'] =
'page';
104 if ( $request->getHeader(
'Referer' ) ) {
105 if ( $request->getVal(
'section' ) ===
'new' || !$article->exists() ) {
106 $data[
'init_mechanism'] =
'new';
108 $data[
'init_mechanism'] =
'click';
111 $data[
'init_mechanism'] =
'url';
131 $req = $outputPage->getRequest();
132 $editingStatsId = $req->getVal(
'editingStatsId' );
133 if ( !$editingStatsId || !$req->wasPosted() ) {
137 $outputPage->addHTML(
142 'name' =>
'editingStatsId',
143 'id' =>
'editingStatsId',
144 'value' => $editingStatsId
160 if ( $wgUser->getOption(
'usebetatoolbar' ) ) {
179 $defaultPreferences[
'usebetatoolbar'] = [
181 'label-message' =>
'wikieditor-toolbar-preference',
182 'help-message' =>
'wikieditor-toolbar-preference-help',
183 'section' =>
'editing/editor',
213 $msg = $ml->
msg(
'sig-text' )->params(
'~~~~' )->inContentLanguage();
214 return $raw ? $msg->plain() : $msg->text();
221 $requiredMagicWords = [
232 if ( class_exists( MagicWordFactory::class ) ) {
233 $factory = MediaWikiServices::getInstance()->getMagicWordFactory();
235 foreach ( $requiredMagicWords as $name ) {
236 if ( class_exists( MagicWordFactory::class ) ) {
237 $magicWords[$name] = $factory->get( $name )->getSynonym( 0 );
250 if ( !self::$statsId ) {
263 $request = $article->getContext()->getRequest();
264 if ( $request->getVal(
'editingStatsId' ) ) {
268 [
'editing_session_id' => $request->getVal(
'editingStatsId' ) ]
281 $request = $article->getContext()->getRequest();
282 if ( $request->getVal(
'editingStatsId' ) ) {
284 $data[
'editing_session_id'] = $request->getVal(
'editingStatsId' );
287 $action =
'saveSuccess';
289 $action =
'saveFailure';
290 $errors =
$status->getErrorsArray();
292 if ( isset( $errors[0][0] ) ) {
293 $data[
'save_failure_message'] = $errors[0][0];
297 $data[
'save_failure_type'] =
'editConflict';
299 $data[
'save_failure_type'] =
'editPageDeleted';
300 } elseif ( isset( $errors[0][0] ) && $errors[0][0] ===
'abusefilter-disallowed' ) {
301 $data[
'save_failure_type'] =
'extensionAbuseFilter';
302 } elseif ( isset( $editPage->
getArticle()->getPage()->ConfirmEdit_ActivateCaptcha ) ) {
304 $data[
'save_failure_type'] =
'extensionCaptcha';
305 } elseif ( isset( $errors[0][0] ) && $errors[0][0] ===
'spam-blacklisted-link' ) {
306 $data[
'save_failure_type'] =
'extensionSpamBlacklist';
310 $data[
'save_failure_type'] =
'responseUnknown';