Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59646
Change subject: Move config vars that are global in nature to the startup module
......................................................................
Move config vars that are global in nature to the startup module
If they're in the per-page config, we'll have to deal with caching
nightmares when changing them.
Change-Id: Ic8866500b1f20aee36c436dcc3d132c8fde0a8fc
---
M VisualEditor.hooks.php
M VisualEditor.php
M modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
M modules/ve/init/mw/ve.init.mw.Target.js
4 files changed, 14 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/46/59646/1
diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 476919b..1451d4d 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -59,9 +59,19 @@
* Adds extra variables to the page config.
*/
public static function onMakeGlobalVariablesScript( array &$vars,
OutputPage $out ) {
- global $wgVisualEditorEnableSectionEditLinks,
$wgVisualEditorParsoidProblemReportURL;
$vars['wgVisualEditor'] = array(
'isPageWatched' => $out->getUser()->isWatched(
$out->getTitle() ),
+ );
+
+ return true;
+ }
+
+ /**
+ * Adds extra variables to the global config
+ */
+ public static function onResourceLoaderGetConfigVars( array &$vars ) {
+ global $wgVisualEditorEnableSectionEditLinks,
$wgVisualEditorParsoidProblemReportURL;
+ $vars['wgVisualEditorConfig'] = array(
'enableSectionEditLinks' =>
$wgVisualEditorEnableSectionEditLinks,
'reportProblemURL' =>
$wgVisualEditorParsoidProblemReportURL
);
diff --git a/VisualEditor.php b/VisualEditor.php
index fb46eb3..9b8fc10 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -499,6 +499,7 @@
$wgHooks['GetPreferences'][] = 'VisualEditorHooks::onGetPreferences';
$wgHooks['ListDefinedTags'][] = 'VisualEditorHooks::onListDefinedTags';
$wgHooks['MakeGlobalVariablesScript'][] =
'VisualEditorHooks::onMakeGlobalVariablesScript';
+$wgHooks['ResourceLoaderGetConfigVars'][] =
'VisualEditorHooks::onResourceLoaderGetConfigVars';
$wgHooks['ResourceLoaderTestModules'][] =
'VisualEditorHooks::onResourceLoaderTestModules';
$wgAutoloadClasses['VisualEditorMessagesModule'] = $dir .
'VisualEditorMessagesModule.php';
diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
index 21dc153..40696ca 100644
--- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
@@ -123,7 +123,7 @@
}
}
this.setupSkinTabs();
- if ( mw.config.get( 'wgVisualEditor' ).enableSectionEditLinks )
{
+ if ( mw.config.get( 'wgVisualEditorConfig'
).enableSectionEditLinks ) {
this.setupSectionEditLinks();
}
if ( this.isViewPage ) {
diff --git a/modules/ve/init/mw/ve.init.mw.Target.js
b/modules/ve/init/mw/ve.init.mw.Target.js
index d280e68..da3c753 100644
--- a/modules/ve/init/mw/ve.init.mw.Target.js
+++ b/modules/ve/init/mw/ve.init.mw.Target.js
@@ -592,7 +592,7 @@
'wiki': mw.config.get( 'wgDBname' )
};
$.post(
- mw.config.get( 'wgVisualEditor' ).reportProblemURL,
+ mw.config.get( 'wgVisualEditorConfig' ).reportProblemURL,
{ 'data': JSON.stringify( report ) },
function () {
// This space intentionally left blank
--
To view, visit https://gerrit.wikimedia.org/r/59646
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8866500b1f20aee36c436dcc3d132c8fde0a8fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits