diff --git a/libraries/src/Helper/PublicFolderGeneratorHelper.php b/libraries/src/Helper/PublicFolderGeneratorHelper.php index e98d58e2a2ace..518b11225088f 100644 --- a/libraries/src/Helper/PublicFolderGeneratorHelper.php +++ b/libraries/src/Helper/PublicFolderGeneratorHelper.php @@ -161,19 +161,18 @@ public function createPublicFolder(string $destinationPath): void // The API root index.php $this->createFile($fullDestinationPath . 'api/index.php', str_replace(['{{APPLICATIONPATH}}', '{{DEFINESPATH}}'], ['\'' . DIRECTORY_SEPARATOR . 'api\'', 'dirname(__DIR__)'], $this->indexTemplate)); - if (is_dir(JPATH_ROOT . '/images')) { - $this->createSymlink($root . 'images', $destinationPath . 'images', JPATH_ROOT . '/'); - } - - // Create symlinks for all the local filesystem directories - if (PluginHelper::isEnabled('filesystem', 'local')) { + // Get all the local filesystem directories + if (\defined('_JCLI_INSTALLATION')) { + $localDirectories = [(object)['directory' => 'images']]; + } elseif (PluginHelper::isEnabled('filesystem', 'local')) { $local = PluginHelper::getPlugin('filesystem', 'local'); $localDirectories = (new Registry($local->params))->get('directories', [(object)['directory' => 'images']]); + } - foreach ($localDirectories as $localDirectory) { - if (!is_link($destinationPath . '/' . $localDirectory->directory)) { - $this->createSymlink($root . $localDirectory->directory, $destinationPath . $localDirectory->directory, JPATH_ROOT . '/'); - } + // Symlink all the local filesystem directories + foreach ($localDirectories as $localDirectory) { + if (!is_link($destinationPath . '/' . $localDirectory->directory)) { + $this->createSymlink($root . $localDirectory->directory, $destinationPath . $localDirectory->directory, JPATH_ROOT . '/'); } } }