mirror of
https://github.com/retailcrm/legacy.git
synced 2025-04-17 16:11:11 +00:00
Compare commits
19 commits
Author | SHA1 | Date | |
---|---|---|---|
|
095ebf61f1 | ||
|
1436213f1c | ||
|
59fc87a0c5 | ||
|
be7345aaaa | ||
|
5d91549f01 | ||
|
b3a041482e | ||
|
3e08653ca9 | ||
|
3d3a3b72ab | ||
|
34996d2b84 | ||
|
d6dad7bd4d | ||
|
56ec1a7247 | ||
|
d19f9f7699 | ||
|
7d7494ae64 | ||
|
2f9596be2b | ||
|
e836c6ae64 | ||
|
f21576b2c2 | ||
|
6f958c739b | ||
|
1648e9f178 | ||
|
623416a85c |
9 changed files with 59 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
|||
Legacy
|
||||
======
|
||||
Legacy (устаревший, не рекомендуется к использованию)
|
||||
=====================================================
|
||||
|
||||
Микрофреймворк для интеграции устаревших платформ (php <= 5.2.17), либо, в случае отсутствия модуля для конкретной платформы.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ domain=site.ru
|
|||
icml_file=retailcrm.xml
|
||||
shop_url=http://www.site.ru
|
||||
shop_name=Simple Shop
|
||||
support=integration@retailcrm.ru
|
||||
support=your_email@example.com
|
||||
notify=noreply@example.com
|
||||
|
||||
[api]
|
||||
url=https://demo.retailcrm.ru
|
||||
|
@ -18,7 +19,7 @@ driver=mysql
|
|||
enabled=false
|
||||
|
||||
[mail]
|
||||
mail@example.com=login,password,imap.example.com,993,imap
|
||||
mail@example.com=login,password,imap.example.com,993,imap,SpecialFolderName
|
||||
mail@example.org=login,password,pop.example.org,995,pop
|
||||
enabled=false
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ class CustomersBuilder extends Builder
|
|||
*/
|
||||
public function buildCustomersById($uidString)
|
||||
{
|
||||
$uids = DataHelper::explodeUids($uidString);
|
||||
$query = $this->rule->getSQL('customers_uid');
|
||||
$handler = $this->rule->getHandler('CustomersHandler');
|
||||
$this->sql = $this->container->db->prepare($query);
|
||||
$this->sql->bindParam(':orderIds', $uids);
|
||||
$uids = DataHelper::explodeUids($uidString);
|
||||
|
||||
return $this->build($handler);
|
||||
}
|
||||
|
@ -74,11 +74,11 @@ class CustomersBuilder extends Builder
|
|||
*/
|
||||
public function buildCustomersUpdateById($uidString)
|
||||
{
|
||||
$uids = DataHelper::explodeUids($uidString);
|
||||
$query = $this->rule->getSQL('customers_update_uid');
|
||||
$handler = $this->rule->getHandler('CustomersHandler');
|
||||
$this->sql = $this->container->db->prepare($query);
|
||||
$this->sql->bindParam(':orderIds', $uids);
|
||||
$uids = DataHelper::explodeUids($uidString);
|
||||
|
||||
return $this->build($handler);
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ class Command
|
|||
break;
|
||||
case 'payment-statuses':
|
||||
$reference = $builder->buildPaymentStatuses();
|
||||
$this->requestHelper->uploadDeliveryStatuses($reference);
|
||||
$this->requestHelper->uploadPaymentStatuses($reference);
|
||||
break;
|
||||
case 'statuses':
|
||||
$reference = $builder->buildStatuses();
|
||||
|
@ -242,7 +242,7 @@ class Command
|
|||
$this->requestHelper->uploadPaymentTypes($paymentTypes);
|
||||
|
||||
$paymentStatuses = $builder->buildPaymentStatuses();
|
||||
$this->requestHelper->uploadDeliveryStatuses($paymentStatuses);
|
||||
$this->requestHelper->uploadPaymentStatuses($paymentStatuses);
|
||||
|
||||
$statuses = $builder->buildStatuses();
|
||||
$this->requestHelper->uploadStatuses($statuses);
|
||||
|
|
|
@ -59,6 +59,7 @@ class Container
|
|||
);
|
||||
|
||||
$this->db->exec("set names utf8");
|
||||
$this->db->exec("set group_concat_max_len = 1000000");
|
||||
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
|
||||
} catch (PDOException $e) {
|
||||
CommandHelper::activateNotice('database');
|
||||
|
|
|
@ -6,7 +6,7 @@ class Logger
|
|||
private $push;
|
||||
private $files;
|
||||
|
||||
public function __construct($rotate = true, $push = true, $files = 5)
|
||||
public function __construct($rotate = true, $push = false, $files = 5)
|
||||
{
|
||||
$this->rotate = $rotate;
|
||||
$this->push = $push;
|
||||
|
@ -101,10 +101,9 @@ class Logger
|
|||
{
|
||||
$domain = $this->container->domain;
|
||||
$recipient = $this->container->support;
|
||||
$subject = 'Legacy notification';
|
||||
$headers = 'From: noreply@retailcrm.ru' . "\r\n" .
|
||||
'X-Mailer: PHP/' . phpversion();
|
||||
$message = "New log message from $domain:\n\n$message";
|
||||
$subject = sprintf("Legacy notification from %s", $domain);
|
||||
$headers = sprintf("From: %s\r\nX-Mailer: PHP/%s", $this->container->notify, phpversion());
|
||||
$message = sprintf("New log message from %s:\n\n%s\n", $domain, $message);
|
||||
|
||||
mail($recipient, $subject, $message, $headers);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class Mail
|
|||
$this->mailBox = $mailBox;
|
||||
|
||||
if (is_array($this->container->mail)) {
|
||||
if(isset($this->container->mail[$mailBox])) {
|
||||
if (isset($this->container->mail[$mailBox])) {
|
||||
$this->mailSettings = explode(
|
||||
',',
|
||||
$this->container->mail[$mailBox]
|
||||
|
@ -32,6 +32,7 @@ class Mail
|
|||
|
||||
public function parse()
|
||||
{
|
||||
|
||||
$server = new Server(
|
||||
$this->mailSettings[2],
|
||||
$this->mailSettings[3],
|
||||
|
@ -43,6 +44,10 @@ class Mail
|
|||
$this->mailSettings[1]
|
||||
);
|
||||
|
||||
if (!empty($this->mailSettings[5])) {
|
||||
$server->setMailBox($this->mailSettings[5]);
|
||||
}
|
||||
|
||||
$mailCriteria = $this->clean($this->mailBox, 'criteria');
|
||||
$mailHandler = $this->clean($this->mailBox, 'handler');
|
||||
|
||||
|
|
|
@ -46,11 +46,22 @@ class RequestProxy
|
|||
"[$method] " . $e->getMessage() . "\n",
|
||||
$this->container->errorLog
|
||||
);
|
||||
|
||||
return null;
|
||||
} catch (InvalidJsonException $e) {
|
||||
$this->logger->write(
|
||||
"[$method] " . $e->getMessage() . "\n",
|
||||
$this->container->errorLog
|
||||
);
|
||||
|
||||
return null;
|
||||
} catch (InvalidArgumentException $e) {
|
||||
$this->logger->write(
|
||||
"[$method] " . $e->getMessage() . "\n",
|
||||
$this->container->errorLog
|
||||
);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ class IcmlHelper
|
|||
protected $offers;
|
||||
|
||||
protected $chunk = 500;
|
||||
protected $fileLifeTime = 3600;
|
||||
|
||||
public function __construct($shop, $file)
|
||||
{
|
||||
|
@ -33,28 +34,37 @@ class IcmlHelper
|
|||
|
||||
public function generate($categories, $offers)
|
||||
{
|
||||
if (!file_exists($this->tmpFile)) {
|
||||
if (file_exists($this->tmpFile)) {
|
||||
if (filectime($this->tmpFile) + $this->fileLifeTime < time()) {
|
||||
unlink($this->tmpFile);
|
||||
$this->writeHead();
|
||||
}
|
||||
} else {
|
||||
$this->writeHead();
|
||||
}
|
||||
|
||||
if (!empty($categories)) {
|
||||
$this->writeCategories($categories);
|
||||
unset($categories);
|
||||
try {
|
||||
if (!empty($categories)) {
|
||||
$this->writeCategories($categories);
|
||||
unset($categories);
|
||||
}
|
||||
|
||||
if (!empty($offers)) {
|
||||
$this->writeOffers($offers);
|
||||
unset($offers);
|
||||
}
|
||||
|
||||
$dom = dom_import_simplexml(simplexml_load_file($this->tmpFile))->ownerDocument;
|
||||
$dom->formatOutput = true;
|
||||
$formatted = $dom->saveXML();
|
||||
|
||||
unset($dom, $this->xml);
|
||||
|
||||
file_put_contents($this->tmpFile, $formatted);
|
||||
rename($this->tmpFile, $this->file);
|
||||
} catch (Exception $e) {
|
||||
unlink($this->tmpFile);
|
||||
}
|
||||
|
||||
if (!empty($offers)) {
|
||||
$this->writeOffers($offers);
|
||||
unset($offers);
|
||||
}
|
||||
|
||||
$dom = dom_import_simplexml(simplexml_load_file($this->tmpFile))->ownerDocument;
|
||||
$dom->formatOutput = true;
|
||||
$formatted = $dom->saveXML();
|
||||
|
||||
unset($dom, $this->xml);
|
||||
|
||||
file_put_contents($this->tmpFile, $formatted);
|
||||
rename($this->tmpFile, $this->file);
|
||||
}
|
||||
|
||||
private function loadXml()
|
||||
|
|
Loading…
Add table
Reference in a new issue