GetSimple Support Forum

Full Version: A disabled plugin MUST NOT be loaded!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
@ccagle8:

The GS 3.0 approach of disabling plugins does only work in some limited cases. It seems that only the hooks are disabled but the plugins are still loaded. This leads to several problems:
  • Some plugins do checks when they are loaded, which cause problems on some systems. Disabling the plugin does not remove the problems
  • Templates might still call the functions (as the plugins are loaded) - the user might get no error message but wonders why the output is wrong. E.g. I18N will still output the navigation, but it will never be updated because the savechanges hook is never called.
  • Plugins check for the existance of other plugins, e.g. the I18N plugin, by checking if a function exists. It does exist, but the plugin might return invalid results or even produce errors (see above)
  • Users don't always report they have disabled plugins, as they expect (rightly) that a disabled plugin does not influence the system - thus it is much harder to find some errors.

I like the idea of disabling plugins and it would simplify testing with/without I18N plugin immensely, if it worked correctly: If a plugin is disabled, it MUST NOT be loaded.
Unfortunately the system as it is must read each file to get the plugin information, name etc...

And yes your right if its disabled it shouldn't load or do any function related to the plugin itself.

Leave it with me for for a bit, I'll come up with something....

Mike...
n00dles101 Wrote:Unfortunately the system as it is must read each file to get the plugin information, name etc...

Yes, I agree, thus a plugin is initially enabled.
But as the plugin rules say that the plugin name is the same as its filename there is no need to read it again, once it is disabled.

You can cache the plugin information in an XML.
Or - I suppose - you can read all plugins when displaying the plugin list, it shouldn't do any harm. But don't load the plugins at any other time.
Ok fixed it in the latest SVN.

As were reading in the file to get all relevant information on the plugin I've had to change the plugin Management screen to just display the Filename and "Disabled Plugin"

FYI the code chage is line 44 of plugin_fucntions.php to the following:

Code:
foreach ($live_plugins as $file=>$en) {
  $pluginsLoaded=true;
  if ($en=='true' && file_exists(GSPLUGINPATH . $file)){
      require_once(GSPLUGINPATH . $file);
  } else {
      register_plugin( pathinfo_filename($file), $file, '', 'Unknown', '', 'Disabled Plugin', '', '');
  }
}