Remove the BetaFeatures integration

Bug: T344757
Change-Id: If08eab93d30341333feaa4459f85fbc791435e91
This commit is contained in:
Bartosz Dziewoński 2023-09-04 19:01:56 +02:00
parent b9951a74aa
commit c180c2f58e
10 changed files with 18 additions and 264 deletions

View file

@ -1,21 +0,0 @@
<?php
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
$cfg['directory_list'] = array_merge(
$cfg['directory_list'],
[
'../../extensions/BetaFeatures',
]
);
$cfg['exclude_analysis_directory_list'] = array_merge(
$cfg['exclude_analysis_directory_list'],
[
'../../extensions/BetaFeatures',
# Don't analyze imported Parsoid code, it uses a different phan config
'includes/VEParsoid'
]
);
return $cfg;

View file

@ -75,10 +75,7 @@
"value": false
},
"VisualEditorEnableBetaFeature": {
"value": false
},
"VisualEditorUnifiedPreference": {
"description": "Replace the old beta feature preference ('visualeditor-enable') and the old opt-out preference ('visualeditor-betatempdisable') with a new preference backed by the old values.",
"description": "BetaFeatures integration has been removed. This option allows using the old beta feature preference values ('visualeditor-enable') on wikis where it was previously enabled, until it is migrated (T344762).",
"value": false
},
"VisualEditorEnableTocWidget": {
@ -94,9 +91,6 @@
"description": "Make the wikitext mode of VE available (also called 2017 Wikitext Editor). The corresponding per-user options is visualeditor-newwikitext.",
"value": true
},
"VisualEditorEnableWikitextBetaFeature": {
"value": false
},
"VisualEditorFeedbackAPIURL": {
"value": false
},
@ -219,7 +213,6 @@
"CustomEditor": "VisualEditorHooks",
"TextSlotDiffRendererTablePrefix": "VisualEditorHooks",
"EditPage::showEditForm:fields": "VisualEditorHooks",
"GetBetaFeaturePreferences": "VisualEditorBetaFeaturesHooks",
"GetPreferences": "VisualEditorHooks",
"ListDefinedTags": "VisualEditorHooks",
"MakeGlobalVariablesScript": "VisualEditorHooks",
@ -237,13 +230,6 @@
"HookHandlers": {
"VisualEditorHooks": {
"class": "MediaWiki\\Extension\\VisualEditor\\Hooks"
},
"VisualEditorBetaFeaturesHooks": {
"class": "MediaWiki\\Extension\\VisualEditor\\BetaFeaturesHooks",
"services": [
"MainConfig",
"ConfigFactory"
]
}
},
"ResourceModules": {
@ -2717,7 +2703,7 @@
"remoteExtPath": "VisualEditor"
},
"ForeignResourcesDir": "lib",
"@DefaultUserOptions1": "'visualeditor-enable' is only read when in beta feature mode ('VisualEditorEnableBetaFeature').",
"@DefaultUserOptions1": "'visualeditor-enable' is only read when in legacy beta feature mode ('VisualEditorEnableBetaFeature').",
"@DefaultUserOptions2": "'visualeditor-betatempdisable' is only read when NOT in beta feature mode.",
"@DefaultUserOptions3": "'visualeditor-autodisable' records whether the user has explicitly opted out of VE while it was in beta.",
"DefaultUserOptions": {

View file

@ -326,17 +326,8 @@
"visualeditor-mwpredialog-title": "Preformatted plain text",
"visualeditor-mwsignature-tool": "Your signature",
"visualeditor-preference-visualeditor": "Enable the visual editor",
"visualeditor-preference-disable": "Turn off the visual editor",
"visualeditor-preference-core-description": "Enable the visual editor. It will not be available on talk pages and some other namespaces.",
"visualeditor-preference-core-discussion-link": "//mediawiki.org/wiki/Special:MyLanguage/VisualEditor/Feedback",
"visualeditor-preference-core-info-link": "//mediawiki.org/wiki/Special:MyLanguage/VisualEditor/Beta_Features/General",
"visualeditor-preference-core-label": "Visual editing",
"visualeditor-preference-newwikitexteditor-description": "Enable the new wikitext mode inside the visual editor. It has many of the tools present in the visual editor, uses a similar design, and allows better switching between the two.",
"visualeditor-preference-newwikitexteditor-discussion-link": "//mediawiki.org/wiki/2017_wikitext_editor/Feedback",
"visualeditor-preference-newwikitexteditor-enable": "Use the wikitext mode inside the visual editor, instead of a different wikitext editor",
"visualeditor-preference-newwikitexteditor-help": "This is sometimes called the '2017 wikitext editor'.",
"visualeditor-preference-newwikitexteditor-info-link": "//mediawiki.org/wiki/Special:MyLanguage/2017 wikitext editor",
"visualeditor-preference-newwikitexteditor-label": "New wikitext mode",
"visualeditor-preference-tabs": "Editing mode:",
"visualeditor-preference-tabs-multi-tab": "Show me both editor tabs",
"visualeditor-preference-tabs-prefer-ve": "Always give me the visual editor if possible",

View file

@ -347,17 +347,8 @@
"visualeditor-mwpredialog-title": "Title for the preformatted text dialog. It appears when clicking on a <nowiki><pre></nowiki> element.",
"visualeditor-mwsignature-tool": "Used as name of the tool for inserting signatures.",
"visualeditor-preference-visualeditor": "Label for the user preference to enable VisualEditor.",
"visualeditor-preference-disable": "Label for the user preference to disable VisualEditor.",
"visualeditor-preference-core-description": "Used in [[Special:Preferences]].\n\nUsed as description for the checkbox to enable the visual editor.\n\nThe label for this checkbox is {{msg-mw|Visualeditor-preference-core-label}}.",
"visualeditor-preference-core-discussion-link": "{{optional|Used on [[Special:Preferences]] as a link to a page where users can discuss this Beta Feature. Defaults to a page on MediaWiki.org.}}",
"visualeditor-preference-core-info-link": "{{optional|Used on [[Special:Preferences]] as a link to a page where users can learn about this Beta Feature. Defaults to a page on MediaWiki.org.}}",
"visualeditor-preference-core-label": "Used in [[Special:Preferences]].\n\nUsed as label for checkbox to enable the visual editor.\n\nThe description for this checkbox is: {{msg-mw|Visualeditor-preference-core-description}}",
"visualeditor-preference-newwikitexteditor-description": "Used in [[Special:Preferences]].\n\nUsed as description for the checkbox to enable the new wikitext editor.\n\nThe label for this checkbox is {{msg-mw|Visualeditor-preference-newwikitexteditor-label}}.",
"visualeditor-preference-newwikitexteditor-discussion-link": "{{notranslate}}\nUsed on [[Special:Preferences]] as a link to a page where users can discuss this Beta Feature. Defaults to a page on MediaWiki.org.",
"visualeditor-preference-newwikitexteditor-enable": "Label for the user preference to use the wikitext mode inside the visual editor. It replaces the wikitext editor software.",
"visualeditor-preference-newwikitexteditor-help": "Explanation underneath the preference to enable the editor, giving its secondary name.\n\nThe sentence follows {{msg-mw|visualeditor-preference-newwikitexteditor-enable}}.\n\nSee also {{msg-mw|wikieditor-toolbar-preference-help}}.",
"visualeditor-preference-newwikitexteditor-info-link": "{{notranslate}}\nUsed on [[Special:Preferences]] as a link to a page where users can learn about this Beta Feature. Defaults to a page on MediaWiki.org.",
"visualeditor-preference-newwikitexteditor-label": "Used in [[Special:Preferences]].\n\nUsed as label for checkbox to enable the new wikitext editor.\n\nThe description for this checkbox is {{msg-mw|Visualeditor-preference-newwikitexteditor-description}}",
"visualeditor-preference-tabs": "Label for the user preference to change how VisualEditor tabs display to the user",
"visualeditor-preference-tabs-multi-tab": "Used in [[Special:Preferences]].\n\nUsed as label for a radio button to have VisualEditor always use a separate tab. Shown together with the following buttons, so consider formulating them consistently:\n* {{msg-mw|Visualeditor-preference-tabs-prefer-ve}}\n* {{msg-mw|Visualeditor-preference-tabs-prefer-wt}}\n* {{msg-mw|Visualeditor-preference-tabs-remember-last}}",
"visualeditor-preference-tabs-prefer-ve": "Used in [[Special:Preferences]].\n\nUsed as label for a radio button to have VisualEditor be the preferred editor. Shown together with the following buttons, so consider formulating them consistently:\n* {{msg-mw|Visualeditor-preference-tabs-multi-tab}}\n* {{msg-mw|Visualeditor-preference-tabs-prefer-wt}}\n* {{msg-mw|Visualeditor-preference-tabs-remember-last}}",

View file

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="264" height="162" viewBox="0 0 264 162">
<defs>
<clipPath id="jagged-edge">
<path d="M0 0v152l12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10V0z"/>
</clipPath>
</defs>
<g fill="#eaecf0" clip-path="url(#jagged-edge)">
<path id="background" fill="#fff" d="M0 0h264v162H0"/>
<path id="logo" d="M11 22c0-8 6-14 14-14s14 6 14 14-6 14-14 14-14-6-14-14M38 45v-5H13v5h25"/>
<path id="sidebar" d="M38 163V58H13v106h25"/>
<path id="personal-tools" d="M233 5h26v6h-26V5zm-24 0h22v6h-22zm-24 0h22v6h-22zm-23 0h13v6h-13zm15 0h6v6h-6zm-23 0h6v6h-6z"/>
<path id="search-input" d="M258 16v4h-92v-4h92m1-1h-94v6h94v-6z"/>
<path id="search-icon" d="M168 17h2v2h-2z"/>
<path id="article" d="M252 162V29H48v133z"/>
<path id="border" d="M0 0v162h264V0zm1 1h262v150.533l-11 9.166-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-11-9.167z"/>
<path fill="#36c" d="M48.083 29h204.084v20.75H48.083z"/>
<path fill="#c8ccd1" d="M59 58.333h54v6H59zM59 109.334h181v3H59zm0 20h104v3H59zm0-54h134v3H59zm0 10h134v3H59zm0 10h39v3H59zM59 119.334h181v3H59z"/>
<path fill="#a2a9b1" d="M240 70.334h-39v30h39zm-26.348 13.043h1.403l8.7 8.604 4.725-2.833 7.117 5.943v.025H204.45z" opacity=".412"/>
<path fill="#fff" d="M59 34.333h25v10H59v-10zm33.5 0h10v10h-10zm17 0h10v10h-10z"/>
<path fill="#36c" d="M100.012 90.834v2h1.457v7h-1.49v2h4.916v-2h-1.427v-7h1.458v-2z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="264" height="162" viewBox="0 0 264 162">
<defs>
<clipPath id="jagged-edge">
<path d="M0 0v152l12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10V0z"/>
</clipPath>
</defs>
<g fill="#eaecf0" clip-path="url(#jagged-edge)" transform="matrix(-1 0 0 1 264 0)">
<path id="background" fill="#fff" d="M0 0h264v162H0"/>
<path id="logo" d="M11 22c0-8 6-14 14-14s14 6 14 14-6 14-14 14-14-6-14-14M38 45v-5H13v5h25"/>
<path id="sidebar" d="M38 163V58H13v106h25"/>
<path id="personal-tools" d="M233 5h26v6h-26V5zm-24 0h22v6h-22zm-24 0h22v6h-22zm-23 0h13v6h-13zm15 0h6v6h-6zm-23 0h6v6h-6z"/>
<path id="search-input" d="M258 16v4h-92v-4h92m1-1h-94v6h94v-6z"/>
<path id="search-icon" d="M168 17h2v2h-2z"/>
<path id="article" d="M252 162V29H48v133z"/>
<path id="border" d="M0 0v162h264V0zm1 1h262v150.533l-11 9.166-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-11-9.167z"/>
<path fill="#36c" d="M48.083 29h204.084v20.75H48.083z"/>
<path fill="#c8ccd1" d="M59 58.333h54v6H59zM59 109.334h181v3H59zm0 20h104v3H59zm0-54h134v3H59zm0 10h134v3H59zm0 10h39v3H59zM59 119.334h181v3H59z"/>
<path fill="#a2a9b1" d="M240 70.334h-39v30h39zm-26.348 13.043h1.403l8.7 8.604 4.725-2.833 7.117 5.943v.025H204.45z" opacity=".412"/>
<path fill="#fff" d="M59 34.333h25v10H59v-10zm33.5 0h10v10h-10zm17 0h10v10h-10z"/>
<path fill="#36c" d="M100.012 90.834v2h1.457v7h-1.49v2h4.916v-2h-1.427v-7h1.458v-2z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="264" height="162" viewBox="0 0 264 162">
<defs>
<clipPath id="jagged-edge">
<path d="M0 0v152l12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10V0z"/>
</clipPath>
</defs>
<g fill="#eaecf0" clip-path="url(#jagged-edge)">
<path id="background" fill="#fff" d="M263.5 162.25l-263-.5V.5h263z"/>
<path id="logo" d="M11 22c0-8 6-14 14-14s14 6 14 14-6 14-14 14-14-6-14-14M38 45v-5H13v5h25"/>
<path id="sidebar" d="M38 163V58H13v106h25"/>
<path id="personal-tools" d="M233 5h26v6h-26V5zm-24 0h22v6h-22zm-24 0h22v6h-22zm-23 0h13v6h-13zm15 0h6v6h-6zm-23 0h6v6h-6z"/>
<path id="search-input" d="M258 16v4h-92v-4h92m1-1h-94v6h94v-6z"/>
<path id="search-icon" d="M168 17h2v2h-2z"/>
<path id="article" d="M252 162.496V29H48v133z"/>
<path id="border" d="M0 0v162h264V0zm1 1h262v150.533l-11 9.166-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-11-9.168z"/>
<path fill="#36c" d="M48.083 29h204.084v20.75H48.083z"/>
<path fill="#fff" d="M59 34.333h25v10H59v-10zm33.5 0h10v10h-10zm17 0h10v10h-10z"/>
<path id="*" fill="#36c" d="M73.395 78.467l-1.128 1.968-4.058-2.376a11.313 11.313 0 0 1-.792-.528 3.114 3.114 0 0 1-.623-.672c.24.56.36 1.16.36 1.8v4.656h-2.28v-4.632c0-.32.016-.616.048-.888a3.2 3.2 0 0 1 .264-.84 3.547 3.547 0 0 1-.6.6 6.7 6.7 0 0 1-.746.504l-4.032 2.352-1.128-1.968 4.032-2.352a5.52 5.52 0 0 1 .84-.384c.272-.112.56-.184.864-.216a4.147 4.147 0 0 1-1.703-.624l-4.056-2.376 1.13-1.968 4.056 2.376c.288.176.544.36.768.552.24.192.448.416.624.672a3.914 3.914 0 0 1-.288-.864 5.99 5.99 0 0 1-.073-.936v-4.68h2.28v4.632c0 .32-.024.632-.072.936a3.094 3.094 0 0 1-.216.84 3.18 3.18 0 0 1 .6-.624c.222-.176.47-.352.742-.528l4.032-2.328 1.128 1.968-4.032 2.328c-.27.16-.543.296-.815.408a2.79 2.79 0 0 1-.816.216c.542.064 1.086.264 1.63.6l4.056 2.376"/>
<path id="square-brackets" fill="#36c" stroke-width=".381" d="M165.983 90h-4.286v2.143h2.144v10.714h-2.143V105h4.286zm-5.357 0h-4.287v2.143h2.143v10.714h-2.144V105h4.286zm-57.144 0h4.286v2.143h-2.143v10.714h2.143V105h-4.286zm5.358 0h4.286v2.143h-2.144v10.714h2.144V105h-4.286z"/>
<path id="#" fill="#36c" d="M68 114.11h-3.06l-.787 3.212h3.045l.8-3.212m5.049-1.482l-.194.855a.68.68 0 0 1-.323.473c-.172.103-.437.154-.8.154h-1.652l-.8 3.212h2.195c.267 0 .456.066.568.196.12.124.15.336.09.638l-.116.649H69.01l-1.058 4.313h-1.136c-.122 0-.237-.02-.35-.061a.836.667 0 0 1-.258-.186 1.163.928 0 0 1-.154-.278.658.658 0 0 1 .013-.34l.865-3.448h-3.048l-.865 3.552c-.069.274-.21.47-.426.586a1.514 1.514 0 0 1-.735.175h-1.11l1.058-4.313h-1.783c-.258 0-.448-.062-.568-.185-.121-.124-.151-.34-.09-.649l.117-.649h2.595l.789-3.212h-2.932l.181-.844c.043-.22.15-.38.323-.484.172-.102.439-.154.8-.154h1.899l.89-3.583c.05-.22.18-.39.388-.514a1.131.902 0 0 1 .722-.196h1.136l-1.058 4.293h3.06l1.047-4.293h1.123c.275 0 .49.069.645.206.155.137.206.316.155.535l-.89 3.552h2.697"/>
<path fill="#c8ccd1" d="M59 58.333h54v6H59zm20 57.001h161v3H79zm-20 20h104v3H59zm0-40h39v3H59zm0 30h181v3H59zm56-30h39v3h-39zm-36-20h161v3H79zm-20 10h181v3H59z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="264" height="162" viewBox="0 0 264 162">
<defs>
<clipPath id="jagged-edge">
<path d="M0 0v152l12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10V0z"/>
</clipPath>
</defs>
<g fill="#eaecf0" clip-path="url(#jagged-edge)" transform="matrix(-1 0 0 1 264 0)">
<path id="background" fill="#fff" d="M263.5 162.25l-263-.5V.5h263z"/>
<path id="logo" d="M11 22c0-8 6-14 14-14s14 6 14 14-6 14-14 14-14-6-14-14M38 45v-5H13v5h25"/>
<path id="sidebar" d="M38 163V58H13v106h25"/>
<path id="personal-tools" d="M233 5h26v6h-26V5zm-24 0h22v6h-22zm-24 0h22v6h-22zm-23 0h13v6h-13zm15 0h6v6h-6zm-23 0h6v6h-6z"/>
<path id="search-input" d="M258 16v4h-92v-4h92m1-1h-94v6h94v-6z"/>
<path id="search-icon" d="M168 17h2v2h-2z"/>
<path id="article" d="M252 162.496V29H48v133z"/>
<path id="border" d="M0 0v162h264V0zm1 1h262v150.533l-11 9.166-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-11-9.168z"/>
<path fill="#36c" d="M48.083 29h204.084v20.75H48.083z"/>
<path fill="#fff" d="M59 34.333h25v10H59v-10zm33.5 0h10v10h-10zm17 0h10v10h-10z"/>
<path id="*" fill="#36c" d="M73.395 78.467l-1.128 1.968-4.058-2.376a11.313 11.313 0 0 1-.792-.528 3.114 3.114 0 0 1-.623-.672c.24.56.36 1.16.36 1.8v4.656h-2.28v-4.632c0-.32.016-.616.048-.888a3.2 3.2 0 0 1 .264-.84 3.547 3.547 0 0 1-.6.6 6.7 6.7 0 0 1-.746.504l-4.032 2.352-1.128-1.968 4.032-2.352a5.52 5.52 0 0 1 .84-.384c.272-.112.56-.184.864-.216a4.147 4.147 0 0 1-1.703-.624l-4.056-2.376 1.13-1.968 4.056 2.376c.288.176.544.36.768.552.24.192.448.416.624.672a3.914 3.914 0 0 1-.288-.864 5.99 5.99 0 0 1-.073-.936v-4.68h2.28v4.632c0 .32-.024.632-.072.936a3.094 3.094 0 0 1-.216.84 3.18 3.18 0 0 1 .6-.624c.222-.176.47-.352.742-.528l4.032-2.328 1.128 1.968-4.032 2.328c-.27.16-.543.296-.815.408a2.79 2.79 0 0 1-.816.216c.542.064 1.086.264 1.63.6l4.056 2.376"/>
<path id="square-brackets" fill="#36c" stroke-width=".381" d="M165.983 90h-4.286v2.143h2.144v10.714h-2.143V105h4.286zm-5.357 0h-4.287v2.143h2.143v10.714h-2.144V105h4.286zm-57.144 0h4.286v2.143h-2.143v10.714h2.143V105h-4.286zm5.358 0h4.286v2.143h-2.144v10.714h2.144V105h-4.286z"/>
<path id="#" fill="#36c" d="M68 114.11h-3.06l-.787 3.212h3.045l.8-3.212m5.049-1.482l-.194.855a.68.68 0 0 1-.323.473c-.172.103-.437.154-.8.154h-1.652l-.8 3.212h2.195c.267 0 .456.066.568.196.12.124.15.336.09.638l-.116.649H69.01l-1.058 4.313h-1.136c-.122 0-.237-.02-.35-.061a.836.667 0 0 1-.258-.186 1.163.928 0 0 1-.154-.278.658.658 0 0 1 .013-.34l.865-3.448h-3.048l-.865 3.552c-.069.274-.21.47-.426.586a1.514 1.514 0 0 1-.735.175h-1.11l1.058-4.313h-1.783c-.258 0-.448-.062-.568-.185-.121-.124-.151-.34-.09-.649l.117-.649h2.595l.789-3.212h-2.932l.181-.844c.043-.22.15-.38.323-.484.172-.102.439-.154.8-.154h1.899l.89-3.583c.05-.22.18-.39.388-.514a1.131.902 0 0 1 .722-.196h1.136l-1.058 4.293h3.06l1.047-4.293h1.123c.275 0 .49.069.645.206.155.137.206.316.155.535l-.89 3.552h2.697"/>
<path fill="#c8ccd1" d="M59 58.333h54v6H59zm20 57.001h161v3H79zm-20 20h104v3H59zm0-40h39v3H59zm0 30h181v3H59zm56-30h39v3h-39zm-36-20h161v3H79zm-20 10h181v3H59z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -1,80 +0,0 @@
<?php
namespace MediaWiki\Extension\VisualEditor;
use Config;
use ConfigFactory;
use MediaWiki\Extension\BetaFeatures\Hooks\GetBetaFeaturePreferencesHook;
use MediaWiki\MainConfigNames;
use User;
/**
* Hooks from BetaFeatures extension,
* which is optional to use with this extension.
*/
class BetaFeaturesHooks implements GetBetaFeaturePreferencesHook {
private Config $coreConfig;
private Config $config;
public function __construct(
Config $coreConfig,
ConfigFactory $configFactory
) {
$this->coreConfig = $coreConfig;
$this->config = $configFactory->makeConfig( 'visualeditor' );
}
/**
* Handler for the GetBetaPreferences hook, to add and hide user beta preferences as configured
*
* @param User $user
* @param array &$preferences Their preferences object
*/
public function onGetBetaFeaturePreferences( User $user, array &$preferences ) {
$iconpath = $this->coreConfig->get( MainConfigNames::ExtensionAssetsPath ) . '/VisualEditor/images';
if (
!$this->config->get( 'VisualEditorUnifiedPreference' ) &&
$this->config->get( 'VisualEditorEnableBetaFeature' )
) {
$preferences['visualeditor-enable'] = [
'version' => '1.0',
'label-message' => 'visualeditor-preference-core-label',
'desc-message' => 'visualeditor-preference-core-description',
'screenshot' => [
'ltr' => "$iconpath/betafeatures-icon-VisualEditor-ltr.svg",
'rtl' => "$iconpath/betafeatures-icon-VisualEditor-rtl.svg",
],
'info-message' => 'visualeditor-preference-core-info-link',
'discussion-message' => 'visualeditor-preference-core-discussion-link',
'requirements' => [
'javascript' => true,
'unsupportedList' => $this->config->get( 'VisualEditorBrowserUnsupportedList' ),
]
];
}
if (
$this->config->get( 'VisualEditorEnableWikitextBetaFeature' ) &&
// Don't try to register as a beta feature if enabled by default
!$this->config->get( 'VisualEditorEnableWikitext' )
) {
$preferences['visualeditor-newwikitext'] = [
'version' => '1.0',
'label-message' => 'visualeditor-preference-newwikitexteditor-label',
'desc-message' => 'visualeditor-preference-newwikitexteditor-description',
'screenshot' => [
'ltr' => "$iconpath/betafeatures-icon-WikitextEditor-ltr.svg",
'rtl' => "$iconpath/betafeatures-icon-WikitextEditor-rtl.svg",
],
'info-message' => 'visualeditor-preference-newwikitexteditor-info-link',
'discussion-message' => 'visualeditor-preference-newwikitexteditor-discussion-link',
'requirements' => [
'javascript' => true,
'unsupportedList' => $this->config->get( 'VisualEditorBrowserUnsupportedList' ),
]
];
}
}
}

View file

@ -906,45 +906,29 @@ class Hooks implements
$services = MediaWikiServices::getInstance();
$userOptionsLookup = $services->getUserOptionsLookup();
$veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
$isBeta = $veConfig->get( 'VisualEditorEnableBetaFeature' ) &&
ExtensionRegistry::getInstance()->isLoaded( 'BetaFeatures' );
$isBeta = $veConfig->get( 'VisualEditorEnableBetaFeature' );
if ( $veConfig->get( 'VisualEditorUnifiedPreference' ) ) {
// Use the old preference keys to avoid having to migrate data for now.
// (One day we might write and run a maintenance script to update the
// entries in the database and make this unnecessary.)
if ( $isBeta ) {
$preferences['visualeditor-enable'] = [
'type' => 'toggle',
'label-message' => 'visualeditor-preference-visualeditor',
'section' => 'editing/editor',
];
} else {
$preferences['visualeditor-betatempdisable'] = [
'invert' => true,
'type' => 'toggle',
'label-message' => 'visualeditor-preference-visualeditor',
'section' => 'editing/editor',
'default' => $userOptionsLookup->getOption( $user, 'visualeditor-betatempdisable' ) ||
$userOptionsLookup->getOption( $user, 'visualeditor-autodisable' )
];
}
} elseif ( !$isBeta ) {
// Config option for visual editing "deployed" state (opt-out)
$preferences['visualeditor-betatempdisable'] = [
// Use the old preference keys to avoid having to migrate data for now.
// (One day we might write and run a maintenance script to update the
// entries in the database and make this unnecessary.) (T344762)
if ( $isBeta ) {
$preferences['visualeditor-enable'] = [
'type' => 'toggle',
'label-message' => 'visualeditor-preference-disable',
'label-message' => 'visualeditor-preference-visualeditor',
'section' => 'editing/editor',
];
} else {
$preferences['visualeditor-betatempdisable'] = [
'invert' => true,
'type' => 'toggle',
'label-message' => 'visualeditor-preference-visualeditor',
'section' => 'editing/editor',
'default' => $userOptionsLookup->getOption( $user, 'visualeditor-betatempdisable' ) ||
$userOptionsLookup->getOption( $user, 'visualeditor-autodisable' )
];
}
// Config option for wikitext editing "deployed" state (opt-out)
if (
$veConfig->get( 'VisualEditorEnableWikitext' )
) {
if ( $veConfig->get( 'VisualEditorEnableWikitext' ) ) {
$preferences['visualeditor-newwikitext'] = [
'type' => 'toggle',
'label-message' => 'visualeditor-preference-newwikitexteditor-enable',
@ -1130,10 +1114,7 @@ class Hooks implements
'allowExternalLinkPaste' => $veConfig->get( 'VisualEditorAllowExternalLinkPaste' ),
'enableHelpCompletion' => $veConfig->get( 'VisualEditorEnableHelpCompletion' ),
'enableTocWidget' => $veConfig->get( 'VisualEditorEnableTocWidget' ),
'enableWikitext' => (
$veConfig->get( 'VisualEditorEnableWikitext' ) ||
$veConfig->get( 'VisualEditorEnableWikitextBetaFeature' )
),
'enableWikitext' => $veConfig->get( 'VisualEditorEnableWikitext' ),
'useChangeTagging' => $veConfig->get( 'VisualEditorUseChangeTagging' ),
'editCheckTagging' => $veConfig->get( 'VisualEditorEditCheckTagging' ),
'editCheck' => $veConfig->get( 'VisualEditorEditCheck' ),