Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,71 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_2_0_0($module)
{
// Retrieve all hooks registered with MBO
$hookData = Db::getInstance()->executeS('
SELECT DISTINCT(`id_hook`)
FROM `' . _DB_PREFIX_ . 'hook_module`
WHERE `id_module` = ' . (int) $module->id
);
// Some hooks are no longer used, we unregister them.
if (!empty($hookData)) {
foreach ($hookData as $row) {
if (false === $module->unregisterHook((int) $row['id_hook'])) {
return false;
}
if (false === $module->unregisterExceptions((int) $row['id_hook'])) {
return false;
}
}
}
// Some hooks are added, we register them.
if (
false === $module->registerHook([
'actionAdminControllerSetMedia',
'displayDashboardTop',
])
) {
return false;
}
// We migrate Module Selections Tab to MBO
if (false === $module->installTab(ps_mbo::$ADMIN_CONTROLLERS['AdminPsMboSelection'])) {
return false;
}
// We create Module Recommended Tab to MBO
if (false === $module->installTab(ps_mbo::$ADMIN_CONTROLLERS['AdminPsMboRecommended'])) {
return false;
}
return true;
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_1_0(Module $module): bool
{
// We migrate Module Selections Tab to MBO
if (false === $module->installTables('mbo_api_config')) {
return false;
}
$module->updateHooks();
$module->updateTabs();
return true;
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_1_1(Module $module): bool
{
$parentTab = Tab::getInstanceFromClassName('AdminPsMboModuleParent');
$moduleTab = Tab::getInstanceFromClassName('AdminPsMboModule');
$languages = Language::getIDs(false);
$tabNameByLangId = array_fill_keys($languages, 'Marketplace');
if (Validate::isLoadedObject($parentTab)) {
$parentTab->name = $tabNameByLangId;
$parentTab->save();
}
if (Validate::isLoadedObject($moduleTab)) {
$moduleTab->name = $tabNameByLangId;
$moduleTab->save();
}
return true;
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
$rootDir = defined('_PS_ROOT_DIR_') ? _PS_ROOT_DIR_ : getenv('_PS_ROOT_DIR_');
if (!$rootDir) {
$rootDir = __DIR__ . '/../../../';
}
require_once $rootDir . '/vendor/autoload.php';
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_10_0(Module $module): bool
{
$module->updateHooks();
$module->updateTabs();
return true;
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_2_0(Module $module): bool
{
$module->updateHooks();
return true;
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_3_0(Module $module): bool
{
$module->updateHooks();
$module->updateTabs();
// Put the marketplace tab at first position of his parent
$tab = Tab::getInstanceFromClassName('AdminPsMboModuleParent');
if (Validate::isLoadedObject($tab)) {
$tab->position = 0;
if (false === $tab->save()) {
return false;
}
// This will reorder the tabs starting with 1
$tab->cleanPositions($tab->id_parent);
}
// Rename "Module Selections" to "Spotlighted modules"
$tab = Tab::getInstanceFromClassName('AdminPsMboSelection');
if (Validate::isLoadedObject($tab)) {
$tabNameByLangId = array_fill_keys(
Language::getIDs(false),
'Modules in the spotlight'
);
$tab->name = $tabNameByLangId;
$tab->wording = 'Modules in the spotlight';
$tab->wording_domain = 'Modules.Mbo.Modulesselection';
if (false === $tab->save()) {
return false;
}
$module->postponeTabsTranslations();
}
return true;
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_3_1(Module $module): bool
{
$module->updateHooks();
$module->updateTabs();
return true;
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_4_1(Module $module): bool
{
$module->updateHooks();
$module->updateTabs();
return true;
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_4_2(Module $module): bool
{
$module->updateHooks();
$module->updateTabs();
return true;
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
$rootDir = defined('_PS_ROOT_DIR_') ? _PS_ROOT_DIR_ : getenv('_PS_ROOT_DIR_');
if (!$rootDir) {
$rootDir = __DIR__ . '/../../../';
}
require_once $rootDir . '/vendor/autoload.php';
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_7_0(Module $module): bool
{
$module->updateHooks();
$module->updateTabs();
$singleShop = PrestaShop\Module\Mbo\Helpers\Config::getDefaultShop();
$domains = Tools::getDomains();
$shopDomain = array_filter(
$domains,
function ($domain) use ($singleShop) {
// Here we assume that every shop have a single domain (?)
$domain = reset($domain);
return isset($domain['id_shop']) && (int) $singleShop->id === (int) $domain['id_shop'];
}
);
if (!empty($shopDomain)) {
$domain = array_keys($shopDomain)[0];
$domain = preg_replace('#(https?://)#', '', $domain);
// concatenate the physical_uri
$domainDef = reset($shopDomain[$domain]);
if (isset($domainDef['physical']) && '/' !== $domainDef['physical']) {
$moduleCacheDir = $module->moduleCacheDir;
$lockFile = $moduleCacheDir . 'updateShop.lock';
if (!file_exists($lockFile)) {
if (!is_dir($moduleCacheDir)) {
mkdir($moduleCacheDir, 0777, true);
}
$f = fopen($lockFile, 'w+');
fclose($f);
}
}
}
return true;
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
$rootDir = defined('_PS_ROOT_DIR_') ? _PS_ROOT_DIR_ : getenv('_PS_ROOT_DIR_');
if (!$rootDir) {
$rootDir = __DIR__ . '/../../../';
}
require_once $rootDir . '/vendor/autoload.php';
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_4_9_0(Module $module): bool
{
$module->updateHooks();
$module->updateTabs();
return true;
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
$rootDir = defined('_PS_ROOT_DIR_') ? _PS_ROOT_DIR_ : getenv('_PS_ROOT_DIR_');
if (!$rootDir) {
$rootDir = __DIR__ . '/../../../';
}
require_once $rootDir . '/vendor/autoload.php';
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_5_0_0(Module $module): bool
{
$module->updateHooks();
$module->updateTabs();
return true;
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
$rootDir = defined('_PS_ROOT_DIR_') ? _PS_ROOT_DIR_ : getenv('_PS_ROOT_DIR_');
if (!$rootDir) {
$rootDir = __DIR__ . '/../../../';
}
require_once $rootDir . '/vendor/autoload.php';
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_5_0_1(Module $module): bool
{
$module->updateHooks();
return true;
}

View File

@@ -0,0 +1,100 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
$rootDir = defined('_PS_ROOT_DIR_') ? _PS_ROOT_DIR_ : getenv('_PS_ROOT_DIR_');
if (!$rootDir) {
$rootDir = __DIR__ . '/../../../';
}
require_once $rootDir . '/vendor/autoload.php';
if (!function_exists('mboUpgradeDeleteFolderRecursively')) {
function mboUpgradeDeleteFolderRecursively(string $folderPath): void
{
if (!is_dir($folderPath)) {
return;
}
$files = @scandir($folderPath);
if ($files === false) {
return;
}
$files = array_diff($files, ['.', '..']);
foreach ($files as $file) {
$filePath = $folderPath . DIRECTORY_SEPARATOR . $file;
if (is_dir($filePath)) {
mboUpgradeDeleteFolderRecursively($filePath);
} else {
mboUpgradeSafeUnlink($filePath);
}
}
@rmdir($folderPath);
}
}
if (!function_exists('mboUpgradeSafeUnlink')) {
function mboUpgradeSafeUnlink(string $filePath): void
{
if (file_exists($filePath) && is_file($filePath)) {
@unlink($filePath);
}
}
}
/**
* @param ps_mbo $module
*
* @return bool
*/
function upgrade_module_5_2_0(Module $module): bool
{
$moduleDir = _PS_MODULE_DIR_ . 'ps_mbo';
try {
$module->updateHooks();
mboUpgradeDeleteFolderRecursively($moduleDir . '/src/Tab');
// Remove individual obsolete files
mboUpgradeSafeUnlink($moduleDir . '/config/services/tab.yml');
mboUpgradeSafeUnlink($moduleDir . '/src/Controller/Admin/ModuleSelectionController.php');
mboUpgradeSafeUnlink($moduleDir . '/src/Traits/Hooks/UseActionAdminControllerSetMedia.php');
mboUpgradeSafeUnlink($moduleDir . '/src/Traits/Hooks/UseActionGetAdminToolbarButtons.php');
mboUpgradeSafeUnlink($moduleDir . '/src/Traits/Hooks/UseDisplayAdminAfterHeader.php');
mboUpgradeSafeUnlink($moduleDir . '/views/css/connection-toolbar.css');
mboUpgradeSafeUnlink($moduleDir . '/views/css/module-catalog.css');
mboUpgradeSafeUnlink($moduleDir . '/views/css/mbo-user-explanation.css');
mboUpgradeSafeUnlink($moduleDir . '/views/js/connection-toolbar.js');
mboUpgradeSafeUnlink($moduleDir . '/views/js/mbo-user-explanation.js');
mboUpgradeSafeUnlink($moduleDir . '/views/templates/hook/configure-toolbar.tpl');
mboUpgradeSafeUnlink($moduleDir . '/views/templates/hook/dashboard-zone-two.tpl');
mboUpgradeSafeUnlink($moduleDir . '/views/templates/hook/twig/explanation_mbo_employee.html.twig');
mboUpgradeSafeUnlink($moduleDir . '/views/templates/hook/twig/failed-api-user.html.twig');
return true;
} catch (Exception $e) {
return true;
}
}