Filesystem class
This class extends Flysystem Filesystem class to trigger events that joomla plugins can use to customise filesystem when they are loaded.
1. Usage
You may use this class to provide access to your custom adapter while allowing plugins to connect their own logic.
use JLoader::import('flysystem.library');
use Phproberto\Joomla\Flysystem\Filesystem;
use Phproberto\Joomla\Flysystem\Adapter\JoomlaFolder;
$moduleFiles = new Filesystem(new JoomlaFolder('modules/mod_menu'));
if ($moduleFiles->has('mod_menu.php'))
{
echo "The module entry point exists!";
}
2. Events
onFlysystemBeforeLoadFilesystem Called before an filesystem instance is created.
/**
* Triggered before filesystem has been loaded.
*
* @param Filesystem $filesystem Loaded environment
* @param AdapterInterface $adapter Loaded environment
* @param array $config Options to initialise environment
*
* @return void
*/
public function onFlysystemBeforeLoadFilesystem(Filesystem $filesystem, AdapterInterface &$adapter, &$config = null)
onFlysystemAfterLoadFilesystem Called after an filesystem instance has been created.
/**
* Triggered after filesystem has been loaded.
*
* @param Filesystem $filesystem Loaded environment
* @param AdapterInterface $adapter Loaded environment
* @param array $config Options to initialise environment
*
* @return void
*/
public function onFlysystemAfterLoadFilesystem(Filesystem $filesystem, AdapterInterface $adapter, $config = null)