Disabling/enabling plugins

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Korvell
Posts: 93
Joined: Thu May 22, 2008 10:33 pm

Disabling/enabling plugins

Post by Korvell » Sat Apr 14, 2012 2:39 am

A feature that I find is very much missing in CMSimple is an option to disabling/enabling plugins without uninstalling/reinstalling them.

I like to play around with lots of plugins and sometimes of course they step on each others toes and to prevent that I usually uninstall the plugin. But it's becoming a hassle because in my testing environment I have to uninstall and reinstall plugins lots of times - including setting file permissions etc. every time.

I have came up with my own little solution for now: Editing the plugin loader code making it skip any plugin with a "#" at the start of the folder name and then I just have to rename a plugin folder to enable/disable it.

But it would be so much more convenient to be able to disable/enable plugins from the CMS system itself. How 'bout it?

- S. Korvell

PS: Hope I hit the right forum section...

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: Disabling/enabling plugins

Post by Gert » Sat Apr 14, 2012 8:55 am

Hello,

maybe we find a solution in the next version, we already have thought about sometimes, but other things was more important,

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Disabling/enabling plugins

Post by cmb » Sat Apr 14, 2012 4:40 pm

Hi Korvell, hi Gert,

quite a while ago Manu suggested basically the same. I suggested to use an FTP client to move the folders out of plugins/ and later move them back. Another solution (I would prefer this wherever possible) is to make such tests on a localhost (with Portable_XH that's even possible from an USB drive without any installation -- Windows only).

But OTOH a possibility to disable plugins completely from CMSimple's backend (without the need to use an FTP client) might be a nice addition (similar to the way that's handled by browsers regarding the plugins: activate/deactivate). This plugin management could even be handled by a separate plugin to keep the core small and the system modular (and to avoid the risk, that an inexperienced user disables a needed plugin inadvertently). The only necessary modification to the pluginloader would be to skip deactivated plugins. So it just has to agreed upon how deactivated plugins are marked. Renaming the plugin's folder is a simple solution, but to do this from PHP it would require write permissions for the folder. Perhaps an alternative is a determined file in each plugin's folder (say, .active) that just keeps a number (0/1) to signal the plugins activation. This way only this file would need write permissions.

Perhaps this plugin management can even be merged with the update availability check and some versioning information?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Disabling/enabling plugins

Post by Tata » Sat Apr 14, 2012 7:15 pm

I thought also about this. I work now on kind of Plugins Handbook. When it will be ready depends on time. But my intention is to have an installation with all installed plugins in a pages structure>
[code\h1 - Plugin name + basic description
h2 - Syntax exapmple
h2 - Demo[/code]
Now, that I have all plugins installed, I can't see them all in their drop-down list and it takes time to find the one, I actually make the page for. But anyway, some plugins may conflict with others. So the possibility to switch a plugin out/on would be really very smart.
I tried it by changing a name of a plugin to .plugin. And it seems to work. So I think about the Korvel's suggestion.

Plugin manager
  • function for reading and returning the list of installed plugins - regardless if they are visible or hidden (exceplt of system plugins, which must not be switched off)
  • check box for each plugin
  • function checking all checboxes and renaming all checked plugins to .plugins
or vice versa.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: Disabling/enabling plugins

Post by Gert » Mon Apr 16, 2012 9:02 am

Hallo,

I have played around a little bit and made a plugin "pluginmanager".

It only works wit some small changes in the index.php of pluginloader, so it is not a publishing, just an idea, how it could work. At first we must publish a new version of CMSimple_XH, with the new pluginloader.

The download contains:

- the pluginmanager plugin
- a new index.php of pluginloader
- the data file "disabled_plugins.txt" (needs writing permissions)

!!! JUST A TOY - use with caution !!! (for CMSimple_XH 1.5 or higher)

Download: http://www.ge-webdesign.de/cmsimple/dlc ... php?id=376

So we could have (beside filebrowser and pagemanager) a pluginmanager,

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Disabling/enabling plugins

Post by cmb » Mon Apr 16, 2012 12:23 pm

Hi Gert,

that's very nice! :) Particularly I like the idea to store the disabled plugins in a single file in the plugins/ folder.

One thing to consider: perhaps it's better to avoid loading any plugin files at all (so possible conflicts can be checked), if the plugin is disabled. I've made a quick draft of this: http://3-magi.net/downloads/disabled_plugins.zip.

@all: This is a DEV version for demonstration purposes only. Do not use it in an production environment!

To hide the plugin menu entry of disabled plugins, change line 402 in cmsimple/cms.php:

Code: Select all

        if (strpos($plugin, '.') === false && file_exists($pth['folder']['plugins'] . $plugin . '/admin.php')  && !stristr($disabled_plugins, $plugin)) { 
Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: Disabling/enabling plugins

Post by Gert » Mon Apr 16, 2012 12:37 pm

cmb wrote:To hide the plugin menu entry of disabled plugins, change line 402 in cmsimple/cms.php:
I know, but:

1. I did not want to change a further file (cms.php)

2. I want to see all installed Plugins in the plugins admin menu. Now a hint appears, if you choose a plugin and the plugin is disabled, with a link to the PluginManager.

A new download is online under the same link:

Download: http://www.ge-webdesign.de/cmsimple/dlc ... php?id=376

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Disabling/enabling plugins

Post by cmb » Mon Apr 16, 2012 1:06 pm

Hi Gert,
Gert wrote:I know, but:

1. I did not want to change a further file (cms.php)

2. I want to see all installed Plugins in the plugins admin menu. Now a hint appears, if you choose a plugin and the plugin is disabled, with a link to the PluginManager.
Okay. :|

But I would like to suggest two changes:
  • Avoiding the inclusion of the required_classes, if the plugin is disabled (line 232)
  • using $pth['folder']['plugins'] in line 95 and 97 (currently it doesn't work for subsites/second languages)
Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: Disabling/enabling plugins

Post by Gert » Mon Apr 16, 2012 1:17 pm

cmb wrote:But I would like to suggest two changes:

* Avoiding the inclusion of the required_classes, if the plugin is disabled (line 232)
* using $pth['folder']['plugins'] in line 95 and 97 (currently it doesn't work for subsites/second languages)
The plugin is NOT READY :!:

I know, what I have to do to make it working multilingual and in Subsites, there also will be language files in the future and a message, if the data file is not writable and so on ... ;)

It's just a Demo to find out, if someone likes it, and if it makes sense to finish the plugin. If we add it to the next version, we also can change something in the cms.php, in my dev installation the disabled plugins are a little bit darker and smaller in the admin menu of plugins,

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: Disabling/enabling plugins

Post by Gert » Tue Apr 17, 2012 2:43 pm

Hello,

Pluginmanager_XH beta02 is available for download.

The beta01 was a toy and a demo, beta02 is for testing purposes.

!!! FOR TESTING PURPOSES ONLY - use with caution !!! (for CMSimple_XH 1.5.3 only)

Download: http://www.ge-webdesign.de/cmsimple/dlc ... php?id=376

Pluginmanager_XH beta02 contains a modified cms.php, to identify disabled plugins in the admin menu "Plugins".

Please test at first, if there are any problems with only the modified cms.php and index.php of pluginloader (without the plugin "pluginmanager" and without the data file "disabled_plugins.txt").

Pluginmanager_XH beta02 works in second languages and subsites, speaks en, de and default, and there are some improvements of the backend and some new messages,

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services

Post Reply