mwltr / ext-magento2-mwltr-filesystem-filedriver
Dummy Module
Installs: 6 950
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 3
Forks: 2
Open Issues: 0
Type:magento2-module
Requires
- php: ~7.0.0|~7.1.0|~7.2.0
- magento/framework: ~100.0|~101.0
This package is auto-updated.
Last update: 2024-12-22 00:49:39 UTC
README
This module replaces the class
\Magento\Framework\Filesystem\Driver\File
to provide a correct implementation
for the getRelativePath method.
Prerequisites
You only need this module if you plan on having magento module sources outside of the Magento root.
Implementation
The overwrite can be found in \Mwltr\FilesystemFileDriver\Filesystem\FileDriver
.
The actual implementation of the relative path caclulation can be found in
\Mwltr\FilesystemFileDriver\Helper\RelativePathHelper
.
To exchange the \Magento\Framework\Filesystem\Driver\File
an di.xml defintion won't work,
since the DriverPool is defined in \Magento\Framework\App\Bootstrap::createFilesystemDriverPool
.
There is a way to add additional parameters to the DriverPool, by setting an array field with key
Magento\Framework\App\Bootstrap::INIT_PARAM_FILESYSTEM_DRIVERS
in the $_SERVER
.
This module does that in the registration.php, since the registration.php is included during the whole composer autoload inclusion.
$_SERVER[\Magento\Framework\App\Bootstrap::INIT_PARAM_FILESYSTEM_DRIVERS] = [ 'file' => \Mwltr\FilesystemFileDriver\Filesystem\FileDriver::class, ];