exakat icon indicating copy to clipboard operation
exakat copied to clipboard

Can't use extensions with a Phar version of Exakat

Open spideyfusion opened this issue 6 years ago • 1 comments

Issue

It seems that the Phar version of Exakat can't load extensions from the ext folder. Looking at the code, it seems to come down to two issues:

  1. The extension folder location is constructed using the $this->config->dir_root property. Its value is going to be different depending on whether Exakat is running as a Phar installation or not:

    • https://github.com/exakat/exakat/blob/master/library/Exakat/Tasks/Extension.php#L48
    • https://github.com/exakat/exakat/blob/master/library/Exakat/Config.php#L60

    This will make Exakat look for extensions inside the Phar archive itself.

    I was able to confirm this behavior by setting the phar.readonly PHP configuration option to 1. With the option enabled, it was possible to persist changes inside archive using the extension install <name> and extension uninstall <name>. The ext folder I created beside the archive was left untouched.

  2. Even when I was able to make Exekat interact with the ext folder (see first issue), the extensions themselves still refused to load due to the way how the AutoloadExt class scans for them. The glob function doesn't support wrappers (in this case phar://):

    • https://github.com/exakat/exakat/blob/master/library/Autoload.php#L67

Steps to reproduce

mkdir ext
curl -o ext/Symfony.phar https://www.exakat.io/extensions/index.php?file=Symfony
docker run --rm -it -v $(pwd)/ext:/usr/src/exakat/ext exakat/exakat extension local

spideyfusion avatar Feb 03 '19 20:02 spideyfusion

@spideyfusion Thanks for the assessement of the situation. Indeed, the phar did skip the handling of the extensions, and, basically, couldn't handle them. It is being fixed ATM.

exakat avatar Feb 04 '19 20:02 exakat