update 0.3.7 -> 0.3.8
This commit is contained in:
parent
bba1df38dc
commit
d0a5ad4cf0
@ -636,8 +636,8 @@ class intaro_intarocrm extends CModule
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step4.php'
|
||||
);
|
||||
} else if ($step == 5) {
|
||||
|
||||
} else if ($step == 5) {
|
||||
if(isset($arResult['errCode']) && $arResult['errCode']) {
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
@ -662,31 +662,31 @@ class intaro_intarocrm extends CModule
|
||||
$arResult['errCode'] = 'ERR_IBLOCK';
|
||||
}
|
||||
|
||||
if(!CModule::IncludeModule("catalog")) {
|
||||
if (!CModule::IncludeModule("catalog")) {
|
||||
$arResult['errCode'] = 'ERR_CATALOG';
|
||||
}
|
||||
|
||||
if(!isset($_POST['IBLOCK_EXPORT']))
|
||||
if (!isset($_POST['IBLOCK_EXPORT']))
|
||||
$iblocks = 0;
|
||||
else
|
||||
$iblocks = $_POST['IBLOCK_EXPORT'];
|
||||
|
||||
if(!isset($_POST['IBLOCK_PROPERTY_ARTICLE']))
|
||||
if (!isset($_POST['IBLOCK_PROPERTY_ARTICLE']))
|
||||
$articleProperties = 0;
|
||||
else
|
||||
$articleProperties = $_POST['IBLOCK_PROPERTY_ARTICLE'];
|
||||
|
||||
if(!isset($_POST['SETUP_PROFILE_NAME']))
|
||||
if (!isset($_POST['SETUP_PROFILE_NAME']))
|
||||
$profileName = 0;
|
||||
else
|
||||
$profileName = $_POST['SETUP_PROFILE_NAME'];
|
||||
|
||||
if(!isset($_POST['SETUP_FILE_NAME']))
|
||||
if (!isset($_POST['SETUP_FILE_NAME']))
|
||||
$filename = 0;
|
||||
else
|
||||
$filename = $_POST['SETUP_FILE_NAME'];
|
||||
|
||||
if(!isset($_POST['TYPE_LOADING']))
|
||||
if (!isset($_POST['TYPE_LOADING']))
|
||||
$typeLoading = 0;
|
||||
else
|
||||
$typeLoading = $_POST['TYPE_LOADING'];
|
||||
@ -699,9 +699,8 @@ class intaro_intarocrm extends CModule
|
||||
$loader->filename = $filename;
|
||||
$loader->application = $APPLICATION;
|
||||
$loader->Load();
|
||||
|
||||
}
|
||||
if(!isset($_POST['TYPE_LOADING']))
|
||||
if (!isset($_POST['TYPE_LOADING']))
|
||||
$typeLoading = 0;
|
||||
else
|
||||
$typeLoading = $_POST['TYPE_LOADING'];
|
||||
@ -710,8 +709,8 @@ class intaro_intarocrm extends CModule
|
||||
$dbProfile = CCatalogExport::GetList(array(), array("FILE_NAME" => $this->INTARO_CRM_EXPORT));
|
||||
|
||||
while ($arProfile = $dbProfile->Fetch()) {
|
||||
if ($arProfile["DEFAULT_PROFILE"]!="Y")
|
||||
CAgent::RemoveAgent("CCatalogExport::PreGenerateExport(".$arProfile['ID'].");", "catalog");
|
||||
if ($arProfile["DEFAULT_PROFILE"] != "Y")
|
||||
CAgent::RemoveAgent("CCatalogExport::PreGenerateExport(" . $arProfile['ID'] . ");", "catalog");
|
||||
}
|
||||
$ar = $this->GetProfileSetupVars($iblocks, $articleProperties, $filename);
|
||||
$PROFILE_ID = CCatalogExport::Add(array(
|
||||
@ -735,77 +734,67 @@ class intaro_intarocrm extends CModule
|
||||
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
|
||||
$dateAgent->add($intAgent);
|
||||
CAgent::AddAgent(
|
||||
"CCatalogExport::PreGenerateExport(" . $PROFILE_ID . ");",
|
||||
"catalog",
|
||||
"N",
|
||||
86400,
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first check
|
||||
"CCatalogExport::PreGenerateExport(" . $PROFILE_ID . ");", "catalog", "N", 86400, $dateAgent->format('d.m.Y H:i:s'), // date of first check
|
||||
"Y", // агент активен
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first start
|
||||
30
|
||||
);
|
||||
|
||||
CCatalogExport::Update($PROFILE_ID, array(
|
||||
"IN_CRON" => ($arProfile["IN_AGENT"]=="Y" ? "N" : "Y")
|
||||
"IN_CRON" => ($arProfile["IN_AGENT"] == "Y" ? "N" : "Y")
|
||||
));
|
||||
} else {
|
||||
$agent_period = 24;
|
||||
$agent_php_path = "/usr/local/php/bin/php";
|
||||
|
||||
if (!file_exists($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."cron_frame.php"))
|
||||
{
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS);
|
||||
$tmp_file_size = filesize($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS_DEF."cron_frame.php");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS_DEF."cron_frame.php", "rb");
|
||||
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "cron_frame.php")) {
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS);
|
||||
$tmp_file_size = filesize($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS_DEF . "cron_frame.php");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS_DEF . "cron_frame.php", "rb");
|
||||
$tmp_data = fread($fp, $tmp_file_size);
|
||||
fclose($fp);
|
||||
|
||||
$tmp_data = str_replace("#DOCUMENT_ROOT#", $_SERVER["DOCUMENT_ROOT"], $tmp_data);
|
||||
$tmp_data = str_replace("#PHP_PATH#", $agent_php_path, $tmp_data);
|
||||
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."cron_frame.php", "ab");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "cron_frame.php", "ab");
|
||||
fwrite($fp, $tmp_data);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$cfg_data = "";
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg"))
|
||||
{
|
||||
$cfg_file_size = filesize($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg", "rb");
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg")) {
|
||||
$cfg_file_size = filesize($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", "rb");
|
||||
$cfg_data = fread($fp, $cfg_file_size);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."logs/");
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "logs/");
|
||||
|
||||
if ($arProfile["IN_CRON"]=="Y")
|
||||
{
|
||||
if ($arProfile["IN_CRON"] == "Y") {
|
||||
// remove
|
||||
$cfg_data = preg_replace("#^.*?".preg_quote(CATALOG_PATH2EXPORTS)."cron_frame.php +".$PROFILE_ID." *>.*?$#im", "", $cfg_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$strTime = "0 */".$agent_period." * * * ";
|
||||
if (strlen($cfg_data)>0)
|
||||
$cfg_data = preg_replace("#^.*?" . preg_quote(CATALOG_PATH2EXPORTS) . "cron_frame.php +" . $PROFILE_ID . " *>.*?$#im", "", $cfg_data);
|
||||
} else {
|
||||
$strTime = "0 */" . $agent_period . " * * * ";
|
||||
if (strlen($cfg_data) > 0)
|
||||
$cfg_data .= "\n";
|
||||
|
||||
$cfg_data .= $strTime.$agent_php_path." -f ".$_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."cron_frame.php ".$PROFILE_ID." >".$_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."logs/".$PROFILE_ID.".txt\n";
|
||||
$cfg_data .= $strTime . $agent_php_path . " -f " . $_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "cron_frame.php " . $PROFILE_ID . " >" . $_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "logs/" . $PROFILE_ID . ".txt\n";
|
||||
}
|
||||
|
||||
CCatalogExport::Update($PROFILE_ID, array(
|
||||
"IN_CRON" => ($arProfile["IN_CRON"]=="Y" ? "N" : "Y")
|
||||
"IN_CRON" => ($arProfile["IN_CRON"] == "Y" ? "N" : "Y")
|
||||
));
|
||||
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/");
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/");
|
||||
$cfg_data = preg_replace("#[\r\n]{2,}#im", "\n", $cfg_data);
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg", "wb");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", "wb");
|
||||
fwrite($fp, $cfg_data);
|
||||
fclose($fp);
|
||||
|
||||
$arRetval = array();
|
||||
@exec("crontab ".$_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg", $arRetval, $return_var);
|
||||
|
||||
@exec("crontab " . $_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", $arRetval, $return_var);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
$arModuleVersion = array(
|
||||
'VERSION' => '0.3.7',
|
||||
'VERSION_DATE' => '2013-08-14 10:59:00',
|
||||
'VERSION' => '0.3.8',
|
||||
'VERSION_DATE' => '2013-08-14 19:32:00',
|
||||
);
|
Loading…
Reference in New Issue
Block a user