Jforrester has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350644 )

Change subject: mediawiki.toolbar: Emit deprecation warnings
......................................................................

mediawiki.toolbar: Emit deprecation warnings

Callers to the EditPageBeforeEditToolbar hook can now return false to
signal that the toolbar is over-written, in which case this old code
won't be called (so no deprecation warnings for users of WikiEditor,
CodeEditor, etc.).

Bug: T30856
Depends-On: I5e755ef5dffb843368563511044d3123f14dc4bc
Change-Id: I3bed70a20e4b94fe3d04a00925b8012312202574
(cherry picked from commit 14cffee7c1ea7e6f411730a52aadb2458fcfb0fd)
---
M RELEASE-NOTES-1.29
M docs/hooks.txt
M includes/EditPage.php
M resources/src/mediawiki.toolbar/toolbar.js
4 files changed, 15 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/350644/1

diff --git a/RELEASE-NOTES-1.29 b/RELEASE-NOTES-1.29
index 75c8b9a..12f9b54 100644
--- a/RELEASE-NOTES-1.29
+++ b/RELEASE-NOTES-1.29
@@ -330,6 +330,11 @@
   tooltipAccessKeyRegexp, updateTooltipAccessKeys.
 * The ID of the <li> element containing the login link has changed from
   'pt-login' to 'pt-login-private' in private wikis.
+* The old, neglected "bulletin board style toolbar" in the edit form is now
+  deprecated (T30856). This old code dates from 2006, and was replaced in the
+  MediaWiki release tarball and in Wikimedia production by the WikiEditor
+  extension in 2010. It is only shown to users if no other editor was
+  installed, and leads to confusion.
 
 == Compatibility ==
 
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 060af89..7c09a55 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -1417,7 +1417,8 @@
 
 'EditPageBeforeEditToolbar': Allows modifying the edit toolbar above the
 textarea in the edit form.
-&$toolbar: The toolbar HTMl
+&$toolbar: The toolbar HTML
+Hook subscribers can return false to avoid the default toolbar code being 
loaded.
 
 'EditPageCopyrightWarning': Allow for site and per-namespace customization of
 contribution/copyright notice.
diff --git a/includes/EditPage.php b/includes/EditPage.php
index ca3b4d1..75646b3 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -4097,11 +4097,14 @@
                }
 
                $script .= '});';
-               $wgOut->addScript( ResourceLoader::makeInlineScript( $script ) 
);
 
                $toolbar = '<div id="toolbar"></div>';
 
-               Hooks::run( 'EditPageBeforeEditToolbar', [ &$toolbar ] );
+               if ( Hooks::run( 'EditPageBeforeEditToolbar', [ &$toolbar ] ) ) 
{
+                       // Only add the old toolbar cruft to the page payload 
if the toolbar has not
+                       // been over-written by a hook caller
+                       $wgOut->addScript( ResourceLoader::makeInlineScript( 
$script ) );
+               };
 
                return $toolbar;
        }
diff --git a/resources/src/mediawiki.toolbar/toolbar.js 
b/resources/src/mediawiki.toolbar/toolbar.js
index 2af8b2f..576aa4e 100644
--- a/resources/src/mediawiki.toolbar/toolbar.js
+++ b/resources/src/mediawiki.toolbar/toolbar.js
@@ -164,10 +164,11 @@
        mw.log.deprecate( window, 'insertTags', toolbar.insertTags, 'Use 
mw.toolbar.insertTags instead.' );
 
        // For backwards compatibility. Used to be called from EditPage.php, 
maybe other places as well.
-       mw.log.deprecate( toolbar, 'init', $.noop );
+       toolbar.init = $.noop;
 
        // Expose API publicly
-       mw.toolbar = toolbar;
+       // @deprecated since MW 1.30
+       mw.log.deprecate( mw, 'toolbar', toolbar );
 
        $( function () {
                var i, button;

-- 
To view, visit https://gerrit.wikimedia.org/r/350644
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3bed70a20e4b94fe3d04a00925b8012312202574
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_29
Gerrit-Owner: Jforrester <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to