Closed (fixed)
Project:
Diff
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
15 Sep 2016 at 00:28 UTC
Updated:
25 Oct 2016 at 11:34 UTC
Jump to comment: Most recent, Most recent file
The HTML Diff plugin is now removed if requirements are not met.
In this case hook_requirements displays an error.
If someonen doesn't want to have this plugin and doesn't want to install its dependencies, the error is staying persistently.
The problem is, the plugin is hidden in UI, so a user can't disable it.
If we would still list it in the admin UI and allow enable / disable, we could only do the requirements check if it is enabled.
Alternatively we could move it into a submodule. But this makes it no more our recommended default without installing an additional module.
Discuss what is the best approach..
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | interdiff-2800319-22-31.txt | 5.27 KB | johnchque |
| #31 | sticky_requirements-2800319-31.patch | 4.61 KB | johnchque |
| #22 | interdiff-2800319-20-22.txt | 1.05 KB | johnchque |
| #22 | sticky_requirements-2800319-22.patch | 3.87 KB | johnchque |
| #20 | interdiff-2800319-17-20.txt | 1.65 KB | johnchque |
Comments
Comment #2
berdirDiscussed with miro.
1. If enabled and missing, show as error. If not enabled, make it a blue info message. "you could also use this awesome thing"
2. We need to make configuration on install dynamic as well. If it's not there, we must not enable it, so needs a hook_install() check, call getDefinition(), only then update config for it.
Comment #3
ziaoul commentedHi Berdir
I have same error.
Diff Not found
The HTML Diff layout requires the HtmlDiffAdvanced library. Please consult README.txt for installation instructions.
What is your advice?
Comment #4
miro_dietiker@ziaoul once this issue is fixed as Berdir describes, the error will go away. You will need to update code then.
Comment #5
johnchqueComment #6
johnchqueThis should fix it. :)
Comment #7
miro_dietikerWording is not really true: The HtmlDiffAdvanced is only a dependency if it is enabled.
Comment #8
miro_dietikerComment #9
johnchqueBetter to have it like this then?
Comment #10
miro_dietikerYeah. Since this is the case for a user without proper dependencies resolved, such as someone installing diff without reading the readme or without using composer, i like to assert it. Simply disable the plugin and assert the requirement info.
Add a comment here, like "Disable Visual Inline layout if library not found."
Comment #11
johnchqueThis should be better.
Comment #13
johnchqueWhat about now?
Comment #15
johnchqueHmm, what about this?
Comment #17
johnchqueLet's see what is happening there.
Comment #19
miro_dietikerAn example to simplify testing this is how ProcessorTest.php from inmail does:
Comment #20
johnchqueNow should be better, this time with tests.
Comment #22
johnchqueSorry, my bad.
Comment #23
echoz commentedDrupal core 8.1.9
applied #22 patch on dev from 9/21, composer not installed.
After running update, on the Diff settings screen, Notices for both split_fields + unified_fields:
Undefined index: split_fields in Drupal\diff\Form\GeneralSettingsForm->buildForm() (line 95 of /PATH_TO/modules/diff/src/Form/GeneralSettingsForm.php).
(same for unified_fields)
These were unchecked in settings, and checking both made the notices go away. Once notices disappeared, the settings could be saved with these unchecked, but viewing a diff results in a Symfony\Component\Routing\Exception\InvalidParameterException.
Enabling both or just split fields seems to work. Enabling just unified_fields results in more errors I'm not going to track here now, hopefully this is helpful. Thanks for working on this.
Comment #24
johnchqueThank you @echoz but the problem you report is more related with #2801889: Parameter "filter" for route "diff.revisions_diff" must match... crash which has a patch uploaded that solves the issue, would be really helpful to test it and see if the problem you report is fixed. :)
Comment #25
miro_dietikerWhy wrap the function in another one?
Comment #26
johnchqueBecause that's how inmail fix the tests. :)
Comment #27
johnchqueComment #28
echoz commentedSince #2801889: Parameter "filter" for route "diff.revisions_diff" must match... crash was committed to dev 9/22, I patched it with your #22 patch that still applies, but just going to the Extend screen results in a white screen.
PHP Fatal error: Class 'Drupal\diff\DiffBreadcrumbBuilder' not found in /PATH_TO/core/lib/Drupal/Component/DependencyInjection/Container.php on line 296
Comment #29
johnchqueCan you check clearing caches? There is not a DiffBreadcrumbBuilder since before alpha5. Don't think my change is related.
Comment #30
berdirwhy the helper function? I don't think this is re-usable?
I'd just keep it one function.
wouldn't it be better to do the opposite, and enable if it is present?
I'm not 100% sure but I think right now with no $phase check in hook_requirements(), the only reason you even get past the install time check is because the requirements hook is incorrectly defined in the .module file and not in .intall.
Try moving it there and try to install it, I suspect it will then fail.
Comment #31
johnchqueAs discussed, this should be better. :)
Comment #32
echoz commentedThanks @yongt9412, your comment in #29 helped me realize I should uninstall alpha4 first. Patched dev from 9/24 with patch from #31. Installed smoothly. the default settings work.
Choosing Unified OR setting Unified as the only layout does show the layout but with:
Warning: Illegal string offset 'data' in Drupal\diff\Plugin\diff\Layout\UnifiedFieldsDiffLayout->build() (line 177 of /PATH_TO/modules/diff/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php).
Also repeated for line 178.
Setting Split fields as the only layout works.
and unchecking both should not be possible, when comparing, it results in:
Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "filter" for route "diff.revisions_diff" must match "[^/]++" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 193 of /PATH_TO/core/lib/Drupal/Core/Routing/UrlGenerator.php).
Comment #33
berdirYou do not need to uninstall and re-install, just clear the cache. But doesn't matter now.
Those problems have nothing to do with this issue. The first one has an existing issue, please create a new one if you can't find one about the second problem.
This looks fine to me now.
Comment #35
miro_dietikerCommitted.
Comment #36
lionel.aubert commentedHello everybody,
I am sorry to come back on this fixed bug, but for me, it is not fixed : I am kind of newbie and I don't know how to patch your patch file (the #22 AND the #31 or only the last one, #31 ?) in my website (not in local).
My website is still out of order. When I go to the update.php page, it's written : "Requirements problem" and I cannot go on.
Thanks for your ideas :-)
Comment #37
johnchque@lionel.aubert if you are using the last dev version the problem should be gone by now.
Comment #38
lionel.aubert commented@yongt9412 that's it, thanks a lot !!!