Skip to content

TracyExtension: Don't dispatch Debugger in a CLI#200

Merged
dg merged 1 commit into
nette:masterfrom
hranicka:hotfix/session-cli
Jun 20, 2016
Merged

TracyExtension: Don't dispatch Debugger in a CLI#200
dg merged 1 commit into
nette:masterfrom
hranicka:hotfix/session-cli

Conversation

@hranicka

Copy link
Copy Markdown
Contributor

See #198

I've disabled Session/Debugger dispatching in for CLI SAPI.

It's needed only for Ajax.

@hranicka hranicka mentioned this pull request Jun 20, 2016
@dg

dg commented Jun 20, 2016

Copy link
Copy Markdown
Member

Thanks!

@hranicka

Copy link
Copy Markdown
Contributor Author

This is the simplest possible solution, thanks @dg for your mentoring.

@JanTvrdik

JanTvrdik commented Jun 20, 2016

Copy link
Copy Markdown
Contributor

PHP_SAPI is not part of DI container cache key. The condition should IMHO be evaluated in runtime.

@hranicka

hranicka commented Jun 20, 2016

Copy link
Copy Markdown
Contributor Author

@dg

dg commented Jun 20, 2016

Copy link
Copy Markdown
Member

It is "coincidentally" part of cache key, the question is whether make it official part of key, or modify implementation of extensions or leave it as is.

@hranicka

hranicka commented Jun 20, 2016

Copy link
Copy Markdown
Contributor Author

There is also a parameter consoleMode here.

Does it have any impact on it? It's a part part of DIC cache key.


I can change this PR something like:

$initialize->addBody('if (PHP_SAPI !== 'cli' && $tmp = $this->getByType("Nette\Http\Session", FALSE)) { $tmp->start(); Tracy\Debugger::dispatch(); };');

But it seems unclear to me, I'm not sure with it.

@JanTvrdik

Copy link
Copy Markdown
Contributor

@dg I think that it should be possible to generate DI container for application from CLI.

@dg

dg commented Jun 20, 2016

Copy link
Copy Markdown
Member

It would actually be parameter for TracyExtension, like $debugMode .

@dg

dg commented Jun 20, 2016

Copy link
Copy Markdown
Member

@hranicka can you change it this way? nette/http@27c3de5#diff-e18d2abacdd85c4cc65b1a8d611ca31f

@hranicka

hranicka commented Jun 20, 2016

Copy link
Copy Markdown
Contributor Author

Ok, I edit it.

I've tried use config parameters with %consoleMode% but I must add more code because of this magic.

Constructor parameters seems better.


And what about Nette\Http packages? There is also PHP_SAPI constant. Ah, you edited this right now. Thanks :)

@hranicka hranicka force-pushed the hotfix/session-cli branch from 3bf9b11 to 916acb3 Compare June 20, 2016 10:36
@dg

dg commented Jun 20, 2016

Copy link
Copy Markdown
Member

👍

@dg dg merged commit 6f89b71 into nette:master Jun 20, 2016
@hranicka

Copy link
Copy Markdown
Contributor Author

I can prepare you PR into nette/bootstrap for your changes in nette/http and tracy. Give me a few minutes.

@dg

dg commented Jun 20, 2016

Copy link
Copy Markdown
Member

I have it finished.

@hranicka

Copy link
Copy Markdown
Contributor Author

Ok, thanks :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants