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

Slim4 #1972

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Slim4 #1972

wants to merge 14 commits into from

Conversation

Beutlin
Copy link

@Beutlin Beutlin commented Apr 11, 2023

I've upgraded the Slim library in Shaarli from version 3 to 4.
The whole API has changed to be compatible with PSR-7. Thus a lot has changed in each file.
See also issue #1967.

Please have a look at it and give appropriate feedback.

@ArthurHoaro ArthurHoaro self-requested a review April 11, 2023 18:45
Copy link
Member

@ArthurHoaro ArthurHoaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's really an impressive work! 👏 🚀

I made a few comments, but overall it looks good. I didn't have time to review the tests (but I'm confident seeing they all pass), nor to actually test the changes yet. Thank you for making the PR pretty easy to review by keeping mostly the same format everywhere.

I'm going to open 2 developer experience improvement issues, that shouldn't be handled in this PR to keep the current format and not pile up other changes.

  • Improve readability of request accessor, instead of $object->getArray()['key'] ?? 'default' which is not ideal
  • Improve DI container reference

application/api/controllers/HistoryController.php Outdated Show resolved Hide resolved
application/api/controllers/Links.php Outdated Show resolved Hide resolved
application/api/controllers/Tags.php Outdated Show resolved Hide resolved
application/api/exceptions/ApiException.php Outdated Show resolved Hide resolved
application/container/ContainerBuilder.php Outdated Show resolved Hide resolved
application/helper/DailyPageHelper.php Outdated Show resolved Hide resolved
index.php Outdated Show resolved Hide resolved
index.php Outdated Show resolved Hide resolved
phpunit.xml Show resolved Hide resolved
@Beutlin
Copy link
Author

Beutlin commented Apr 17, 2023

Thanks for your Code review. I will look how I can integrate it.

@Beutlin
Copy link
Author

Beutlin commented Apr 19, 2023

@ArthurHoaro I've updated the code.

@Beutlin
Copy link
Author

Beutlin commented Apr 27, 2023

Is there anything I can do that the code will be accepted?

@ArthurHoaro
Copy link
Member

Hi! Nope thanks, the ball is in my court, I need to do another round of review/testing.
It's a huge PR and I'm pretty busy these days so it'll take some time.

@Beutlin
Copy link
Author

Beutlin commented Jul 21, 2023

Is there any progress on accepting this PR?

@nodiscc nodiscc added cleanup code cleanup and refactoring template HTML rendering in review labels Aug 19, 2023
Copy link
Member

@ArthurHoaro ArthurHoaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry it took me so long to get back to this PR. Life gets busy.
Overall, I don't want to have too many back and forth, so I'm happy with the current state of this PR regarding all code changes (besides my 2 comments).

After testing more or less everything, it seems to be working smoothly, and I didn't encounter any issue with a default PHP server setup. However, trying to run Shaarli in a subfolder failed, and I assume it's because basePath no longer auto-calculated by Slim, and it's expected to be setup manually.

I don't want to add it as a setting, because it would make the setup process more complex, so I'm going to check if I can submit an easy fix in this PR with https://github.com/selective-php/basepath.

We will have to try it with both nginx and Apache before merging it though. I'm afraid it could break some specific setups otherwise.

@@ -36,6 +36,8 @@ class FileUtils
*/
public static function writeFlatDB($file, $content)
{
$folder = basename($file);
file_exists($folder) || $folder !== 'sandbox' || mkdir($folder, 0755, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand, but regardless I don't think it's related to Slim4 upgrade, so if it's out of scope I'd rather revert this change.


// Default extension translation from the current theme
$themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') . '/' . $this->conf->get('theme') . '/language';
$themeTransFolder = __DIR__ . '/../' . rtrim($this->conf->get('raintpl_tpl'), '/') . '/'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that we have to change how we are handling paths for the translator. Not that it's shouldn't be done if there are pros of doing so, but it could introduce bugs and I don't think it affects Slim.

@ArthurHoaro
Copy link
Member

I don't want to add it as a setting, because it would make the setup process more complex, so I'm going to check if I can submit an easy fix in this PR with selective-php/basepath.

So obviously it didn't work out of the box. I added a quick hack to make it work with Shaarli, it's not ideal but it should do for now. I tried with a real nginx instance + subdirectory, and everything works fine now! The tests need an update and we should be good on that front.

@Beutlin
Copy link
Author

Beutlin commented Nov 24, 2023

@ArthurHoaro
What are the next steps?
Shall I do the requested changes or do you them?

@ArthurHoaro
Copy link
Member

@Beutlin Whatever is fastest. If you have a moment, go ahead. Otherwise, I should be able to merge the PR by the end of the weekend.

@agentcobra
Copy link

Hi,
I just switched to your branch, no problem on my side. I continue to test.

@agentcobra
Copy link

Hi,
I have some issues with translations.
I'm in automatic mode, I have english and when I select french, I still have english.
I'm on 13902fa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup code cleanup and refactoring in review template HTML rendering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants