You are here: Foswiki>Tasks Web>Item12650 (05 Jul 2015, GeorgeClark)Edit Attach

Item12650: Improve configure's handling of deprecated and removed JQuery plugins.

pencil
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: JQueryPlugin, configure
Branches: Release01x01 trunk
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
This plugin has been eliminated in 1.1.9, but the configuration parameter remains enabled, and causes errors on any page that attempts to load the JQuery plugins.

$Foswiki::cfg{JQueryPlugin}{Plugins}{Themeswitcher}{Enabled} = 1;

Configure needs to handle missing JQueryPlugins in the same way that we deal with Foswiki plugins. "missing" plugins are rendered at the end of the list of plugins along with an error to recommend that the setting be disabled. Once disabled, it's removed from the configuration.

Either that or we need a release note that sites need to manually edit LocalSite.cfg to remove the line. However as not all sites have an easy way to edit files on the server, it would be better if the upgrade handled this.

-- GeorgeClark - 08 Nov 2013

'> causes errors on any page that attempts to load the JQuery plugins.

Can't confirm this. The code isn't trying to eval modules not required. The error message will only be show when a page tries to load the themeswitcher module, either using %JQREQUIRE or by adding the themeswitcher to the {DefaultModules} being loaded on every page.

This:

%JQREQUIRE{"themeswitcher"}%

will render as

Error: no such plugin themeswitcher

plus an admittedly ugly error message in the webserver logs:

ERROR: can't load jQuery plugin themeswitcher: Can't locate Foswiki/Plugins/JQueryPlugin/THEMESWITCHER.pm in @INC (you may need to install the Foswiki::Plugins::JQueryPlugin::THEMESWITCHER module) (@INC contains: ...) at (eval 4360) line 1.
BEGIN failed--compilation aborted at (eval 4360) line 1.

The behavior on the web front should stay the same - no such plugin - as it really isn't in existence anymore.

The error message frankly says exactly what it should: the THEMESWITCHER.pm module isn't there either, even though LocalSite.cfg says so.

All other plugins currently in the deprecation process - corners, autocomplete, some may follow - will produce the same error message.

This is not an urgent error blocking the release, imho.

The eval{} throwing the error is in Foswiki::Plugins::JQueryPlugin::Plugin, line 234.

As far as I can see this code is doing just fine in reporting these kind of compilation problems.

The site itself isn't affected in terms of stability. I am tempted to say this is a no-action for JQueryPlugin. Sure configure could do some mending, but ...

-- MichaelDaum - 08 Nov 2013

I think there are some possible side effects here:

Site upgrades in place using simple "un-tar" of upgrade file
The deprecated THEMESWITCHER.pm will not be removed. The Config.spec entry is removed, but the plugin remains enabled in LocalSite.cfg and there is no way for the user to disable the plugin. The impact is possibly unpredictable as there is a deprecated plugin still active.
Site upgrades by re-install, but keeps LocalSite.cfg
The deprecated THEMESWITCHER.pm is removed, but it's still enabled. User will get unexpected errors in their log whenever %JQPLUGINS% macro is expanded.

I was thinking that Configure would automatically enumerate the available JQ plugins as is done with regular plugins, however they are explicitly listed in Config.spec. I wonder if the solution would be to put them back in Config.spec, maybe in a separate Deprecated JQ Plugins section, with a checker that throws errors if they are enabled. I think if they are defined as EXPERT, then they'll only be visible if the checker flags an error.

-- GeorgeClark - 08 Nov 2013

This works pretty well. Unless you object, I'll move all of the "deprecated" plugins into their own section. Checker flags "WARN" if it's deprecated, and "ERROR" if it's been removed. Testing this, I've found another bug in configure. The code that forces display of EXPERT settings with warning or errors uses the wrong class for the warnings, so they remain hidden.

+# ---+++ Deprecated plugins
+# Any plugins listed here should be disabled.  They will be removed in a future release of Foswiki.
+# They will be generate a Warning if deprecated, but an Error if the module has been removed from
+# the Foswiki distribution.
+
+# **BOOLEAN EXPERT**
+# Warning: this plugin is deprecated. Please use the autocomplete plugin part of the jQuery-ui package.
+$Foswiki::cfg{JQueryPlugin}{Plugins}{Autocomplete}{Enabled} = 0;
+
+# **BOOLEAN EXPERT**
+$Foswiki::cfg{JQueryPlugin}{Plugins}{Themeswitcher}{Enabled} = 0;
+
+# **BOOLEAN EXPERT**
+# Warning: this plugin is deprecated. Please use the tooltip plugin part of the jQuery-ui package.
+$Foswiki::cfg{JQueryPlugin}{Plugins}{Tooltip}{Enabled} = 0;
+
+# **BOOLEAN EXPERT**
+# Warning: This plugin is deprecated. Use Corner instead
+$Foswiki::cfg{JQueryPlugin}{Plugins}{Nifty}{Enabled} = 0;
+
+# **BOOLEAN EXPERT**
+# Warning: This plugin is deprecated. The shake effect is now part of the latest jQuery-ui package.
+$Foswiki::cfg{JQueryPlugin}{Plugins}{Shake}{Enabled} = 0;

I realize this means leaving obsolete stuff around in configure, but I think that's better than leaving orphan settings in the LocalSite.cfg file that cannot be removed without manual edit.

-- GeorgeClark - 08 Nov 2013

Great!

A small modification: in the configure section of JQueryPlugin I'd prefer to call the subsections "Themes" and "Plugins" rather than "Default Themes" and "Default Plugins". The latter clashes with the notion of {DefaultPlugins} to be loaded on every page.

Howerver renaming it to "Themes" unveiled a bug in configure (on trunk, not sure on the 11x branch) where it merges sub-sections of the same name. So I now see "Themes" from NatSkin being listed in the JQueryPlugin's configure section.

-- MichaelDaum - 09 Nov 2013

Michael, Could you set this to waiting for release and open a separate task for the sub-section merge. I'm less confident on how to fix that one and don't want to block this task.

-- GeorgeClark - 20 Dec 2013
 

ItemTemplate edit

Summary Improve configure's handling of deprecated and removed JQuery plugins.
ReportedBy GeorgeClark
Codebase trunk
SVN Range
AppliesTo Engine
Component JQueryPlugin, configure
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:a5d97d8cb2ee distro:2f4300783525
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:2f4300783525
Release01x01Checkins distro:a5d97d8cb2ee
Topic revision: r10 - 05 Jul 2015, GeorgeClark - This page was cached on 31 May 2016 - 04:03.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License