Geeklog-Core / geeklog

Geeklog - The Secure CMS.
https://www.geeklog.net
25 stars 19 forks source link

Update to Composer 2 (Composer 1 is now depreciated) #1108

Closed eSilverStrike closed 2 years ago

eSilverStrike commented 2 years ago

I ran Composer to update the libraries and got a warning message about Composer 1 being deprecated

Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/

Upgrade guides for Composer 1.x to 2.0 https://github.com/composer/composer/blob/2.0.0/UPGRADE-2.0.md

eSilverStrike commented 2 years ago

@mystralkk Can you look into this one when you get a chance? (I don't have any real experience with composer)

mystralkk commented 2 years ago

All libraries installed via composer seem to be available with composer 2 but one. swiftmailer/swiftmailer is abandoned. The author suggests using symfony/mailer instead, but it requires at least PHP 7.1.3.

mystralkk commented 2 years ago

As an alternative, phpmailer comes to my mind, which requires PHP 5.5.0. Should we continue using swiftmailer or switch to phpmailer, @eSilverStrike ?

mystralkk commented 2 years ago

Related to issue #1107

eSilverStrike commented 2 years ago

I haven't really looked at the 2 libraries . You are right though PHPMailer supports 5.6 and is used in WordPress I believe so it is very popular. Symfony (at least the framework) is used by a lot of other projects like Drupal, Joomla, PHPBB...

I think we want something that is fast, lean (doesn't require a bunch of extra libraries) and does the job well.

I guess if we want to keep supporting PHP 5.6 we would have to go with PHPMailer. Have you used it before, did you like it?

mystralkk commented 2 years ago

In my opinion, we should keep supporting PHP 5.6 till Geelog's next major version 3.x. I haven't actually used PHPMailer, but it seems to me it is easy to use.

mystralkk commented 2 years ago

@eSilverStrike , I tried integrating PHPMailer in the improvement/integrate-phpmailer branch.

eSilverStrike commented 2 years ago

Did you find it worked okay with your setup?

I have the config options set to SMTPS on my development server which works with SwiftMail but not when I switch to the phpmailer branch. I was just doing a lost password email.

mystralkk commented 2 years ago

I just tested with the default "mail" setting to see what PHPMailer is like.

eSilverStrike commented 2 years ago

Okay I was incorrect, it does work. The user I tested for lost password had an incorrect email address (and the lost password form did not let me know that).

I also tested email attachments with the database backup email and that also worked. (the only place I found where attachment is sent)

The only thing I fixed (I think) was we were loosing our line breaks for plain text messages (which I think most emails Geeklog sends are). As far as I can tell we only need to set the AltBody attribute is if we are dealing with an actual HTML email. If it is only plain text then we just set the body. (I didn't find any docs to confirm this though)

So I think it is ready to merge? Do you? If you agree you want to go ahead and merge it?

mystralkk commented 2 years ago

Okay, I will merge it. Thanks.

mystralkk commented 2 years ago

Done.

eSilverStrike commented 2 years ago

Is updating to Composer 2 something you want to do for this version of Geeklog or push to next?

mystralkk commented 2 years ago

To update to Composer 2, we have really nothing to do with Geeklog. All we have to do is update our CLI, by executing:

composer self-update

I have been using Composer 2 for six months with Geeklog and other projects, and haven't met any trouble.

eSilverStrike commented 2 years ago

Ahh my mistake sorry (not really familiar with composer) and I thought maybe the files under vendor would need updating do to changes between Composer 1 and 2.

Anyways I have successful updated Composer.

I also ran the library updates

I can commit those now unless there is a reason not to?

BTW I see a few library's like https://github.com/mrclay/jsmin-php/issues/10 https://github.com/serbanghita/Mobile-Detect/issues/876

have fixes in the works to support PHP 8.1 so hopefully they will push a release soon. Not sure what other libraries do not yet support PHP 8.1.

mystralkk commented 2 years ago

Please go ahead. I want updates of jsmin and mobile detect, too, since they are causing errors with PHP 8.1 when developer mode is on.

eSilverStrike commented 2 years ago

Closing as updating composer not related directly with Geeklog.