Open 0xNath opened 5 months ago
I think I confirmed the issue in the generation of the "web" directory when the marketplace folder is moved outside the GLPI folder.
The relevant code:
public static function getWebDir(string $plugin_key = "", $full = true, $use_url_base = false)
{
/** @var array $CFG_GLPI */
global $CFG_GLPI;
$directory = self::getPhpDir($plugin_key, false);
if ($directory === false) {
return false;
}
$directory = ltrim($directory, '/\\');
if ($full) {
$root = $use_url_base ? $CFG_GLPI['url_base'] : $CFG_GLPI["root_doc"];
$directory = "$root/$directory";
}
return str_replace('\\', '/', $directory);
}
I think the best solution is to always serve marketplace plugins through the /marketplace
path and proxy the requests to the actual marketplace location. So, calls to Plugin::getWebDir
would always return something like http://glpi.bazaar.test/marketplace/glpiinventory
while Plugin::getPhpDir
returns /var/lib/glpi/marketplace/glpiinventory
.
Hi,
This is indeed a limitation.
We will be able to remove this limitation in GLPI 11.0, as the usage of the public/index.php
router will be mandatory. Indeed, the router will be able to serve the plugin files, wherever they are located on the filesystem. It was not possible to do this in GLPI 10.0 as the usage of this router is still optional.
I keep this issue opened, as a reminder that we should work on it for GLPI 11.0.
I forget to say that we will be able to remove this limitation when plgin files will no longer have to include the inc/includes.php
file (will be done in #17213). Indeed, as long as this include exists, moving the files in another directory will broke this instruction, unless, maybe, if GLPI is added to the PHP include path, and that is not a common installation.
Code of Conduct
Is there an existing issue for this?
Version
10.0.15 and up to date 10.0.16-dev
Bug description
When using a custom folder location for the marketplace folder, the URL returned by the server looks something like that :
This issue was already reported in the issue 9074 as well as on the forums : https://forum.glpi-project.org/viewtopic.php?id=281140
Relevant log output
No response
Page URL
No response
Steps To reproduce
Your GLPI setup information
Informations sur le système, l'installation et la configuration
Server
GLPI constants
Libraries
SQL replicas
Notifications
Plugins list
Anything else?
I have not looked into the issue yet, so I don't know if this is a plugin issue, or a GLPI issue or both. I'll try to look into it and propose fix for GLPI and the repo plugins if possible.