Monorepo for rekalogika/file
and related packages.
rekalogika / file-src Goto Github PK
View Code? Open in Web Editor NEWHigh-level file abstraction library built on top of Flysystem
Home Page: https://rekalogika.dev/file
License: MIT License
High-level file abstraction library built on top of Flysystem
Home Page: https://rekalogika.dev/file
License: MIT License
Monorepo for rekalogika/file
and related packages.
We have a host system where open_basedir
restrictions are set.
The PHP scripts can only access the Webroot and /tmp
.
Now when creating a file (in this case via FromHttpFoundationFileAdapter::adapt
) we get an error.
Probably it's related to these lines:
file-src/packages/file/src/Repository/FilesystemRepository.php
Lines 56 to 63 in 9c9d257
FilesystemRepository::$localFilesystem
configurable.
This is the stack trace I got when creating a file:
[2024-02-23T21:50:25.593570+00:00] request.CRITICAL: Uncaught PHP Exception League\Flysystem\UnableToCreateDirectory: "Unable to create a directory at /. mkdir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/vhosts/example.net/:/tmp/)" at /var/www/vhosts/example.net/httpdocs/vendor/league/flysystem/src/UnableToCreateDirectory.php line 18 {"exception":"[object] (League\\Flysystem\\UnableToCreateDirectory(code: 0): Unable to create a directory at /. mkdir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/vhosts/example.net/:/tmp/) at /var/www/vhosts/example.net/httpdocs/vendor/league/flysystem/src/UnableToCreateDirectory.php:18)
[stacktrace]
#0 /var/www/vhosts/example.net/httpdocs/vendor/league/flysystem-local/LocalFilesystemAdapter.php(313): League\\Flysystem\\UnableToCreateDirectory::atLocation()
#1 /var/www/vhosts/example.net/httpdocs/vendor/league/flysystem-local/LocalFilesystemAdapter.php(97): League\\Flysystem\\Local\\LocalFilesystemAdapter->ensureDirectoryExists()
#2 /var/www/vhosts/example.net/httpdocs/vendor/league/flysystem-local/LocalFilesystemAdapter.php(87): League\\Flysystem\\Local\\LocalFilesystemAdapter->ensureRootDirectoryExists()
#3 /var/www/vhosts/example.net/httpdocs/vendor/rekalogika/file/src/Repository/FilesystemRepository.php(58): League\\Flysystem\\Local\\LocalFilesystemAdapter->__construct()
#4 /var/www/vhosts/example.net/httpdocs/vendor/rekalogika/file/src/File.php(78): Rekalogika\\File\\Repository\\FilesystemRepository::getLocalFilesystem()
#5 /var/www/vhosts/example.net/httpdocs/vendor/rekalogika/file-symfony-bridge/src/HttpFoundation/FromHttpFoundationFileAdapter.php(33): Rekalogika\\File\\File->__construct()
#6 /var/www/vhosts/example.net/httpdocs/vendor/rekalogika/file-symfony-bridge/src/HttpFoundation/FromHttpFoundationFileAdapter.php(43): Rekalogika\\File\\Bridge\\Symfony\\HttpFoundation\\FromHttpFoundationFileAdapter->__construct()
#7 /var/www/vhosts/example.net/httpdocs/src/Form/Application/FieldDefinition/FieldType/MediaFilePondType.php(94): Rekalogika\\File\\Bridge\\Symfony\\HttpFoundation\\FromHttpFoundationFileAdapter::adapt()
#8 /var/www/vhosts/example.net/httpdocs/vendor/symfony/event-dispatcher/EventDispatcher.php(220): App\\Form\\Application\\FieldDefinition\\FieldType\\MediaFilePondType->App\\Form\\Application\\FieldDefinition\\FieldType\\{closure}()
#9 /var/www/vhosts/example.net/httpdocs/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\\Component\\EventDispatcher\\EventDispatcher->callListeners()
#10 /var/www/vhosts/example.net/httpdocs/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php(30): Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch()
#11 /var/www/vhosts/example.net/httpdocs/vendor/symfony/form/Form.php(482): Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher->dispatch()
#12 /var/www/vhosts/example.net/httpdocs/vendor/symfony/form/Form.php(499): Symfony\\Component\\Form\\Form->submit()
#13 /var/www/vhosts/example.net/httpdocs/vendor/symfony/form/Form.php(499): Symfony\\Component\\Form\\Form->submit()
#14 /var/www/vhosts/example.net/httpdocs/vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php(110): Symfony\\Component\\Form\\Form->submit()
#15 /var/www/vhosts/example.net/httpdocs/vendor/symfony/form/Form.php(420): Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationRequestHandler->handleRequest()
#16 /var/www/vhosts/example.net/httpdocs/vendor/craue/formflow-bundle/Form/FormFlow.php(892): Symfony\\Component\\Form\\Form->handleRequest()
#17 /var/www/vhosts/example.net/httpdocs/src/Controller/ApplicationFormController.php(268): Craue\\FormFlowBundle\\Form\\FormFlow->isValid()
#18 /var/www/vhosts/example.net/httpdocs/src/Controller/ApplicationFormController.php(165): App\\Controller\\ApplicationFormController->getFormRenderResponse()
#19 /var/www/vhosts/example.net/httpdocs/vendor/symfony/http-kernel/HttpKernel.php(181): App\\Controller\\ApplicationFormController->detail()
#20 /var/www/vhosts/example.net/httpdocs/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
#21 /var/www/vhosts/example.net/httpdocs/vendor/symfony/http-kernel/Kernel.php(197): Symfony\\Component\\HttpKernel\\HttpKernel->handle()
#22 /var/www/vhosts/example.net/httpdocs/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Symfony\\Component\\HttpKernel\\Kernel->handle()
#23 /var/www/vhosts/example.net/httpdocs/vendor/autoload_runtime.php(29): Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner->run()
#24 /var/www/vhosts/example.net/httpdocs/public/index.php(5): require_once('...')
#25 {main}
"} []
Currently I'm getting the error:
Call to undefined method Intervention\\Image\\ImageManager::gd() at /var/www/vhosts/example.com/httpdocs/vendor/rekalogika/file-image/src/ImageResizer.php:69)
For me the installed version of intervention/image
is 2.4-dev
. Probably this is related to the following:
Some days ago you fixed the open_basedir
compatibility in fd60341
When I tried to install the fix I got the following error:
$ composer req 'rekalogika/file:^1.8.2'
./composer.json has been updated
Running composer update rekalogika/file
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires rekalogika/file ^1.8.2 -> satisfiable by rekalogika/file[1.8.2].
- rekalogika/file 1.8.2 requires rekalogika/file-contracts ^1.9 -> found rekalogika/file-contracts[dev-main, 1.9.x-dev (alias of dev-main)] but it does not match your minimum-stability.
Problem 2
- rekalogika/file 1.8.2 requires rekalogika/file-contracts ^1.9 -> found rekalogika/file-contracts[dev-main, 1.9.x-dev (alias of dev-main)] but it does not match your minimum-stability.
- rekalogika/file-filepond 1.8.0 requires rekalogika/file ^1.8 -> satisfiable by rekalogika/file[1.8.2].
- rekalogika/file-filepond is locked to version 1.8.0 and an update of this package was not requested.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
So I tried to set the minimum-stability to dev
and probably that's why I got that intervention/image
which may be causing that initial error.
Could you maybe please check and fix the dependencies of rekalogika/file
so I can install stable version 1.8.2?
Some more context: Actually I don't want to install rekalogika/file
itself but want with the following command
composer req 'rekalogika/file-association:^1.8.2' 'rekalogika/file-association-entity:^1.8.2' 'rekalogika/file-bundle:^1.8.2' 'rekalogika/file-filepond:^1.8.2'
which results in:
composer req 'rekalogika/file-association:^1.8.2' 'rekalogika/file-association-entit
y:^1.8.2' 'rekalogika/file-bundle:^1.8.2' 'rekalogika/file-filepond:^1.8.2' -W
./composer.json has been updated
Running composer update rekalogika/file-association rekalogika/file-association-entity rekalogika/file-bundle rekalogika/file-filepond --with-all-dependencies
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "6.3.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires rekalogika/file-association ^1.8.2 -> satisfiable by rekalogika/file-association[1.8.2].
- rekalogika/file-association 1.8.2 requires rekalogika/file-association-contracts ^1.9 -> found rekalogika/file-association-contracts[dev-main, 1.9.x-dev (alias of dev-main)] but it does not match your minimum-stability.
Problem 2
- Root composer.json requires rekalogika/file-association-entity ^1.8.2 -> satisfiable by rekalogika/file-association-entity[1.8.2].
- rekalogika/file-association-entity 1.8.2 requires rekalogika/file-contracts ^1.9 -> found rekalogika/file-contracts[dev-main, 1.9.x-dev (alias of dev-main)] but it does not match your minimum-stability.
Problem 3
- Root composer.json requires rekalogika/file-bundle ^1.8.2 -> satisfiable by rekalogika/file-bundle[1.8.2].
- rekalogika/file-bundle 1.8.2 requires rekalogika/file ^1.9 -> found rekalogika/file[dev-main, 1.9.x-dev (alias of dev-main)] but it does not match your minimum-stability.
Problem 4
- Root composer.json requires rekalogika/file-filepond ^1.8.2 -> satisfiable by rekalogika/file-filepond[1.8.2].
- rekalogika/file-filepond 1.8.2 requires rekalogika/file ^1.9 -> found rekalogika/file[dev-main, 1.9.x-dev (alias of dev-main)] but it does not match your minimum-stability.
When I delete an entity with an assigned file the file is deleted as expected. But on the local file system the folder structure to that file is kept. Maybe we should walk up the directory tree and delete empty folders until they're not empty anymore?
I was searching for a Symfony FormType providing a good way to integrate FilePond and found this - so much more than expected. On first sight it looks awesome! Thanks for providing this.
But I was asking myself why there is a separation between FilePondType
and FilePondCollectionType
? Actually it should be pretty much possible to have one Type which handles both, no?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.