1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 15:57:01 +02:00

Add a Page::render timer that is used in debug mode and shown in the Debug > Timers accordion item

This commit is contained in:
Ryan Cramer
2022-02-04 14:25:43 -05:00
parent 4c96ff94e2
commit 9a1cf64e02

View File

@@ -446,9 +446,12 @@ class PageRender extends WireData implements Module, ConfigurableModule {
$_page = $this->wire()->page; // just in case one page is rendering another, save the previous
$config = $this->wire()->config;
$timerKey = $config->debug ? "page.$page.render" : "";
$compiler = null; /** @var FileCompiler|null $compiler */
$compilerOptions = array();
if($timerKey) Debug::timer($timerKey);
if($config->templateCompile && $template->compile) {
$compilerOptions = array(
'namespace' => strlen(__NAMESPACE__) > 0,
@@ -496,6 +499,7 @@ class PageRender extends WireData implements Module, ConfigurableModule {
if(!$options['forceBuildCache'] && ($data = $cacheFile->get()) !== false) {
$event->return = $data;
if($_page) $this->wire('page', $_page);
if($timerKey) Debug::saveTimer($timerKey);
return;
}
}
@@ -581,6 +585,8 @@ class PageRender extends WireData implements Module, ConfigurableModule {
$this->populateMarkupRegions($data);
}
}
if($timerKey) Debug::saveTimer($timerKey);
if($data && $cacheAllowed && $cacheFile) {
$data = $this->saveCacheFileReady($page, $data);