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

[dev.icinga.com #10856] Benchmark is not rendered on many pages #2204

Closed
icinga-migration opened this issue Dec 15, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@icinga-migration
Copy link
Member

commented Dec 15, 2015

This issue has been migrated from Redmine: https://dev.icinga.com/issues/10856

Created by tgelf on 2015-12-15 15:26:23 +00:00

Assignee: (none)
Status: Resolved (closed on 2016-02-27 21:50:06 +00:00)
Target Version: 2.2.0
Last Update: 2016-02-27 21:50:06 +00:00 (in Redmine)


This basically affects all pages doing $this->render(...) in their controller. This results in getNoRenderer being true in ZF viewRenderer, so this condition fails:

if (!$this->_helper->viewRenderer->getNoRender()) {
    $layout->benchmark = $this->renderBenchmark();

Please be careful, fixing this should not affect non-HTML renderers or similar.

Cheers,
Thomas

Changesets

2016-02-27 19:14:02 +00:00 by elippmann 7cef06f

Disable benchmark only if the layout is disabled

Benchmark should be disabled if the response is not HTML. This is most likely the case when the layout is disabled.
If Web 2 or Zend sends JSON for example, the layout is disabled.

The follwing code inside an action disables the layout (and view):
$this->_helper->layout()->disableLayout();

The following code inside an action disables the action's view script:
$this->_helper->viewRenderer->setNoRender(true);

Note that an action's view script is also disabled via setNoRender() when rendering another view script via
render() or renderScript().

Another appraoch is to check the content-type. If explicitly set to not HTML, disable benchmark:

$renderBenchmark = true;
$response = $this->getResponse();
$headers = $response->getHeaders();
foreach ($headers as $header) {
    if (strtolower($header['name']) === 'content-type'
        && stristr($header['value'], 'text/html') === false
    ) {
        $renderBenchmark = false;
        break;
    }
}
if ($renderBenchmark) {
    $layout->benchmark = $this->renderBenchmark();
}

Maybe we should also provide a action method for disabling benchmark, regardless of the user's setting.

refs #10856

2016-02-27 21:49:44 +00:00 by elippmann 9c5dfc5

Merge branch 'bugfix/benchmark-not-always-rendered-10856'

fixes #10856
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Jan 5, 2016

Updated by elippmann on 2016-01-05 10:30:10 +00:00

  • Category set to Framework
  • Target Version set to 2.2.0
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Feb 27, 2016

Updated by elippmann on 2016-02-27 21:50:06 +00:00

  • Status changed from New to Resolved
  • Done % changed from 0 to 100

Applied in changeset 9c5dfc5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.