Skip to content
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

Upgrade Illuminate components to 6.x #2055

Closed
4 tasks done
franzliedke opened this issue Mar 7, 2020 · 16 comments · Fixed by #2243
Closed
4 tasks done

Upgrade Illuminate components to 6.x #2055

franzliedke opened this issue Mar 7, 2020 · 16 comments · Fixed by #2243

Comments

@franzliedke
Copy link
Contributor

franzliedke commented Mar 7, 2020

Let's adopt the LTS release. See previous attempt in #1930.

Challenges

@franzliedke
Copy link
Contributor Author

Status update: I'm almost done with getting rid of Laravel's Application contract. That will take us to version 5.8.

The Gate and Translator stuff are changing in L6 if I am not mistaken.

@askvortsov1
Copy link
Member

I'm likely misunderstanding here, but when I was working on the policy/model visibility scoping refactor, it seemed to me that we're really only using a very small part of Gate. Do we want to keep using it at all? It seems like we could make a gate-inspired system with much less overhead

@franzliedke
Copy link
Contributor Author

That's a good point, but I would rather see that happen with or after the policy rework. No need to block the Laravel upgrade with such a big change to such a central place.

@luceos
Copy link
Member

luceos commented Apr 6, 2020

Yeah let's keep the changes for the upgrade to a minimum. @franzliedke Gate and Translator indeed where blocking the upgrade, I'd suggest implementing the required changes and exchange them with simpler components if possible before stable.

franzliedke added a commit that referenced this issue Apr 10, 2020
The test from the previous commit proves this works as intended. :)

This is one more step in trying to avoid the widespread usage of the
`Application` godclass.

Refs #2055.
franzliedke added a commit that referenced this issue Apr 21, 2020
Less usages of the Application god-class simplifies splitting it up.

Refs #2055.
franzliedke added a commit that referenced this issue Apr 21, 2020
One less reason to inject the huge Application class.

Refs #2055.
@franzliedke
Copy link
Contributor Author

Made a little more progress with this. Moving this to Beta.14 now.

A status update:

  • For the upgrade to Laravel 5.8, the biggest remaining blocker is avoiding Laravel's huge Application contract. I made small steps here with the goal of injecting it in far fewer places.
  • I have prepared a commit that splits up the Application, most importantly:
    • ignore the Application contract, we don't need it
    • stop inheriting from and instead inject a Container instance
    • separate paths / URLs from the config derived from config.php, from the application bootstrap stuff
    • get rid of some of the fluff, such as deferred service providers and other Laravel-specific things
  • I will PR this commit (an improved version of it, really) at the beginning of the B.14 cycle, so that we have enough time to find / encounter issues caused by this change.
  • The Gate change (for Laravel 6) might become obsolete with the policy changes in WIP Policy Refactor, Extender #2056.

@luceos
Copy link
Member

luceos commented May 1, 2020

Would it be feasible to remove the Application contract and its implementation completely? Just using a Container implementation makes a lot more sense in the scope of our targeted code logic.

@franzliedke
Copy link
Contributor Author

Yes, I listed that point above. 😃

franzliedke added a commit that referenced this issue May 1, 2020
- Stop trying to implement Laravel's Application contract, which
  has no value for us.
- Stop inheriting from the Container, injecting one works equally
  well and does not clutter up the interfaces.
- Inject the Paths collection instead of unwrapping it again, for
  better encapsulation.

