Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-03-23 13:23:40

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,207

Situation around plugin (de-)activation in preferences

Currently I’m troubleshooting some things with active/inactive plugins and notice that—though plugins are de-activated in preferences—I’m getting a list of active plugins displayed in Diagnostics. This is not helpful because

  1. It’s not true, they’re activated, at best
  2. Reading this is irritating/misleading while in the troubleshooting process, not only for less proficient Textpatterners
  3. It brings wrong information to the forum for getting troubleshooting help

Now, while plugins are de-activated via prefs, you’re not informed about this situation in the plugins panel. Usually plugins will be de-activated/re-activated there, so if you forget about your previous proceedings in the preferences and then look after “not working” plugins, you’ll go to the Plugins panel and see: “Yes, the darn things are active. So why doesn’t it work?” An indicator could help here, informing that plugin use is turned off generally or turned off for admin side plugins.

Which brings me back to the preferences for admin side plugins: In my understanding, this setting might be invisible or greyed out with “Allow plugins” set to No. That would make the situation there a little more self-explaining/less error prone.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#2 2018-03-23 13:32:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: Situation around plugin (de-)activation in preferences

Umm, wot?

How do you deactivate a plugin from the Preferences panel? You can only activate and deactivate them from the Plugins panel (or from ied_plugin_composer, but that’s broken right now for 4.7.0).

When a plugin is deactivated it’s prefs should disappear from the Preferences panel. I’ve broken smd_article_stats in recent commits so I need to fix that. But on the whole, plugin prefs should only be active if the plugin is active as dictated by the Yes/No on the Plugins panel.

EDIT: Hang on, just got what you’re talking about.. the global admin-side plugins on/off toggle in prefs. Sorry. Let me investigate!

Last edited by Bloke (2018-03-23 13:33:29)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2018-03-23 13:34:33

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,207

Re: Situation around plugin (de-)activation in preferences

I mean the general use of plugins, on the tab “Publish”.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2018-03-23 13:35:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: Situation around plugin (de-)activation in preferences

Yeah, got it sorry. I was being dim. Investigation in progress…


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2018-03-23 13:41:18

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,207

Re: Situation around plugin (de-)activation in preferences

Bloke wrote #310267:

You can only activate and deactivate them from the Plugins panel

So much about my remark “Usually plugins will be de-activated/re-activated there” ;)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2018-03-23 13:44:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: Situation around plugin (de-)activation in preferences

Yeah, I didn’t read properly. Mea culpa.

I’ve just been a little confused by the options actually:

Use plugins? really should read Use public-side plugins? because it only seems to affect those on the main site. Admin plugins still continue to run unless you turn off the Use admin-side plugins? toggle.

In either case, the Diagnostics panel should act accordingly. I’ll get it to take those settings into account. Thanks for the report.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2018-03-23 13:49:41

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,207

Re: Situation around plugin (de-)activation in preferences

Thanks! What do you think about the two other last point?

  • An indicator in Plugins panel informing on deactivated plugins (Admin/Public) turned off from the prefs panel
  • Not listing active plugins in Diagnostics as long as plugins are deactivated globally

Edited because … see below

Last edited by uli (2018-03-23 13:53:03)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#8 2018-03-23 13:52:15

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,207

Re: Situation around plugin (de-)activation in preferences

Bloke wrote #310271:

In either case, the Diagnostics panel should act accordingly.

Ah, missed that one.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2018-03-23 14:01:18

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,207

Re: Situation around plugin (de-)activation in preferences

I/me wrote #310270:

So much about my remark “Usually plugins will be de-activated/re-activated there” ;)

Bloke wrote #310271:

Yeah, I didn’t read properly. Mea culpa.

No, didn’t want to underline any misunderstandings. I just see your line “You can only activate and deactivate them from the Plugins panel” as a proof for my theory that the Plugins panel is THE place for deactivating plugins, and hence there is a need for a hint on the Plugins panel informing on the global deactivation of plugins done from the prefs when that setting makes the use of plugins impossible.

Hm, have I been clear enough here?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#10 2018-03-23 15:22:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: Situation around plugin (de-)activation in preferences

uli wrote #310274:

there is a need for a hint on the Plugins panel informing on the global deactivation of plugins done from the prefs when that setting makes the use of plugins impossible.

Yes, you’re right. We have the following options:

  • Some kind of banner or something on the Plugins panel that admin plugins, or public plugins, or both are deactivated globally.
  • An indicator alongside each plugin to show that plugins of this type are deactivated globally.
  • Some kind of other indicator for each plugin (dimmed? strikethrough?) that such plugins are not currently enabled globally (as distinct from still being enabled individually).
  • An indication of the plugin’s type via another column in the table. A possible option would be to indicate the global status here, maybe?

Not exactly sure how best to show this. Any better ideas?

The problem is compounded by the fact we technically have 6 “types” of plugin. And they’re (annoyingly) not easily accumulable in terms of internal representation.

To the layperson, we have “public” and “admin” but for plugin authors (and people debugging things) the full range of types is something that is potentially very useful information. Perhaps we should add that to the list of plugins on Diagnostics, alongside the (m) marker? I’ll probably do that.

Anyway, one thing that’s been bubbling away at the back of my mind for ages is that our plugins type designators are, quite frankly, crap. Here’s what we have:

  • 0 = public : only on the public side of the website (default)
  • 1 = public+admin : on both the public and admin side
  • 2 = library : only when include_plugin() or require_plugin() is called
  • 3 = admin : only on the admin side (no AJAX)
  • 4 = admin+ajax : only on the admin side (AJAX supported)
  • 5 = public+admin+ajax : on both the public and admin side (AJAX supported)

In terms of programming, that means an activated “admin-side” plugin is loaded:

a) On the public-side, unless it’s designated admin-only (type 3).
b) On the admin-side for regular panel actions.
c) On the admin-side for AJAX calls if it’s of type 4 or 5.
d) AND only check a, b, and c conditions if the Use admin-side plugins pref is set.

An activated public-side plugin is loaded:

a) On the public-side if its type is unset or 0.
b) On the public-side if its type is 5.
c) AND only check a and b conditions if the Use plugins flag pref is set.

Activated library plugins are never loaded autoamtically, only when explicitly called by other plugins.

What a mess!

We really need to unpick all this and introduce proper type flags, for example:

define('PLUGIN_TYPE_PUBLIC', 0x0008);
define('PLUGIN_TYPE_ADMIN', 0x0010);
define('PLUGIN_TYPE_LIBRARY', 0x0020);
define('PLUGIN_HAS_AJAX', 0x0040);

That system has the following properties:

  • No need for explicit values for each type combination, meaning fewer overall values.
  • Combinations can be specified more intuitively, e.g. PLUGIN_TYPE_PUBLIC | PLUGIN_TYPE_ADMIN | PLUGIN_HAS_AJAX means a public-side and admin-side plugin with Ajax support, equivalent to our current type ‘5’. Easy
  • All values are opt-in (unlike the current ‘public’ flag, which is 0 and can’t therefore be implied).
  • Much easier to parse and apply in code using bitwise operators.
  • The numbers are higher than the highest current value we have, which allows for a migration path from “crappy type numbers” to “proper flags” :-)

The trick is to figure out how to map the current system to the flags. If it’s not too much hassle, I might just do that now. If I put a translation function in place in our new Plugin class, that should suffice to make it backwards compatible but allow us to start using the new flags from 4.7.0. And, crucially, it’ll make it a truckload easier to filter them out by type on the Diagnostics panel.

Phew!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB