35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace KupShop\KupShopBundle\Controller;
|
|
|
|
use Http\Client\Exception;
|
|
use KupShop\AdminBundle\Util\ActivityLog;
|
|
use KupShop\KupShopBundle\Util\System\PathFinder;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
|
class PohodaController extends AbstractController
|
|
{
|
|
/**
|
|
* @Route("/socket/launch.php")
|
|
*/
|
|
public function socketPohodaAction(PathFinder $pathFinder)
|
|
{
|
|
$response = new StreamedResponse(function () use ($pathFinder) {
|
|
global $cfg, $dbcfg, $adminID, $ctrl;
|
|
|
|
define('POHODA_SYMFONY', true);
|
|
chdir($pathFinder->shopPath('socket/'));
|
|
|
|
try {
|
|
require_once './launch.php';
|
|
} catch (Exception $e) {
|
|
addActivityLog(ActivityLog::SEVERITY_ERROR, ActivityLog::TYPE_SYNC, 'Pohoda synchronizace: '.$e->getMessage());
|
|
}
|
|
});
|
|
|
|
return $response;
|
|
}
|
|
}
|