Use relative paths for function js() #93
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
New Feature Submissions:
Description
We have a composer based installation of kanboard and your plugin Wiki. The plugins are stored inside vendor folder (because composer does it) and symlinked in /vendor/kanboard/kanboard/plugins/.
The class WikiHelper.php tries to generate an absolute path which doesn't work in such environments, because the plugin is stored in /var/www/app_kanboard/vendor/funktechno/kanboard-plugin-wiki and not /var/www/app_kanboard/vendor/funktechno/Wiki. See warning:
Warning: filemtime(): stat failed for /var/www/app_kanboard/vendor/funktechno//Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js in /var/www/app_kanboard/vendor/funktechno/kanboard-plugin-wiki/Helper/WikiHelper.php on line 42
Warning: filemtime(): stat failed for /var/www/app_kanboard/vendor/funktechno//Wiki/Asset/Javascript/wiki.js in /var/www/app_kanboard/vendor/funktechno/kanboard-plugin-wiki/Helper/WikiHelper.php on line 42
You can fix this by adding another symlink from "Wiki" to "kanboard-plugin-wiki", but there is a better solution:
First, your code in
kanboard-plugin-wiki/Helper/WikiHelper.php
Line 41 in 12c5508
Second and most important: Absolute paths don't work in composer based installations. To fix this, relative paths should be used for including files. The same approach is used in the file /Plugin.php for example.
This pull request fixes this. It works in composer-based and non-composer-based installations.
Note 1: The problematic code was added lateley. There were no warnings in version 0.3.2.
Note 2: There already might be helpers in kanboard to include scripts. If so, they should be used instead.