first commit
This commit is contained in:
34
modules/ps_eventbus/controllers/admin/index.php
Normal file
34
modules/ps_eventbus/controllers/admin/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
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;
|
||||
23
modules/ps_eventbus/controllers/front/apiCarts.php
Normal file
23
modules/ps_eventbus/controllers/front/apiCarts.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Provider\CartDataProvider;
|
||||
|
||||
class ps_EventbusApiCartsModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'carts';
|
||||
|
||||
/**
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$cartDataProvider = $this->module->getService(CartDataProvider::class);
|
||||
|
||||
$response = $this->handleDataSync($cartDataProvider);
|
||||
|
||||
$this->exitWithResponse($response);
|
||||
}
|
||||
}
|
||||
23
modules/ps_eventbus/controllers/front/apiCategories.php
Normal file
23
modules/ps_eventbus/controllers/front/apiCategories.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Provider\CategoryDataProvider;
|
||||
|
||||
class ps_EventbusApiCategoriesModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'categories';
|
||||
|
||||
/**
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$categoryDataProvider = $this->module->getService(CategoryDataProvider::class);
|
||||
|
||||
$response = $this->handleDataSync($categoryDataProvider);
|
||||
|
||||
$this->exitWithResponse($response);
|
||||
}
|
||||
}
|
||||
30
modules/ps_eventbus/controllers/front/apiDeletedObjects.php
Normal file
30
modules/ps_eventbus/controllers/front/apiDeletedObjects.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Exception\EnvVarException;
|
||||
use PrestaShop\Module\PsEventbus\Service\DeletedObjectsService;
|
||||
|
||||
class ps_EventbusApiDeletedObjectsModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'deleted';
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$jobId = Tools::getValue('job_id', '');
|
||||
|
||||
/** @var DeletedObjectsService $deletedObjectsService */
|
||||
$deletedObjectsService = $this->module->getService(DeletedObjectsService::class);
|
||||
|
||||
try {
|
||||
$response = $deletedObjectsService->handleDeletedObjectsSync($jobId);
|
||||
$this->exitWithResponse($response);
|
||||
} catch (PrestaShopDatabaseException $exception) {
|
||||
$this->exitWithExceptionMessage($exception);
|
||||
} catch (EnvVarException $exception) {
|
||||
$this->exitWithExceptionMessage($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Config\Config;
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Provider\GoogleTaxonomyDataProvider;
|
||||
|
||||
class ps_EventbusApiGoogleTaxonomiesModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'taxonomies';
|
||||
|
||||
/**
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
if (!Module::isInstalled('ps_facebook')) {
|
||||
$this->exitWithExceptionMessage(new Exception('Facebook module is not installed', Config::PS_FACEBOOK_NOT_INSTALLED));
|
||||
}
|
||||
|
||||
$categoryDataProvider = $this->module->getService(GoogleTaxonomyDataProvider::class);
|
||||
|
||||
$response = $this->handleDataSync($categoryDataProvider);
|
||||
|
||||
$this->exitWithResponse($response);
|
||||
}
|
||||
}
|
||||
26
modules/ps_eventbus/controllers/front/apiHealthCheck.php
Normal file
26
modules/ps_eventbus/controllers/front/apiHealthCheck.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Repository\ServerInformationRepository;
|
||||
|
||||
class ps_EventbusApiHealthCheckModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'shops';
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
/** @var ServerInformationRepository $serverInformationRepository */
|
||||
$serverInformationRepository = $this->module->getService(ServerInformationRepository::class);
|
||||
|
||||
$status = $serverInformationRepository->getHealthCheckData();
|
||||
|
||||
$this->exitWithResponse($status);
|
||||
}
|
||||
}
|
||||
44
modules/ps_eventbus/controllers/front/apiInfo.php
Normal file
44
modules/ps_eventbus/controllers/front/apiInfo.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Exception\EnvVarException;
|
||||
use PrestaShop\Module\PsEventbus\Repository\ServerInformationRepository;
|
||||
|
||||
class ps_EventbusApiInfoModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'shops';
|
||||
|
||||
/**
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
$jobId = Tools::getValue('job_id');
|
||||
|
||||
$serverInformationRepository = $this->module->getService(ServerInformationRepository::class);
|
||||
|
||||
$serverInfo = $serverInformationRepository->getServerInformation(Tools::getValue('lang_iso', null));
|
||||
|
||||
try {
|
||||
$response = $this->proxyService->upload($jobId, $serverInfo, $this->startTime);
|
||||
} catch (EnvVarException $exception) {
|
||||
$this->exitWithExceptionMessage($exception);
|
||||
} catch (Exception $exception) {
|
||||
$this->exitWithExceptionMessage($exception);
|
||||
}
|
||||
|
||||
$this->exitWithResponse(
|
||||
array_merge(
|
||||
[
|
||||
'remaining_objects' => 0,
|
||||
'total_objects' => 1,
|
||||
],
|
||||
$response
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
26
modules/ps_eventbus/controllers/front/apiModules.php
Normal file
26
modules/ps_eventbus/controllers/front/apiModules.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Provider\ModuleDataProvider;
|
||||
use PrestaShop\Module\PsEventbus\Repository\ModuleRepository;
|
||||
|
||||
class ps_EventbusApiModulesModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'modules';
|
||||
|
||||
/**
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$moduleDataProvider = new ModuleDataProvider(
|
||||
new ModuleRepository(Db::getInstance())
|
||||
);
|
||||
|
||||
$response = $this->handleDataSync($moduleDataProvider);
|
||||
|
||||
$this->exitWithResponse($response);
|
||||
}
|
||||
}
|
||||
23
modules/ps_eventbus/controllers/front/apiOrders.php
Normal file
23
modules/ps_eventbus/controllers/front/apiOrders.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Provider\OrderDataProvider;
|
||||
|
||||
class ps_EventbusApiOrdersModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'orders';
|
||||
|
||||
/**
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$orderDataProvider = $this->module->getService(OrderDataProvider::class);
|
||||
|
||||
$response = $this->handleDataSync($orderDataProvider);
|
||||
|
||||
$this->exitWithResponse($response);
|
||||
}
|
||||
}
|
||||
23
modules/ps_eventbus/controllers/front/apiProducts.php
Normal file
23
modules/ps_eventbus/controllers/front/apiProducts.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Provider\ProductDataProvider;
|
||||
|
||||
class ps_EventbusApiProductsModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'products';
|
||||
|
||||
/**
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$productDataProvider = $this->module->getService(ProductDataProvider::class);
|
||||
|
||||
$response = $this->handleDataSync($productDataProvider);
|
||||
|
||||
$this->exitWithResponse($response);
|
||||
}
|
||||
}
|
||||
42
modules/ps_eventbus/controllers/front/apiThemes.php
Normal file
42
modules/ps_eventbus/controllers/front/apiThemes.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Exception\EnvVarException;
|
||||
use PrestaShop\Module\PsEventbus\Repository\ThemeRepository;
|
||||
|
||||
class ps_EventbusApiThemesModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'themes';
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
$jobId = Tools::getValue('job_id');
|
||||
|
||||
$themeRepository = $this->module->getService(ThemeRepository::class);
|
||||
|
||||
$themeInfo = $themeRepository->getThemes();
|
||||
|
||||
try {
|
||||
$response = $this->proxyService->upload($jobId, $themeInfo, $this->startTime);
|
||||
} catch (EnvVarException $exception) {
|
||||
$this->exitWithExceptionMessage($exception);
|
||||
} catch (Exception $exception) {
|
||||
$this->exitWithExceptionMessage($exception);
|
||||
}
|
||||
|
||||
$this->exitWithResponse(
|
||||
array_merge(
|
||||
[
|
||||
'remaining_objects' => 0,
|
||||
'total_objects' => count($themeInfo),
|
||||
],
|
||||
$response
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
34
modules/ps_eventbus/controllers/front/index.php
Normal file
34
modules/ps_eventbus/controllers/front/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
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;
|
||||
34
modules/ps_eventbus/controllers/index.php
Normal file
34
modules/ps_eventbus/controllers/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
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;
|
||||
Reference in New Issue
Block a user