helios-ag / FMElfinderBundle

:file_folder: ElFinderBundle provides ElFinder integration with TinyMCE, CKEditor, Summernote editors
MIT License
275 stars 128 forks source link

determine the vendor root dir based on the composer classloader #499

Closed mollux closed 1 year ago

mollux commented 1 year ago

When the vendor folder is not in the %kernel.project_dir%, the elfinder:install command fails:

./bin/console elfinder:install

elFinder Installer
==================

 // Trying to install elfinder to public directory

 ! [NOTE] Starting to install elfinder to /var/www/html/docroot/public/bundles/fmelfinder folder

In Filesystem.php line 544:

  The origin directory specified "/var/www/html/docroot/vendor/studio-42/elfinder/css" was not found.

This is typically the case when the vendor folder is outside of the webroot dir, which is from security point of view a best practice.

This PR ensures the vendor folder location is determined based on the composer classloader. This both works for application with the vendor inside and outside the webroot dir.

helios-ag commented 1 year ago

great, thank you!

escopecz commented 1 year ago

Is there any chance that this will be merged any time soon? It's complicating things on our side.

helios-ag commented 1 year ago

hi, sure

helios-ag commented 1 year ago

tagged as 12.3

zdebol commented 5 months ago

I have problem when vendor dir is example /var/www/some-name/vendor/some-hash-id and line $vendorRootDir = dirname($reflection->getFileName(), 3); return /var/www/some-name/vendor and concat with ELFINDER_CSS_DIR gives to /var/www/some-name/vendor/vendor/studio-42/elfinder/css and error in install. Change level in dirname to 4 return correct dir but this is not solution.