Patch #31110

Raise an exception if the plugin directory name differs from the plugin id

Added by Mizuki ISHIKAWA 4 months ago. Updated 3 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Plugin API
Target version:4.1.0

Description

If the plugin directory name and the plugin id are not the same, the plugin will not work because the required files will not be read.


Example:

If you change the directory name of redmine_vividtone_my_page_blocks plugin to redmine-vividtone-my-page-blocks, the following log will be output and it will not work well.

Partial "my/blocks/new_issues" missing for block "new_issues" found in admin (id=1) preferences
Partial "my/blocks/neglected_issues" missing for block "neglected_issues" found in admin (id=1) preferences
Partial "my/blocks/doing_issues" missing for block "doing_issues" found in admin (id=1) preferences

The problem is hard to solve because you can not notice that the wrong directory name is the cause of the problem.


I think I should raise an exception if there is no directory with the same name as the plugin id.
I attached a patch for that.

0001-Fix-test-not-to-raise-exception.patch Magnifier (9.91 KB) Mizuki ISHIKAWA, 2019-03-28 08:08

0002-Change-to-raise-an-exception.patch Magnifier (1.75 KB) Mizuki ISHIKAWA, 2019-03-28 08:08

0002-Change-to-raise-an-exception-v2.patch Magnifier (1.83 KB) Mizuki ISHIKAWA, 2019-04-09 03:28


Related issues

Related to Redmine - Feature #31538: Allow a plugin to be installed in the directory different... New

Associated revisions

Revision 18063
Added by Go MAEDA 3 months ago

Fix plugins test to use correct plugin name and directory (#31110).

Patch by Mizuki ISHIKAWA.

Revision 18064
Added by Go MAEDA 3 months ago

Raise an exception if the plugin directory name differs from the plugin id (#31110).

Patch by Mizuki ISHIKAWA.

Revision 18065
Added by Go MAEDA 3 months ago

Add a plugin for test (#31110).

Revision 18152
Added by Go MAEDA 2 months ago

Fix a failing test (#31110).

PluginTest fails if Redmine is cloned from GitHub because Git ignores the empty other_plugin directory.

This file had to be committed in r18063.

History

#1 Updated by Mizuki ISHIKAWA 4 months ago

I forgot to attach a patch:)

#2 Updated by Go MAEDA 4 months ago

  • Target version set to Candidate for next major release

Thank you for posting the patch. I think it would be even better if the exception has a more informative message like the following. With this message, an admin easily understands that he should rename the directory.

Plugin not found. The plugin #{p.id} should be installed in #{p.directory}.

#3 Updated by Go MAEDA 4 months ago

  • Target version changed from Candidate for next major release to 4.1.0

#4 Updated by Mizuki ISHIKAWA 3 months ago

I corrected the error message to include the directory name.

#5 Updated by Akiko Takano 3 months ago

+1 Nice work, quite helpful!

#6 Updated by Go MAEDA 3 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patches. Thank you for your contribution.

#7 Updated by Go MAEDA about 1 month ago

  • Related to Feature #31538: Allow a plugin to be installed in the directory different from the plugin id added

Also available in: Atom PDF