Closed wdammak closed 1 year ago
@wdammak There is no issue in the code you have sent.
Below code only executes once in a day only when first page loaded in backoffice.
if (!$this->isFresh(Upgrader::CACHE_FILE_UPGRADE_AVAILABE, _TIME_1_DAY_)) {
file_put_contents(_PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE, Tools::addonsRequest('check-version'));
}
Below code is used on every page header in back-office, So it is written in the AdminController.php
.
if (file_exists(_PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE)) {
$content = Tools::file_get_contents( _PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE);
$upgradeInfo = simplexml_load_string($content);
$this->context->smarty->assign(array(
'upgrade_info' => $upgradeInfo
));
}
Regarding working on a large database, We already test the system with large database and also with different conditions and different datasets.
https://github.com/webkul/hotelcommerce/blob/72452541d6ec822f81a18c04f9b83b56aa10a761/classes/controller/AdminController.php#L2839-L2850
//Get upgrade available info
Do the verification (even with cache) in any page in the admin this is very degrading for the performance of the backoffice Keeping it only in AdminDashboardController is enough, but you don't want to display it everywhere in the backoffice header!
I noticed a big degradation of the backoffice following the last modifications where smarty finds it difficult to finish the compilation of several tpl, maybe you develop with an empty database for that these degradations of performance are not visible at the time of development.
I therefore propose to think about working on a large database (30k customer, 20k room types, 40k orders, 50k address, 1k hotels with their descriptions and images,...) this will make it possible to rethink some codes in order to improve performances.