Skip to content

Upgrade to Slim 3 #213

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

Closed
wants to merge 20 commits into from
Closed

Conversation

Findus23
Copy link
Collaborator

@Findus23 Findus23 commented Dec 12, 2017

Cherry-picked all changes from #200 that don't affect JS/CSS/Twig Templates. Also doesn't include the full text search.

I'll test if this breaks anything soon.

To do after/while merge:

  • run composer install as this updates some libraries
  • (just to be save) delete the twig cache in app/tmp/templates/

$res = $res->withHeader('Content-Type', 'application/json');
$res->getBody()->write($content);
} else{
$res->getBody()->write($content . "\n<!-- Cached response -->");
Copy link
Member

Choose a reason for hiding this comment

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

is this comment fine to append to a JSON content type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so. That's why I'm only appending it when it isn't a json document.

Copy link
Member

Choose a reason for hiding this comment

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

Stupid me :) didn't look at it properly

private function getCacheKey($req)
{
private function isJsonData(Request $req) {
return strpos($req->getUri()->getPath(), 'data/') !== false;
Copy link
Member

Choose a reason for hiding this comment

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

I haven't tested it, but what if the URL contains data/ as in https://developer.piwik.org/guides/log-data/xxx? This URL wouldn't work but there might be something in the future. I haven't looked yet at the structure of data URLs but maybe we can check if it starts with a certain URL or something else? Just a thought...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right, that could cause issues in the future. I’ll replace it with something more specific

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should be fixed now in 667cc0b

@Findus23
Copy link
Collaborator Author

Findus23 commented Dec 13, 2017

The search was broken because now that the json is send with the correct header it is parsed by jquery and doesn't need to be parsed again. I quickly fixed it in 31bc37f

Keep in mind that I have already written a new search that mores far better on the frontend and backend (see https://issues.lw1.at/)

@Findus23
Copy link
Collaborator Author

@tsteur
Can you also check if the logging works the way you want?
Slim 3 doesn't include logging anymore and I am not sure if I have understand how logging in PHP/monolog work exactly.

@tsteur
Copy link
Member

tsteur commented Dec 15, 2017

@Findus23 so far everything seems to work but the logger as you mentioned. Is there a chance we can somehow keep the Log class so it won't fail here for example: https://github.com/piwik/developer-documentation/blob/master/app/helpers/Markdown/IncludeFilePostprocessor.php#L73

@Findus23
Copy link
Collaborator Author

Findus23 commented Jan 2, 2018

@tsteur
I thought I have already answered...

The log class doesn't work anymore as Slim 3 doesn't include any logging feature anymore, but recommends to use monolog instead. Unfortunately I don't know how to access the class in the IncludeFilePostprocessor.php.
For now I have commented the line out and added a check so the website doesn't get cached if an file_get_contents() error occurs.

@tsteur
Copy link
Member

tsteur commented Jun 19, 2019

@Findus23 what's the current status here?

@Findus23
Copy link
Collaborator Author

I think this is the branch where I extracted the PHP changes and it should be working. (apart from logging)
I can go through everything again next month, but after testing, this should be fine to merge.

@mattab
Copy link
Member

mattab commented Jan 22, 2020

@Findus23 Be awesome if we could merge your work soon and benefit from the improvements 👍

@Findus23 Findus23 mentioned this pull request Feb 4, 2020
@Findus23 Findus23 closed this Feb 6, 2020
@tsteur
Copy link
Member

tsteur commented Feb 6, 2020

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants