In the same way that Drupal provides a way to select where the temporary directory is located, there should be a way to configure a user-selectable external library directory.
Several modules require the user to download and install external libraries (all the WYSIWYG modules, the PDF libraries of the print module, etc. etc). With the lack of an 'official' directory, most module authors require the libs to be installed inside the module directory.
On some cases, the same library may be used by multiple modules, requiring the user to install multiple copies of the same library.
If users update their modules by first deleting the existing copy, this forces them to move the external libraries out of the way and to place them again in the module directory after the update.
Also of note, at least in the case of Acquia Drupal, it monitors the integrity of the Drupal directory, but since the user must manually place the external library in this directory, the integrity monitoring complains about it.
The proposal is to add a drupal_get_ext_path() function that simply returns the value of a new variable for the external library directory (this variable would be set in admin/settings/file-system).
This way, module authors would simply request the value of this configuration and use this as the base path of the library location instead of assuming that it is installed inside the module directory.
A more complicated possibility would be to add a new type to the drupal_get_filename() function ("external_lib") and to search inside the configured directory for the name provided in the function call.
I can implement this function easily, but I would like to know if others believe it to be interesting.
João Ventura
Comments
Comment #1
rsvelko commentedelsewhere you said you don't believe it will be accepted before drupal 8 - have you talked with someone that made you think so?
I happen to remember how people are doing things with jquery plugins - they maintain a module that is a jquery plugin manager (don't remember exact name - there was more than 1 - use google ...)..
So maybe a good idea would be to have a module that will manage 3rd party libs in its folder (or in a settable external folder maybe)... but leaving the folder aside I think it will be a +1 if we had a manager like that - checking for versions of libs optionally or just storing them in its folder ....
I have noticed that it is easier and faseter to solve a problem in contrib area and then when mature and if suitable it goes to core...
Apropos - googled for "drupal external manager module" and also tried drupal.org's search - nothing so far... If there are people thinking about this - please let them know ...
On the drush frontline we will come to the point that drush will be able to auto update modules with 3rd party plugins I hope and then this central repo/manager module will be less important but still - it is not nice either to maintain (albeit easily) several copies of the same files or to rely that everyone uses drush and bash ...
Comment #2
sunIt's not that easy.
http://drupal.org/project/libraries takes on this challenge. Only if we find a valid solution there, we can start to think about core.
Until then, this won't fix.