multiple site fix
This commit is contained in:
parent
37634e19a4
commit
fa612ab5a4
@ -1089,7 +1089,14 @@ class ICrmOrderActions
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static function orderAgent() {
|
public static function orderAgent() {
|
||||||
if(self::isForkable()) {
|
$rsSites = CSite::GetList($by, $sort, array('DEF' => 'Y'));
|
||||||
|
$defaultSite = array();
|
||||||
|
while ($ar = $rsSites->Fetch()) {
|
||||||
|
$defaultSite = $ar;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(self::isForkable($defaultSite)) {
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, ($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') .
|
curl_setopt($ch, CURLOPT_URL, ($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') .
|
||||||
$_SERVER['SERVER_NAME'] . '/retailcrm/agent.php');
|
$_SERVER['SERVER_NAME'] . '/retailcrm/agent.php');
|
||||||
@ -1529,14 +1536,21 @@ class ICrmOrderActions
|
|||||||
* Returns true if a not a crontab
|
* Returns true if a not a crontab
|
||||||
* or if $dir exists
|
* or if $dir exists
|
||||||
*/
|
*/
|
||||||
public static function isForkable() {
|
public static function isForkable($defaultSite = array()) {
|
||||||
$fork = COption::GetOptionString('main', 'agents_use_crontab', 'N');
|
$docRoot = !empty($defaultSite) ? $defaultSite['ABS_DOC_ROOT'] : $_SERVER['DOCUMENT_ROOT'];
|
||||||
if($fork === 'N') {
|
if(!empty($defaultSite)) {
|
||||||
$file = $_SERVER['DOCUMENT_ROOT'] . '/retailcrm/agent.php';
|
$serverName = $defaultSite['SERVER_NAME'];
|
||||||
return file_exists($file) && is_callable('curl_init') &&
|
} else {
|
||||||
isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'];
|
if(isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'])
|
||||||
|
$serverName = $_SERVER['SERVER_NAME'];
|
||||||
|
else
|
||||||
|
$serverName = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$fork = COption::GetOptionString('main', 'agents_use_crontab', 'N');
|
||||||
|
if($fork === 'N')
|
||||||
|
return file_exists($docRoot . '/retailcrm/agent.php') && is_callable('curl_init') && $serverName;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
define('NO_AGENT_CHECK', true);
|
||||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
|
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
|
||||||
if ($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) die('You are not allowed to access this file.');
|
if ($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) die('You are not allowed to access this file.');
|
||||||
if (!CModule::IncludeModule('intaro.intarocrm')) die('retailCRM not installed.');
|
if (!CModule::IncludeModule('intaro.intarocrm')) die('retailCRM not installed.');
|
||||||
|
@ -1320,18 +1320,32 @@ class intaro_intarocrm extends CModule {
|
|||||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/export/', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/', true, true
|
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/export/', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/', true, true
|
||||||
);
|
);
|
||||||
|
|
||||||
if(mkdir($_SERVER['DOCUMENT_ROOT'] . '/retailcrm/')) {
|
$rsSites = CSite::GetList($by, $sort, array('DEF' => 'Y'));
|
||||||
|
$defaultSite = array();
|
||||||
|
while ($ar = $rsSites->Fetch()) {
|
||||||
|
$defaultSite = $ar;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mkdir($defaultSite['ABS_DOC_ROOT'] . '/retailcrm/')) {
|
||||||
CopyDirFiles(
|
CopyDirFiles(
|
||||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/retailcrm/', $_SERVER['DOCUMENT_ROOT'] . '/retailcrm/', true, true
|
$defaultSite['ABS_DOC_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/retailcrm/', $defaultSite['ABS_DOC_ROOT'] . '/retailcrm/', true, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function DeleteFiles() {
|
function DeleteFiles() {
|
||||||
|
$rsSites = CSite::GetList($by, $sort, array('DEF' => 'Y'));
|
||||||
|
$defaultSite = array();
|
||||||
|
while ($ar = $rsSites->Fetch()) {
|
||||||
|
$defaultSite = $ar;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_run.php');
|
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_run.php');
|
||||||
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php');
|
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php');
|
||||||
unlink($_SERVER['DOCUMENT_ROOT'] . '/retailcrm/agent.php');
|
unlink($defaultSite['ABS_DOC_ROOT'] . '/retailcrm/agent.php');
|
||||||
rmdir($_SERVER['DOCUMENT_ROOT'] . '/retailcrm/');
|
rmdir($defaultSite['ABS_DOC_ROOT'] . '/retailcrm/');
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesUnitProduct, $propertiesSKU, $propertiesUnitSKU, $filename) {
|
function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesUnitProduct, $propertiesSKU, $propertiesUnitSKU, $filename) {
|
||||||
|
Loading…
Reference in New Issue
Block a user