Merge branch 'develop' into gli-1528

This commit is contained in:
abhishek-webkul
2024-03-15 20:52:51 +05:30
committed by GitHub
435 changed files with 13019 additions and 10798 deletions

View File

@@ -444,8 +444,12 @@ class AdminModulesControllerCore extends AdminController
@unlink($file);
$this->recursiveDeleteOnDisk($tmp_folder);
if ($success && $redirect) {
Tools::redirectAdmin(self::$currentIndex.'&conf=8&anchor='.ucfirst($folder).'&token='.$this->token);
if ($success) {
if ($redirect) {
Tools::redirectAdmin(self::$currentIndex.'&conf=8&anchor='.ucfirst($folder).'&token='.$this->token);
} else {
$success = $folder;
}
}
return $success;
@@ -610,7 +614,7 @@ class AdminModulesControllerCore extends AdminController
} elseif (!move_uploaded_file($_FILES['file']['tmp_name'], _PS_MODULE_DIR_.$_FILES['file']['name'])) {
$this->errors[] = Tools::displayError('An error occurred while copying the archive to the module directory.');
} else {
$this->extractArchive(_PS_MODULE_DIR_.$_FILES['file']['name'], $redirect);
return $this->extractArchive(_PS_MODULE_DIR_.$_FILES['file']['name'], $redirect);
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to add this.');
@@ -1381,14 +1385,6 @@ class AdminModulesControllerCore extends AdminController
'modal_title' => ($this->context->mode == Context::MODE_HOST) ? $this->l('This module cannot be installed') : $this->l('Important Notice'),
'modal_content' => $modal_content
);
$modal_content = $this->context->smarty->fetch('controllers/modules/modal_not_trusted_country.tpl');
$this->modals[] = array(
'modal_id' => 'moduleNotTrustedCountry',
'modal_class' => 'modal-lg',
'modal_title' => $this->l('This module is Untrusted for your country'),
'modal_content' => $modal_content
);
}
public function initContent()
@@ -1681,11 +1677,9 @@ class AdminModulesControllerCore extends AdminController
public function ajaxProcessUploadModule()
{
$response = array('success' => false);
$this->postProcessDownload(false);
$folder = $this->postProcessDownload(false);
if (!count($this->errors)) {
$filename = $_FILES['file']['name'];
$filename = explode('.', $filename);
if ($module = Module::getInstanceByName($filename[0])) {
if ($folder && $module = Module::getInstanceByName($folder)) {
$response['success'] = true;
if (Module::isInstalled($module->name)) {
$response['msg'] = $this->l('module already installed, update if available');
@@ -1704,6 +1698,9 @@ class AdminModulesControllerCore extends AdminController
'author' => $module->author,
'image' => $module->image ? $module->image : ''
);
} else {
$this->errors[] = $this->l('The uploaded file does not contain a valid module.');
$response['errors'] = $this->errors;
}
} else {
$response['errors'] = $this->errors;