I can't disable the module, because module page says that "Feeds is currently using this module for one or more importers", but the feed importer (never used and disabled) it's a default one, so i cannot delete it. I would like not to disable the feed module, so is there a better way to disable this module.

Thanks in advanced

Comments

megachriz’s picture

Title: disable module » Modules that define both an importer and a plugin can not be disabled
Project: Ubercart Addresses » Feeds
Version: 7.x-1.0-beta1 » 7.x-2.x-dev
Component: Miscellaneous » Code
Assigned: Unassigned » megachriz
Category: Support request » Bug report
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new681 bytes

Well that's an interesting bug! :D By having both a Feeds importer and a Feeds plugin (the Ubercart Addresses processor) Ubercart Addresses now gets a dependency on itself when Feeds is enabled!

It's actually a bug in Feeds, so I move this issue to that project. I even helped with the piece that introduced this bug :$, see #2379407: Make module required if plugins are in use..

To clarify the issue: the dev version of Feeds checks if plugins provided by modules are in use by importers and if so, it makes the module that provides the plugin required so it can't be disabled. This helps to prevent missing plugin warnings. In this process it doesn't take in account that these importers could be provided by the same module that provided the plugin.

The attached patch skips the plugin usage check for importers that are defined in code. This should fix the problem, though it partly undoes #2379407: Make module required if plugins are in use..

twistor’s picture

Status: Needs review » Needs work

Can't we check the provider information from FeedsPlugin::getDefinition() and check if it's the same as the current module?

megachriz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.62 KB
new1.71 KB

This patch checks per importer that is defined in code by which module that it is defined. Whether or not that importer uses a plugin defined by the same module is not checked (and shouldn't be). The module in question shouldn't be marked as required via an importer from itself. If an other importer - that is not defined by that module - uses a plugin of that module, the module gets marked as required as yet. Thus if a module has an importer that uses a Feeds plugin from itself becomes irrelevant.

Let me illustrate the process with an example. Say we have the following modules that define plugins and importers:

Module Plugin Importer Requires
Foo FooParser FooImporter:
  • Fetcher: HTTPFetcher
  • Parser: FooParser
  • Processor: NodeProcessor
None
Bar BarProcessor BarImporter:
  • Fetcher: HTTPFetcher
  • Parser: CSVParser
  • Processor: BarProcessor
None
Qux QuxParser QuxImporter:
  • Fetcher: HTTPFetcher
  • Parser: QuxParser
  • Processor: BarProcessor
Bar

Drupal invokes hook_system_info_alter() for each module on the system. When this hook is invoked for the Foo module, Feeds will do the following per importer:

  • FooImporter: notices this importer is defined by Foo, skips further plugin checks.
  • BarImporter: checks the plugins, notices it doesn't use Feeds plugins from Foo.
  • QuxImporter: checks the plugins, notices it doesn't use Feeds plugins from Foo.

So the Foo module is allowed to be disabled.

Let's check the same for the Bar module:

  • FooImporter: checks the plugins, notices it doesn't use Feeds plugins from Bar.
  • BarImporter: notices this importer is defined by Bar, skips further plugin checks.
  • QuxImporter: checks the plugins, notices it does use a Feeds plugin from Bar. Bar is set as required.

So the Bar module is NOT allowed to be disabled. You see here that the fact that the Bar module also defines an importer that uses a Bar plugin is not relevant, Bar becomes required because of the QuxImporter.

And finally, this are the checks for the Qux module.

  • FooImporter: checks the plugins, notices it doesn't use Feeds plugins from Qux.
  • BarImporter: checks the plugins, notices it doesn't use Feeds plugins from Qux.
  • QuxImporter: notices this importer is defined by Qux, skips further plugin checks.

So the Qux module is allowed to be disabled.

This illustrates that:

  • if a Feeds plugin is only used by the module that defines it, the provider module can be disabled (see the Foo module from the example).
  • if a Feeds plugin is used by an other module, the provider module can NOT be disabled (see the Bar module from the example).

I think this patch is ready and correctly fixes the problem without undoing anything from #2379407: Make module required if plugins are in use..
In the patch I also removed the ending dot from the explanation messages because the other "Required by" strings don't end in a dot either, note that the Field module also doesn't end the explanation messages with a dot.

  • twistor committed 2d388ad on 7.x-2.x authored by MegaChriz
    Issue #2488036 by MegaChriz, orannezelehcim: Modules that define both an...
twistor’s picture

Assigned: megachriz » Unassigned
Status: Needs review » Fixed

That makes sense.

Just moved the comment up a bit to cover the whole part of the relevant code.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

pikot’s picture

Hi, I have applied the patch and the message "Feeds is currently using this module for one or more importers" still it appears, and I can't uninstall the module.

pikot’s picture

Status: Closed (fixed) » Active
megachriz’s picture

Status: Active » Closed (fixed)

@pikot
The patch in question is already committed. If you cannot disable/uninstall a module, then you must have importers in use that make use of a plugin provided by that module. Delete the importers in question (or change fetcher, parser or processor of these importers) and try again. If you are sure that there is a bug, please carefully read #3 of this issue first to ensure the same thing applies in your situation: importer + plugin are provided by the same module. If your situation is different, please open a new issue and explain what the bug is.

pikot’s picture

@MegaChriz
Thanks! I changed the parser and I have been able to disable the module.