Skip to content

Commit

Permalink
determine the vendor root dir based on the composer classloader (#499)
Browse files Browse the repository at this point in the history
* determine the vendor root dir based on the composer classloader

* styleci fixes
  • Loading branch information
mollux authored May 10, 2023
1 parent 492b986 commit 735b9b0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Command/ElFinderInstallerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function configure(): void
<info>Where to install elfinder</info>
<info>php %command.full_name% --docroot=public_html</info>
EOF
);
);
}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand All @@ -61,12 +61,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$publicDir = sprintf('%s/%s/bundles/fmelfinder', $rootDir, $dr);

$reflection = new \ReflectionClass(\Composer\Autoload\ClassLoader::class);
$vendorRootDir = dirname($reflection->getFileName(), 3);

$io->note(sprintf('Starting to install elfinder to %s folder', $publicDir));

$this->fileSystem->mirror($rootDir.'/'.self::ELFINDER_CSS_DIR, $publicDir.'/css');
$this->fileSystem->mirror($rootDir.'/'.self::ELFINDER_IMG_DIR, $publicDir.'/img');
$this->fileSystem->mirror($rootDir.'/'.self::ELFINDER_JS_DIR, $publicDir.'/js');
$this->fileSystem->mirror($rootDir.'/'.self::ELFINDER_SOUNDS_DIR, $publicDir.'/sounds');
$this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_CSS_DIR, $publicDir.'/css');
$this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_IMG_DIR, $publicDir.'/img');
$this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_JS_DIR, $publicDir.'/js');
$this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_SOUNDS_DIR, $publicDir.'/sounds');

$io->success('elFinder assets successfully installed');

Expand Down

0 comments on commit 735b9b0

Please sign in to comment.