contao-community-alliance / composer-plugin

Composer plugin that provide contao integration and installer.
GNU Lesser General Public License v3.0
7 stars 10 forks source link

Creating relative symlinks fail on Linux #70

Closed biwerr closed 4 years ago

biwerr commented 7 years ago

Looks like there are some problems with relative symlinks on linux.

Failed to create symlink | target: /var/www/web556/html/cms/system/modules/euf_grid | source: /var/www/web556/html/cms/vendor/erdmannfreunde/euf_grid

I've replaced creating relative links with absolute links, seems to work

 if (Platform::isWindows()) {
                $success = @symlink($source, $target);
            } else {
                //$success = $this->filesystem->relativeSymlink($source, $target);

                $success = symlink($source, $target);
            }

            if (!$success) {
                throw new \RuntimeException('Failed to create symlink | target: ' . $target. ' | source: '.$source);
            }
Exception trace:
 () at /var/www/web556/html/cms/vendor/contao-community-alliance/composer-plugin/src/Installer/AbstractModuleInstaller.php:254
 ContaoCommunityAlliance\Composer\Plugin\Installer\AbstractModuleInstaller->addSymlinks() at /var/www/web556/html/cms/vendor/contao-community-alliance/composer-plugin/src/Installer/AbstractModuleInstaller.php:92
 ContaoCommunityAlliance\Composer\Plugin\Installer\AbstractModuleInstaller->install() at phar:///var/www/web556/html/cms/composer.phar/src/Composer/Installer/InstallationManager.php:173
 Composer\Installer\InstallationManager->install() at phar:///var/www/web556/html/cms/composer.phar/src/Composer/Installer/InstallationManager.php:160
 Composer\Installer\InstallationManager->execute() at phar:///var/www/web556/html/cms/composer.phar/src/Composer/Installer.php:584
 Composer\Installer->doInstall() at phar:///var/www/web556/html/cms/composer.phar/src/Composer/Installer.php:223
 Composer\Installer->run() at phar:///var/www/web556/html/cms/composer.phar/src/Composer/Command/InstallCommand.php:119
 Composer\Command\InstallCommand->execute() at phar:///var/www/web556/html/cms/composer.phar/vendor/symfony/console/Command/Command.php:267
 Symfony\Component\Console\Command\Command->run() at phar:///var/www/web556/html/cms/composer.phar/vendor/symfony/console/Application.php:846
 Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/web556/html/cms/composer.phar/vendor/symfony/console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar:///var/www/web556/html/cms/composer.phar/src/Composer/Console/Application.php:227
 Composer\Console\Application->doRun() at phar:///var/www/web556/html/cms/composer.phar/vendor/symfony/console/Application.php:122
 Symfony\Component\Console\Application->run() at phar:///var/www/web556/html/cms/composer.phar/src/Composer/Console/Application.php:100
 Composer\Console\Application->run() at phar:///var/www/web556/html/cms/composer.phar/bin/composer:54
 require() at /var/www/web556/html/cms/composer.phar:24
aschempp commented 7 years ago

Looks like that's an issue on your system? Relative symlinks usually work on Linux but not in Windows. Can you try if they work on the command line?

biwerr commented 7 years ago

This was symlink creation at command line on an ssh shell at my reseller account on alfahosting. Seems there are some problems with hosting packages.

I've switched to a diffrent hosting partner and there where no problems.

Maybe try to fix this possible bug with first creating relative symlinks and if that fails switch to absolute symlinks?

if (Platform::isWindows()) {
                $success = @symlink($source, $target);
            } else {
                $success = $this->filesystem->relativeSymlink($source, $target);

                if(!$success)
                     $success = @symlink($source, $target);
            }

            if (!$success) {
                throw new \RuntimeException('Failed to create symlink | target: ' . $target. ' | source: '.$source);
            }