From fba8b55355a12f4aa73577bfe4327a322218d840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Justin=20Nu=C3=9F?= Date: Wed, 29 Mar 2017 14:11:18 +0200 Subject: [PATCH 1/2] Avoid reparsing of layout XML when not necessary --- app/code/community/Lesti/Fpc/Model/Observer.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/code/community/Lesti/Fpc/Model/Observer.php b/app/code/community/Lesti/Fpc/Model/Observer.php index cbb0ba1..c9b75b5 100755 --- a/app/code/community/Lesti/Fpc/Model/Observer.php +++ b/app/code/community/Lesti/Fpc/Model/Observer.php @@ -212,10 +212,13 @@ protected function _prepareLayout( array $dynamicBlocks ) { - $xml = simplexml_load_string( - $layout->getXmlString(), - Lesti_Fpc_Helper_Data::LAYOUT_ELEMENT_CLASS - ); + $xml = $layout->getNode(); + if (!is_a($xml, Lesti_Fpc_Helper_Data::LAYOUT_ELEMENT_CLASS)) { + $xml = simplexml_load_string( + $layout->getXmlString(), + Lesti_Fpc_Helper_Data::LAYOUT_ELEMENT_CLASS + ); + } $cleanXml = simplexml_load_string( '', Lesti_Fpc_Helper_Data::LAYOUT_ELEMENT_CLASS From 0de3db22d9425e0141808e385a440246ad59e006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Justin=20Nu=C3=9F?= Date: Wed, 29 Mar 2017 14:49:25 +0200 Subject: [PATCH 2/2] Remove superfluous if --- app/code/community/Lesti/Fpc/Model/Observer.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/community/Lesti/Fpc/Model/Observer.php b/app/code/community/Lesti/Fpc/Model/Observer.php index c9b75b5..f91a81b 100755 --- a/app/code/community/Lesti/Fpc/Model/Observer.php +++ b/app/code/community/Lesti/Fpc/Model/Observer.php @@ -213,12 +213,6 @@ protected function _prepareLayout( ) { $xml = $layout->getNode(); - if (!is_a($xml, Lesti_Fpc_Helper_Data::LAYOUT_ELEMENT_CLASS)) { - $xml = simplexml_load_string( - $layout->getXmlString(), - Lesti_Fpc_Helper_Data::LAYOUT_ELEMENT_CLASS - ); - } $cleanXml = simplexml_load_string( '', Lesti_Fpc_Helper_Data::LAYOUT_ELEMENT_CLASS