diff --git a/VERSIONS_HOTLINE/162745 b/VERSIONS_HOTLINE/162745 new file mode 100644 index 0000000000000000000000000000000000000000..5a1ee2985b4a69965c45d771eae0cb83654e4111 --- /dev/null +++ b/VERSIONS_HOTLINE/162745 @@ -0,0 +1 @@ + - correctif #162745 : Amélioration des performances d'affichage. \ No newline at end of file diff --git a/library/Class/Notice.php b/library/Class/Notice.php index ae2c4edf46992043ef1beecbde09ae8377e91953..62274e894e526cd4013e34a20f594232e8bf07d1 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -1493,7 +1493,9 @@ class Class_Notice extends Storm_Model_Abstract { public function getArticle() { - return Class_Article::findFirstBy(['id_notice' => $this->getId()]); + return $this->isArticleCms() + ? Class_Article::findFirstBy(['id_notice' => $this->getId()]) + : null; } @@ -1519,7 +1521,9 @@ class Class_Notice extends Storm_Model_Abstract { public function getPage() : ?Class_Profil { - return Class_Profil::findFirstBy(['id_notice' => $this->getId()]); + return $this->isPage() + ? Class_Profil::findFirstBy(['id_notice' => $this->getId()]) + : null; } diff --git a/library/Class/PanierNotice/RecordKeys.php b/library/Class/PanierNotice/RecordKeys.php index 0b8a27f842cfbf64ac88b7a4604797b6d3dffdd8..ed284f4a948fe4bfb76f59a4ac4cd5975713bd3c 100644 --- a/library/Class/PanierNotice/RecordKeys.php +++ b/library/Class/PanierNotice/RecordKeys.php @@ -23,6 +23,8 @@ class Class_PanierNotice_RecordKeys { const KEY_SEPARATOR = ';'; + protected static $_panier_record_keys_cache = []; + protected array $_keys = []; @@ -72,7 +74,16 @@ class Class_PanierNotice_RecordKeys { protected function _keyFor(Class_Notice $record) : Class_PanierNotice_RecordKey { - return Class_PanierNotice_RecordKey::newFromRecord($record); + $record_id = $record->getId(); + if (isset(static::$_panier_record_keys_cache [$record_id])) + return static::$_panier_record_keys_cache [$record_id]; + + return static::$_panier_record_keys_cache[$record_id] = Class_PanierNotice_RecordKey::newFromRecord($record); + } + + + public static function reset() { + static::$_panier_record_keys_cache = []; } } diff --git a/library/Class/Template/Settings.php b/library/Class/Template/Settings.php index ef7cdc5912ee1adf374beef6e1f37a04acfb6df2..8b7631f17835502fcd3e80c6450f7b6acb9bea45 100644 --- a/library/Class/Template/Settings.php +++ b/library/Class/Template/Settings.php @@ -29,6 +29,8 @@ class Class_Template_Settings extends Storm_Model_Abstract { 'settings' => ''], $_settings_instance_cache; + protected ?Class_Template_Loader $_template_loader; + public function __call($name, $params) { try { @@ -50,10 +52,12 @@ class Class_Template_Settings extends Storm_Model_Abstract { public function getTemplateInstance() { - $loader = new Class_Template_Loader; - return ($template = $loader->find($this->getTemplate())) + if (!isset($this->_template_loader)) + $this->_template_loader = new Class_Template_Loader; + + return ($template = $this->_template_loader->find($this->getTemplate())) ? $template - : $loader->getDefault(); + : $this->_template_loader->getDefault(); } diff --git a/library/ZendAfi/Controller/Action/Helper/CatalogSearch.php b/library/ZendAfi/Controller/Action/Helper/CatalogSearch.php index a56564165a871411b6c64d8c6ab0316addf4cf00..50e42ee40d51b2f2b75fd30480acece18e64bbfe 100644 --- a/library/ZendAfi/Controller/Action/Helper/CatalogSearch.php +++ b/library/ZendAfi/Controller/Action/Helper/CatalogSearch.php @@ -145,16 +145,16 @@ class ZendAfi_Controller_Action_Helper_CatalogSearch bool $save) : string { if (($url_order = $this->_getParam('tri', '')) && Class_Template::current()->isLegacy()) - return $url_order; + return (string) $url_order; $user_order = $user_settings->getSearchOrder(); if ( $save ) - return $url_order - ? $url_order - : $user_order; + return (string) ($url_order + ? $url_order + : $user_order); - return $user_order ?? $url_order; + return (string) ($user_order ?? $url_order); } diff --git a/library/templates/Intonation/Library/Selection.php b/library/templates/Intonation/Library/Selection.php index 7ff3a022d153b59737f6ad5b20148a59323e5207..7ba4ba03829c15791b25cd2b3743f2d93777f1e9 100644 --- a/library/templates/Intonation/Library/Selection.php +++ b/library/templates/Intonation/Library/Selection.php @@ -24,7 +24,7 @@ class Intonation_Library_Selection extends Class_Entity { use Trait_Translator; - protected $_is_in_cache; + protected ?bool $_is_in_cache; protected static $_selections_cache = []; @@ -77,7 +77,7 @@ class Intonation_Library_Selection extends Class_Entity { protected function _isIn() { - if ($this->_is_in_cache) + if (isset($this->_is_in_cache)) return $this->_is_in_cache; if (!$user = $this->getUser()) diff --git a/tests/TearDown.php b/tests/TearDown.php index 7705314e3c8a044267a8af8a0d172aa3d76eeb84..09c0e5283e4a29921f0d1e32258599246e259a7f 100644 --- a/tests/TearDown.php +++ b/tests/TearDown.php @@ -74,6 +74,8 @@ class TearDown { Class_Notice_Facette::reset(); Class_StatsNotices::setTimeSource(null); + Class_PanierNotice_RecordKeys::reset(); + Class_Profil::reset(); Class_ScriptLoader::resetInstance();