Fixed: code review changes found for install register

Co-authored-by: Name <azharbhat.qlo098@webkul.in>
This commit is contained in:
shazar rahman
2026-11-04 14:14:48 +05:30
parent a94868438b
commit 1004cde25e
4 changed files with 20 additions and 18 deletions

View File

@@ -3449,8 +3449,8 @@ exit;
$post_data .= (isset($params['controller']) ? $params['controller'] : Context::getContext()->controller->controller_name);
$post_data .= defined('_PS_HOST_MODE_') ? '-od' : '';
break;
case 'notification':
$post_data .= '&method=notification&data='.urlencode(json_encode($params['notification_data']));
case 'register-install':
$post_data .= '&method=register-install&data='.urlencode(json_encode($params['install_data']));
break;
case 'check-version':
$post_data .= '&method=check-version&autoupgrade='.(int)(Module::isInstalled('qloautoupgrade') && Module::isEnabled('qloautoupgrade'));

View File

@@ -3003,6 +3003,12 @@ class AdminControllerCore extends Controller
Media::addJsDef(array('host_cluster' => defined('_PS_HOST_CLUSTER_') ? _PS_HOST_CLUSTER_ : 'fr1'));
}
// upgrade info is read from cache only, the cache is refreshed in background by ajaxProcessCheckUpgrade()
Media::addJsDef(array(
'upgrade_check_needed' => !Tools::isFresh(Upgrader::CACHE_FILE_UPGRADE_AVAILABE, _TIME_1_DAY_),
'upgrade_check_url' => 'index.php?controller='.$this->controller_name.'&ajax=1&action=checkUpgrade&token='.$this->token,
));
// Execute Hook AdminController SetMedia
Hook::exec('actionAdminControllerSetMedia');
}
@@ -3112,10 +3118,6 @@ class AdminControllerCore extends Controller
));
// get upgrade available info from cache only, the cache is refreshed in background by ajaxProcessCheckUpgrade()
Media::addJsDef(array(
'upgrade_check_needed' => !Tools::isFresh(Upgrader::CACHE_FILE_UPGRADE_AVAILABE, _TIME_1_DAY_),
'upgrade_check_url' => 'index.php?controller='.$this->controller_name.'&ajax=1&action=checkUpgrade&token='.$this->token,
));
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);

View File

@@ -64,7 +64,7 @@ class InstallControllerHttpConfigure extends InstallControllerHttp
'marketingConsent' => Tools::getValue('marketing_consent'),
];
$objModelInstall = new InstallModelInstall();
$objModelInstall->setNotification($qloData);
$objModelInstall->registerInstall($qloData);
// END
}

View File

@@ -622,27 +622,27 @@ class InstallModelInstall extends InstallAbstractModel
'marketingConsent' => $data['marketing_consent'],
];
// Qlo Notification
$this->setNotification($qloData);
// Register install
$this->registerInstall($qloData);
return true;
}
/**
* @param array $notificationData
* @param array $installData
* @return bool
*/
public function setNotification($notificationData)
public function registerInstall($installData)
{
Tools::addonsRequest('notification', array(
'notification_data' => $notificationData,
Tools::addonsRequest('register-install', array(
'install_data' => $installData,
'version' => _QLO_INSTALL_VERSION_,
'iso_lang' => $this->language->getLanguageIso(),
'iso_country' => $notificationData['countryCode'],
'shop_url' => $notificationData['shopDomain'],
'shop_url_ssl' => $notificationData['shopDomainSsl'],
'physical_uri' => $notificationData['physicalUri'],
'email' => $notificationData['email'],
'iso_country' => $installData['countryCode'],
'shop_url' => $installData['shopDomain'],
'shop_url_ssl' => $installData['shopDomainSsl'],
'physical_uri' => $installData['physicalUri'],
'email' => $installData['email'],
));
return true;