magento-hackathon / magento-composer-installer

Composer installer for Magento modules
210 stars 154 forks source link

Invalid include path when using symlink strategy #141

Open gplanchat opened 9 years ago

gplanchat commented 9 years ago

When using the symlink strategy, the updated include_pathof Magento becomes :

/var/www/releases/20141115141316/vendor/connect20/Mage_Core_Modules/app/code/local
/var/www/releases/20141115141316/vendor/connect20/Mage_Core_Modules/app/code/community
/var/www/releases/20141115141316/vendor/connect20/Mage_Core_Modules/app/code/core
/var/www/releases/20141115141316/vendor/connect20/Mage_Core_Modules/lib
.
/usr/share/php
/usr/share/pear

This is due to line 29 of the app/Mage.php file defining the BPconstant, as long as __FILE__resolves to the realpath and not to the symlink path :

define('BP', dirname(dirname(__FILE__)));
Flyingmana commented 9 years ago

thats a known problem with symlink and the magento core packages, a few core parts like this work with a path relative to the current file location.

luxmedia commented 5 years ago

Is there a fix for this? I am still getting problems with composer and magento 1 resulting in the following warning: "Warning: include_once(Varien/Autoload.php): failed to open stream: No such file or directory"

Flyingmana commented 5 years ago

We usually recommend against symlinking core packages and build configs to make it possible to set this by package.

Is this happening because of a core package or some other?

luxmedia commented 5 years ago

Yes, its related to a core package: "Warning: include_once(Varien/Autoload.php): failed to open stream: No such file or directory in ..../vendor/connect20/Mage_Core_Modules/app/Mage.php on line 53" How can i avoid the core package to be deployed using symlinks?

Flyingmana commented 5 years ago

does this documentation help you? https://github.com/Cotya/magento-composer-installer/blob/master/doc/Deploy.md#overwrite-deploy-method-per-module

luxmedia commented 5 years ago

thanks. I already stumbled upon this repo. So the composer.json should look like this?

"extra": {
        "magento-root-dir": "./",
        "magento-force": true,
        "magento-deploystrategy": "symlink",
        "magento-deploystrategy-overwrite": {
            "connect20/mage_core_modules": "copy"
        }
    }

But will all the symlinks in magento be overwritten with a file copy if i run composer update/install? I fear changing the deploy strategy afterwards will have no effect, won't it?

Flyingmana commented 5 years ago

you will need to list the core modules one by one. Actually it would be better to instead use one of the core installers like https://github.com/AydinHassan/magento-core-composer-installer They are a lot better in solving issues specific to core packages.

luxmedia commented 5 years ago

Unfortunately the dependency of connect20/mage_core_modules comes from another module. The list of requesters is long: https://packages.firegento.com/#!/mage_core_modules

Aydin hassan's module is already in my list, but i have no idea how to get rid of the magento_core_modules.

By the way, making Mage.php a real file again by doing cp --remove-destination ../vendor/connect20/Mage_Core_Modules/app/Mage.php Mage.php in app/ solves the issue. But seems to be more of a hack than a solution.

Edit: I actually compared my required modules to all magento_core_modules requests and found that only one extension, namely phoenix_moneybookers depends on it. Luckily the extension is not essential, so i removed it and went for the recommended way:

composer require magento-hackathon/magento-composer-installer ~3.0
composer require aydin-hassan/magento-core-composer-installer ~1.2
composer require firegento/magento ~1.9.4.0
Flyingmana commented 5 years ago

huh, I see, which exact packages do you have which depend on it?

You could introduce an own (mock) package, which replaces this dependency, I dont have the exact syntax on hand for his. But maybe this helps https://stackoverflow.com/questions/18882201/how-does-the-replace-property-work-with-composer