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