-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Change to use Composer for autoload, drop PEAR/EZC #1340
Conversation
autoload.php
Outdated
@@ -19,6 +19,12 @@ | |||
require_once __DIR__ . '/config.php'; | |||
} | |||
|
|||
// If composer autoloaded context such as eZ Platform & legacy bridge, skip trying to autoload Zeta Components and such | |||
if ( class_exists( 'Composer\Autoload\ClassLoader', false ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this different from what legacy bridge bundle does?
https://github.com/ezsystems/LegacyBridge/blob/master/bundle/EzPublishLegacyBundle.php#L43-L46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had forgot about that one.
It's more or less the same, so not needed then. Only difference is that this also detects usage in plain legacy. As in:
require __DIR__ . '/vendor/autoload.php';
$ini = eZINI::instance();
echo $ini->variable( 'SiteAccessSettings', 'ForceVirtualHost' );
That said I'm unsure if allowing yet another way to do things is good. So I'll gladly remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But main reason I added it is because I need it in order to be able to do the section in composer:
"autoload": {
"files": ["autoload.php"]
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I'll test the patch tomorrow to see how it behaves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, is there a point in using Composer autoloading in context of pure legacy, seeing how you just can do require autoload.php
, instead of require vendor/autoload.php
and achieve the exact same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emodric I imagine this allows using composer-installed dependencies in a pure-legacy context... An interesting concept - albeit probably not many legacy extensions are currently available that take advantage of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
albeit probably not many legacy extensions are currently available that take advantage of this
@gggeek If any, hence, my question :) But I suppose there's no harm done in allowing Composer autoloading too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, is there a point in using Co
As said, this is not the main point* of this, just a side benefit/downside however you look at it. I know many legacy parts don't use compoer and never will, exhibit A: package system as used by setup wizard.
* Main point: To auto register legacy autoload in composer in a Platform + Legacy Bridge setup to get rid of dependency on app/autoload.php
which was removed in Symfony 3 and hence also eZ Platform v2 as there is no need for it. Somewhat pure composer autoloading for the win 🎉
The error about CLIHandler (https://github.com/ezsystems/LegacyBridge/issues/132) is gone, but there's still an error when running the script to generate autoloads from eZ Platform root. I think that eZ Publish Legacy still expects
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything works now
Hmm, trying to test that with v2 + LegacyBridge but in meta-repository (ezplatform v2) I still need to modify
Does v2 + LegacyBridge setup works for you without it? Also now when clearing v2 Sf cache I'm getting:
but this seems to be unrelated to changes, so just a side note. |
@alongosz Works fine without any changes to root I've tested with https://github.com/emodric/ezplatform-legacy with emodric/ezplatform-legacy@ab8d3e0 reverted. Also, no mention of |
Worked for me her now too.
|
@andrerom Will this be tagged with |
P.S. Just discovered this, when running legacy scripts in pure legacy context:
|
@emodric I didn't think of that because I had dependency on LegacyBridge only, so just symlinked ezpublish_legacy directory to repo with these changes. I guess some composer workflow is missing in this case 😅 Anyway, when done properly as you've suggested - it works :)
It also is visible in unit tests on Travis, seems like cc @andrerom |
Yep, looks like it. For example, if I change |
Maybe it's too close to the weekend already, but like before it's surrounded by |
@andrerom I'm not so sure myself. I can confirm that the file is ran twice, but I can't figure out why or how it goes into that BTW, with these changes, this too can be removed now: https://github.com/ezsystems/ezpublish-legacy/blob/master/config.php-RECOMMENDED#L23-L53, as those three constants are not used anymore. |
Debugging further, it seems that |
Hmm, I'd like to try to double check that once I have the time. But if that is the case, I'll probably have to resort to using |
It seems that I was wrong after all. The problem is not Hacking on |
That make complete sense, sorry for sending you down the recursion rabbit hole 🙈 |
Thanks! I'll test soon 👍 |
@andrerom Everything works fine now, so 👍 for merging. |
Mainly in order to solve the autloading issue with eZ Platform v2, but also:
Result is more clean autoloading code which just have three cases to care about in regards to making sure things like Zeta Components are loaded.