This brings us one step closer toward upgrading our Laravel
components (#2055), because we no longer need to adopt the changes
to the Application contract.
@franzliedke
Copy link
Contributor Author

@luceos I managed to finish the PR that splits up Application and container: #2142. Is that what you had in mind?

@luceos
Copy link
Member

luceos commented May 1, 2020

@franzliedke i meant fully removing the application including contract... 😇

@askvortsov1
Copy link
Member

Isn't that what the PR does though? Remove the application contract?

@askvortsov1
Copy link
Member

Also, as per Franz's earlier message, I am not envisioning us keeping Gate after the policy refactor, so that will go too.

@franzliedke
Copy link
Contributor Author

franzliedke commented May 1, 2020

Yes, indeed. I removed the contract. The class is still there, but significantly slower smaller (container gone, several contract methods gone). We may have to revisit the structure of Application <-> App(Interface) <-> Site(Interface), but most of this is internal, so not extremely urgent.

Maybe we just need to figure out better names, the concepts themselves have been useful in my eyes.

franzliedke added a commit that referenced this issue May 8, 2020
Apparently, this code was from back when we had a special "extensions"
directory for Composer packages marked as Flarum extensions.

While we're at it, we now inject the Paths instance instead of using one
of the global helpers (which I am trying to get rid of).

Refs #2055.
franzliedke added a commit that referenced this issue May 8, 2020
@askvortsov1
Copy link
Member

Gate is gone with #2181. For translator, as we actually use it (unlike gate), and that interface is commonly used, I'd say we should keep the interface. For events dispatcher, we can provide a BC layer for a few releases, and then drop that.

^^^ Is this more-or-less an accurate representation of the work left to be done (after #2155 is figured out and merged)?

@franzliedke
Copy link
Contributor Author

For events dispatcher, we can provide a BC layer for a few releases, and then drop that.

Core usages were actually removed quite a while ago in f4ab6f4, then the method itself was dropped for real when upgrading to Laravel 5.8. No BC planned here. (I might have a list of usages in community extensions laying around somewhere thanks to @clarkwinkelmann, but it wasn't very long.)

For translator, as we actually use it (unlike gate), and that interface is commonly used, I'd say we should keep the interface.

Totally agree.

Is this more-or-less an accurate representation of the work left to be done?

According to what was noted in this issue and related PRs so far, yes. I will carefully go through the L6 upgrade guide to see whether there's anything else. But that's the next step, then we're done. 🥂

@franzliedke
Copy link
Contributor Author

franzliedke commented Jun 19, 2020

Went through the list and found the following things that need to be changed when upgrading to L6:

  • Translator contracts (docs, diff) 😱 - we may have to consider something here for backwards compatibility.
  • ✔️ The Mandrill mail driver will no longer be shipped by Laravel core, so we can not offer it. Clean up core / translations and leave it to flagrow/mail-drivers.
  • 🤷 The default queue retry limit changed - we could mention that in the upgrade guide, but it's probably more relevant for @luceos' redis queue extension.
  • ✔️ In somewhat related news, I noticed we're not explicitly requiring the nesbot/carbon package, but we're implicitly using it (installed through illuminate/support) - should be added to our Composer requirements.

@askvortsov1
Copy link
Member

  • Translator contracts (docs, diff) scream - we may have to consider something here for backwards compatibility.

We could just add those methods as deprecated to the Locale\Translator.php object? And remove them in stable? Also make that change on the frontend translator as well?

That repo doesn't seem to be maintained, but at the very least we should make it clear in the release announcements to avoid a situation like with SES. Also, perhaps FoF might be interested in picking it up?

  • In somewhat related news, I noticed we're not explicitly requiring the nesbot/carbon package, but we're implicitly using it (installed through illuminate/support) - should be added to our Composer requirements.

Good catch! And maybe that'll solve the annoying deprecation warnings too :D

franzliedke added a commit that referenced this issue Jul 24, 2020
This is in preparation for the upcoming upgrade to Laravel 6,
which dropped this driver.

Refs #2055.
franzliedke added a commit to flarum/lang-english that referenced this issue Jul 24, 2020
franzliedke added a commit that referenced this issue Jul 24, 2020
We have used this transitive dependency (via illuminate/support)
for a while, so let's make this explicit.

Incidentally, we now also explicitly require version 2.x - the
previous 1.x branch will no longer be supported after the
upcoming upgrade to Laravel 6.

Refs #2055.
franzliedke added a commit to flarum/docs that referenced this issue Jul 24, 2020
franzliedke added a commit that referenced this issue Jul 24, 2020
askvortsov1 pushed a commit to flarum/lang-english that referenced this issue Mar 11, 2022
askvortsov1 pushed a commit to flarum/lang-english that referenced this issue May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants