protected static function save() { $ary = array(); foreach (self::$items as $entityTypeID => $time) { $ary[\CCrmOwnerType::ResolveName($entityTypeID)] = $time->format(\DateTime::ISO8601); } Main\Config\Option::set('crm', 'crm_uf_history', serialize($ary), ''); }
function InstallDB($install_wizard = true) { global $DB, $DBType, $APPLICATION; $errors = null; if (!$DB->Query("SELECT 'x' FROM b_disk_storage", true)) { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/db/" . $DBType . "/install.sql"); } $this->InstallTasks(); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } $isWebdavInstalled = isModuleInstalled('webdav'); $this->RegisterModuleDependences(!$isWebdavInstalled); RegisterModule("disk"); $this->InstallUserFields(); /** @noinspection PhpDynamicAsStaticMethodCallInspection */ CAgent::addAgent('\\Bitrix\\Disk\\ExternalLink::removeExpiredWithTypeAuto();', 'disk', 'N'); /** @noinspection PhpDynamicAsStaticMethodCallInspection */ CAgent::addAgent('\\Bitrix\\Disk\\Bitrix24Disk\\UploadFileManager::removeIrrelevant();', 'disk', 'N'); if (!$isWebdavInstalled) { require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/lib/configuration.php"; \Bitrix\Main\Config\Option::set('disk', 'successfully_converted', 'Y'); \Bitrix\Main\Config\Option::set('disk', 'disk_revision_api', \Bitrix\Disk\Configuration::REVISION_API); } else { \CAdminNotify::add(array("MESSAGE" => Loc::getMessage("DISK_NOTIFY_MIGRATE_WEBDAV", array("#LINK#" => "/bitrix/admin/disk_from_webdav_convertor.php?lang=" . \Bitrix\Main\Application::getInstance()->getContext()->getLanguage())), "TAG" => "disk_migrate_from_webdav", "MODULE_ID" => "disk", "ENABLE_CLOSE" => "N")); } return true; }
function DoInstall() { global $APPLICATION; RegisterModule($this->MODULE_ID); RegisterModuleDependences('main', 'OnBeforeEventSend', $this->MODULE_ID, '\\Um\\MailTemplate\\HandlerFacade', 'execute'); \Bitrix\Main\Config\Option::set($this->MODULE_ID, 'tpl_class_name', '\\Um\\MailTemplate\\TwigPoweredTemplateHandler'); \Bitrix\Main\Config\Option::set($this->MODULE_ID, 'tpl_class_path', '/bitrix/modules/' . $this->MODULE_ID . '/lib/twig_powered.template.handler.php'); $APPLICATION->IncludeAdminFile(GetMessage('UMT_INSTALL_TITLE'), $this->install_path . '/step.php'); }
public function save() { $this->isPersistent = false; if ($this->name !== '') { Main\Config\Option::set('crm', $this->name, serialize($this->externalize()), ''); $this->isPersistent = true; } return $this->isPersistent; }
public function set($value) { $value = (int) $value; if ($value === $this->default) { Main\Config\Option::delete('crm', array('name' => $this->name)); } else { Main\Config\Option::set('crm', $this->name, $value, ''); } }
/** * @return void */ public function save() { if ($this->bindings === null) { return; } if (!empty($this->bindings)) { Main\Config\Option::set('crm', $this->typeName, serialize($this->bindings)); } else { Main\Config\Option::delete('crm', array('name' => $this->typeName)); } }
function InstallDB($arParams = array()) { ModuleManager::registerModule('conversion'); global $DB; $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/conversion/install/db/' . strtolower($DB->type) . '/install.sql'); RegisterModuleDependences('conversion', 'OnGetCounterTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetCounterTypes'); RegisterModuleDependences('conversion', 'OnGetAttributeTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeTypes'); RegisterModuleDependences('conversion', 'OnGetAttributeGroupTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeGroupTypes'); RegisterModuleDependences('conversion', 'OnSetDayContextAttributes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onSetDayContextAttributes'); RegisterModuleDependences('main', 'OnProlog', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onProlog'); if (Option::get('conversion', 'START_DATE_TIME', 'undefined') == 'undefined') { Option::set('conversion', 'START_DATE_TIME', date('Y-m-d H:i:s')); } return true; }
/** * Enables network communication. Returns true on success. * * @param boolean $enable Pass true to enable and false to disable. * * @return boolean */ public function setEnable($enable = true) { if ($this->isEnabled() && $enable) { return true; } if (!$this->isEnabled() && !$enable) { return true; } $query = \CBitrix24NetPortalTransport::init(); if (!$query) { $this->errorCollection[] = new Error(Loc::getMessage('B24NET_SOCSERV_TRANSPORT_ERROR'), self::ERROR_SOCSERV_TRANSPORT); return false; } $queryResult = $query->call('feature.enable', array('FEATURE' => 'replica', 'STATUS' => (bool) $enable)); Option::set('socialservices', 'network_enable', $enable ? 'Y' : 'N'); return true; }
public static function generateInitialData(Date $from) { if (($to = Option::get('conversion', 'START_DATE_TIME', 'undefined')) != 'undefined' && DateTime::isCorrect($to, 'Y-m-d H:i:s') && ($to = new DateTime($to, 'Y-m-d H:i:s')) && $to->format('Y-m-d H:i:s') > $from->format('Y-m-d H:i:s') && Option::get('conversion', 'GENERATE_INITIAL_DATA', 'undefined') == 'undefined') { Option::set('conversion', 'GENERATE_INITIAL_DATA', 'generated'); $context = new self(); // generate data $data = array(); foreach (EventManager::getInstance()->findEventHandlers('conversion', 'OnGenerateInitialData') as $handler) { $result = ExecuteModuleEventEx($handler, array($from, $to)); // TODO validate foreach ($result as $row) { $context->id = null; $context->attributes = array(); $context->setAttributes($row['ATTRIBUTES']); $context->save(); if ($dayCounters =& $data[$context->id]) { self::appendDayCounters($dayCounters, $row['DAY_COUNTERS']); } else { $dayCounters = $row['DAY_COUNTERS']; } } } unset($dayCounters); // save data to database $numerators = CounterManager::getTypes(array('GROUP' => 'day')); unset($numerators['conversion_visit_day']); foreach ($data as $id => $dayCounters) { $context->id = $id; foreach ($dayCounters as $day => $counters) { $day = new Date($day, 'Y-m-d'); $visitSum = 0; $visitQuantity = 0; unset($counters['conversion_visit_day']); foreach ($counters as $name => $value) { $context->addCounter($day, $name, $value); if ($numerators[$name]) { $visitSum += $value; $visitQuantity += 1; } } $context->addCounter($day, 'conversion_visit_day', $visitQuantity ? round($visitSum / $visitQuantity * 100) + 1 : 1); } } } }
public static function setDelayMinLimit($limit, $type = 's') { $limit = (int) $limit; switch ($type) { case 'd': $limit *= 3600 * 24; break; case 'h': $limit *= 3600; break; case 'm': $limit *= 60; break; default: break; } \Bitrix\Main\Config\Option::set('bizproc', 'delay_min_limit', $limit); }
public static function setValue($ID, $value) { $ID = (int) $ID; if ($ID === self::KEEP_COMPLETED_CALLS) { Main\Config\Option::set('crm', 'act_cal_show_compl_call', $value ? 'Y' : 'N', ''); } elseif ($ID === self::KEEP_COMPLETED_MEETINGS) { Main\Config\Option::set('crm', 'act_cal_show_compl_meeting', $value ? 'Y' : 'N', ''); } elseif ($ID === self::KEEP_UNBOUND_TASKS) { Main\Config\Option::set('crm', 'act_task_keep_unbound', $value ? 'Y' : 'N', ''); } elseif ($ID === self::KEEP_REASSIGNED_CALLS) { Main\Config\Option::set('crm', 'act_cal_keep_reassign_call', $value ? 'Y' : 'N', ''); } elseif ($ID === self::KEEP_REASSIGNED_MEETINGS) { Main\Config\Option::set('crm', 'act_cal_keep_reassign_meeting', $value ? 'Y' : 'N', ''); } elseif ($ID === self::MARK_FORWARDED_EMAIL_AS_OUTGOING) { Main\Config\Option::set('crm', 'act_mark_fwd_emai_outgoing', $value ? 'Y' : 'N', ''); } else { throw new Main\NotSupportedException("The setting '{$ID}' is not supported in current context"); } }
function InstallDB($params = array()) { global $DB; if (!$DB->Query("SELECT 'x' FROM b_conv_context", true)) { Option::set('conversion', 'START_DATE_TIME', date('Y-m-d H:i:s')); if (ModuleManager::isModuleInstalled('sale') && ($currency = Option::get('sale', 'default_currency'))) { Option::set('conversion', 'BASE_CURRENCY', $currency); } elseif (Bitrix\Main\Loader::includeModule('currency')) { Option::set('conversion', 'BASE_CURRENCY', Bitrix\Currency\CurrencyManager::getBaseCurrency()); } if ($params['GENERATE_INITIAL_DATA'] !== 'Y') { Option::set('conversion', 'GENERATE_INITIAL_DATA', 'generated'); } $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/conversion/install/db/' . strtolower($DB->type) . '/install.sql'); } ModuleManager::registerModule('conversion'); RegisterModuleDependences('conversion', 'OnGetCounterTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetCounterTypes'); RegisterModuleDependences('conversion', 'OnGetAttributeTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeTypes'); RegisterModuleDependences('conversion', 'OnGetAttributeGroupTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeGroupTypes'); RegisterModuleDependences('conversion', 'OnSetDayContextAttributes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onSetDayContextAttributes'); RegisterModuleDependences('main', 'OnProlog', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onProlog'); return true; }
if (CBXFeatures::IsFeatureEnabled('CatDiscountSave')) { $strDiscSaveApply = ''; if (isset($_REQUEST['discsave_apply'])) { $strDiscSaveApply = (string) $_REQUEST['discsave_apply']; } if ($strDiscSaveApply != '' && isset($applyDiscSaveModeList[$strDiscSaveApply])) { Option::set('catalog', 'discsave_apply', $strDiscSaveApply, ''); } } if (!$saleIsInstalled) { $discountPercent = ''; if (isset($_REQUEST['get_discount_percent_from_base_price'])) { $discountPercent = (string) $_REQUEST['get_discount_percent_from_base_price']; } if ($discountPercent == 'Y' || $discountPercent == 'N') { Option::set('catalog', 'get_discount_percent_from_base_price', $discountPercent, ''); } unset($discountPercent); } /* $strDiscountVat = (!empty($_REQUEST['discount_vat']) && $_REQUEST['discount_vat'] == 'N' ? 'N' : 'Y'); Option::set('catalog', 'discount_vat', $strDiscountVat, ''); */ } $bNeedAgent = false; $boolFlag = true; $arCurrentIBlocks = array(); $arNewIBlocksList = array(); $rsIBlocks = CIBlock::GetList(array()); while ($arOneIBlock = $rsIBlocks->Fetch()) { // Current info $arOneIBlock['ID'] = (int) $arOneIBlock['ID']; $arIBlockItem = array();
public function DoInstall() { try { //Проверка зависимостей модуля if (!IsModuleInstalled("sale")) { throw new Exception(Loc::getMessage("DEVTM_ERIP_SALE_MODULE_NOT_INSTALL_ERROR")); } if (!function_exists("curl_init")) { throw new Exception(Loc::getMessage("DEVTM_ERIP_CURL_NOT_INSTALL_ERROR")); } if (!function_exists("json_decode")) { throw new Exception(Loc::getMessage("DEVTM_ERIP_JSON_NOT_INSTALL_ERROR")); } //регистраниция модуля \Bitrix\Main\ModuleManager::registerModule($this->MODULE_ID); //создание платёжной системы $psid = $this->addPaysys(); if ($psid === false) { throw new Exception(Loc::getMessage("DEVTM_ERIP_PS_ERROR_MESS")); } //сохранение ID пл. системы в настройках модуля \Bitrix\Main\Config\Option::set($this->MODULE_ID, "payment_system_id", $psid); //копируем файлы обработчика пл. системы if (!$this->copyHandlerFiles()) { throw new Exception(Loc::getMessage("DEVTM_ERIP_COPY_ERROR_MESS")); } //регистрируем обработчик пл. системы $pay_handler_ids = $this->addPaysysHandler($psid); if (empty($pay_handler_ids)) { throw new Exception(Loc::getMessage("DEVTM_ERIP_PS_ACTION_ERROR_REG")); } //сохраняем id обработчиков пл. системы \Bitrix\Main\Config\Option::set($this->MODULE_ID, "pay_handler_ids", implode("|", $pay_handler_ids)); //создание статуса заказа [ЕРИП]Ожидание оплаты $o_status_code = $this->addOStatus(); if ($o_status_code === false) { throw new Exception(Loc::getMessage("DEVTM_ERIP_ORDER_STATUS_ERROR_MESS")); } //сохранение кода статуса заказа в настройках модуля \Bitrix\Main\Config\Option::set($this->MODULE_ID, "order_status_code_erip", $o_status_code); //Создание типа почтового события if ($this->addMailEvType() === false) { throw new Exception(Loc::getMessage("DEVTM_ERIP_MAIL_EVENT_ADD_ERROR")); } //сохранение названия типа почтового события в настройках модуля \Bitrix\Main\Config\Option::set($this->MODULE_ID, "mail_event_name", $this->mail_event_name); //создание почтового шаблона $mail_temp_id = $this->addMailTemplate(); if ($mail_temp_id === false) { throw new Exception(Loc::getMessage("DEVTM_ERIP_MAIL_TEMPLATE_ADD_ERROR")); } //сохранение ID почтового шаблона в настройках модуля \Bitrix\Main\Config\Option::set($this->MODULE_ID, "mail_template_id", $mail_temp_id); //регистрация обработчика обновления заказа if ($this->addHandlers() === false) { throw new Exception(Loc::getMessage("DEVTM_ERIP_HANDLERS_ADD_ERROR")); } return true; } catch (Exception $e) { $this->DoUninstall(); $GLOBALS["APPLICATION"]->ThrowException($e->getMessage()); return false; } return true; }
public static function setGroupUsage() { Config\Option::set("sale", self::PROJECT_USES_GROUPS_OPT, 'Y'); }
/** * @return array */ public static function getInstalledCurrencies() { $installedCurrencies = (string) Option::get('currency', 'installed_currencies'); if ($installedCurrencies === '') { $currencyList = array(); $searched = false; $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('ID' => 'ua'))); if ($oneLanguage = $languageIterator->fetch()) { $currencyList = array('RUB', 'USD', 'EUR', 'UAH'); $searched = true; } if (!$searched) { $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('ID' => 'ru'))); if ($oneLanguage = $languageIterator->fetch()) { $currencyList = array('RUB', 'USD', 'EUR', 'UAH'); $searched = true; } } if (!$searched) { $currencyList = array('USD', 'EUR'); } Option::set('currency', 'installed_currencies', implode(',', $currencyList), ''); return $currencyList; } else { return explode(',', $installedCurrencies); } }
function InstallDB() { global $DB, $DBType, $APPLICATION; $this->errors = false; $clearInstall = false; if (!$DB->Query("SELECT 'x' FROM b_sale_basket", true)) { $clearInstall = true; $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/install/db/" . $DBType . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } ModuleManager::registerModule('sale'); $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->registerEventHandlerCompatible('main', 'OnUserLogout', 'sale', '\\Bitrix\\Sale\\DiscountCouponsManager', 'logout'); RegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin"); RegisterModuleDependences("main", "OnUserLogout", "sale", "CSaleUser", "OnUserLogout"); RegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete"); RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete"); RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete"); RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete"); RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete"); RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete"); RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete"); RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete"); RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete"); RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete"); RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete"); RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete"); RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 100, "/modules/sale/affiliate.php"); RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSaleYMHandler", 'OnEventLogGetAuditTypes'); RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSalePaySystemAction", 'OnEventLogGetAuditTypes'); RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete"); RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete"); RegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale"); RegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount"); RegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu"); RegisterModuleDependences("sender", "OnConnectorList", "sale", "\\Bitrix\\Sale\\SenderEventHandler", "onConnectorListBuyer"); RegisterModuleDependences("sender", "OnTriggerList", "sale", "\\Bitrix\\Sale\\Sender\\EventHandler", "onTriggerList"); RegisterModuleDependences("sender", "OnPresetMailingList", "sale", "\\Bitrix\\Sale\\Sender\\EventHandler", "onPresetMailingList"); RegisterModuleDependences("sender", "OnPresetTemplateList", "sale", "\\Bitrix\\Sale\\Sender\\EventHandler", "onPresetTemplateList"); RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr", 100); RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr", 200); RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr", 300); RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr", 1000); RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr", 10000); RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGroup", "GetControlDescr", 100); RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlDelivery", "GetControlDescr", 200); RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketGroup", "GetControlDescr", 300); RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlSubGroup", "GetControlDescr", 1000); RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCondCtrlBasketFields", "GetControlDescr", 1100); //pulling for mobile orders RegisterModuleDependences("sale", "OnOrderDelete", "sale", "CSaleMobileOrderPull", "onOrderDelete", 100); RegisterModuleDependences("sale", "OnOrderAdd", "sale", "CSaleMobileOrderPull", "onOrderAdd", 100); RegisterModuleDependences("sale", "OnOrderUpdate", "sale", "CSaleMobileOrderPull", "onOrderUpdate", 100); // sale product2product RegisterModuleDependences("sale", "OnBasketOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleOrderAdd", 100); RegisterModuleDependences("sale", "OnSaleStatusOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleStatusOrderHandler", 100); RegisterModuleDependences("sale", "OnSaleDeliveryOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeliveryOrderHandler", 100); RegisterModuleDependences("sale", "OnSaleDeductOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeductOrderHandler", 100); RegisterModuleDependences("sale", "OnSaleCancelOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleCancelOrderHandler", 100); RegisterModuleDependences("sale", "OnSalePayOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSalePayOrderHandler", 100); CAgent::AddAgent("\\Bitrix\\Sale\\Product2ProductTable::deleteOldProducts(10);", "sale", "N", 10 * 24 * 3600, "", "Y"); // conversion RegisterModuleDependences('conversion', 'OnGetCounterTypes', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onGetCounterTypes'); RegisterModuleDependences('conversion', 'OnGetRateTypes', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onGetRateTypes'); RegisterModuleDependences('conversion', 'OnGenerateInitialData', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onGenerateInitialData'); RegisterModuleDependences('sale', 'OnBeforeBasketAdd', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBeforeBasketAdd'); RegisterModuleDependences('sale', 'OnBasketAdd', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBasketAdd'); RegisterModuleDependences('sale', 'OnBeforeBasketUpdate', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBeforeBasketUpdate'); RegisterModuleDependences('sale', 'OnBasketUpdate', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBasketUpdate'); RegisterModuleDependences('sale', 'OnBeforeBasketDelete', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBeforeBasketDelete'); RegisterModuleDependences('sale', 'OnBasketDelete', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBasketDelete'); RegisterModuleDependences('sale', 'OnOrderAdd', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onOrderAdd'); RegisterModuleDependences('sale', 'OnSalePayOrder', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onSalePayOrder'); RegisterModuleDependences("perfmon", "OnGetTableSchema", "sale", "sale", "OnGetTableSchema"); COption::SetOptionString("sale", "viewed_capability", "N"); COption::SetOptionString("sale", "viewed_count", 10); COption::SetOptionString("sale", "viewed_time", 5); COption::SetOptionString("main", "~sale_converted_15", 'Y'); COption::SetOptionString("sale", "expiration_processing_events", 'N'); COption::SetOptionString("sale", "p2p_status_list", serialize(array("N", "P", "F", "F_CANCELED", "F_DELIVERY", "F_PAY", "F_OUT"))); if ($clearInstall) { \Bitrix\Main\Config\Option::set('sale', 'basket_discount_converted', 'Y', ''); } CAgent::AddAgent("CSaleRecurring::AgentCheckRecurring();", "sale", "N", 7200, "", "Y"); CAgent::AddAgent("CSaleOrder::RemindPayment();", "sale", "N", 86400, "", "Y"); CAgent::AddAgent("CSaleViewedProduct::ClearViewed();", "sale", "N", 86400, "", "Y"); CAgent::AddAgent("CSaleOrder::ClearProductReservedQuantity();", "sale", "N", 86400, "", "Y"); COption::SetOptionString("sale", "product_reserve_clear_period", "3"); \Bitrix\Main\Config\Option::set('sale', 'sale_locationpro_import_performed', 'Y'); // install tasks + operations for statuses $operations = array(); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_view')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_cancel')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_mark')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_delivery')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_deduction')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_payment')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_to')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_update')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_delete')); $operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_from')); Bitrix\Main\TaskTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_none', 'SYS' => 'Y', 'LETTER' => 'D')); $result = Bitrix\Main\TaskTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_all', 'SYS' => 'Y', 'LETTER' => 'X')); if ($result->isSuccess()) { $taskId = $result->getId(); foreach ($operations as $result) { if ($result->isSuccess()) { Bitrix\Main\TaskOperationTable::add(array('TASK_ID' => $taskId, 'OPERATION_ID' => $result->getId())); } } } if (Bitrix\Main\Loader::IncludeModule('sale')) { // install statuses $orderInitialStatus = Bitrix\Sale\OrderStatus::getInitialStatus(); $orderFinalStatus = Bitrix\Sale\OrderStatus::getFinalStatus(); $deliveryInitialStatus = Bitrix\Sale\DeliveryStatus::getInitialStatus(); $deliveryFinalStatus = Bitrix\Sale\DeliveryStatus::getFinalStatus(); $statusLanguages = array(); $result = Bitrix\Main\Localization\LanguageTable::getList(array('select' => array('LID'), 'filter' => array('=ACTIVE' => 'Y'))); while ($row = $result->Fetch()) { $languageId = $row['LID']; Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/sale/lib/status.php', $languageId); foreach (array($orderInitialStatus, $orderFinalStatus, $deliveryInitialStatus, $deliveryFinalStatus) as $statusId) { if ($statusName = Bitrix\Main\Localization\Loc::getMessage("SALE_STATUS_{$statusId}")) { $statusLanguages[$statusId][] = array('LID' => $languageId, 'NAME' => $statusName, 'DESCRIPTION' => Bitrix\Main\Localization\Loc::getMessage("SALE_STATUS_{$statusId}_DESCR")); } } } Bitrix\Sale\OrderStatus::install(array('ID' => $orderInitialStatus, 'SORT' => 100, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$orderInitialStatus])); Bitrix\Sale\OrderStatus::install(array('ID' => $orderFinalStatus, 'SORT' => 200, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$orderFinalStatus])); Bitrix\Sale\DeliveryStatus::install(array('ID' => $deliveryInitialStatus, 'SORT' => 300, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$deliveryInitialStatus])); Bitrix\Sale\DeliveryStatus::install(array('ID' => $deliveryFinalStatus, 'SORT' => 400, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$deliveryFinalStatus])); // enabling location pro COption::SetOptionString("sale", "sale_locationpro_migrated", "Y"); COption::SetOptionString("sale", "sale_locationpro_enabled", "Y"); if (\Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')) { // this will create at least base types if we are at Bitrix24 include_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/sale/lib/location/migration/migrate.php"; \Bitrix\Sale\Location\Migration\CUpdaterLocationPro::createBaseTypes(); } CSaleYMHandler::install(); } return true; }
/** * @return string * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ArgumentNullException * @throws \Bitrix\Main\ArgumentTypeException */ public static function executeEvents() { $manage_cache = \Bitrix\Main\Application::getInstance()->getManagedCache(); if (defined("BX_FORK_AGENTS_AND_EVENTS_FUNCTION")) { if (\CMain::ForkActions(array("CEvent", "ExecuteEvents"))) { return ""; } } $bulk = intval(Config\Option::get("main", "mail_event_bulk", 5)); if ($bulk <= 0) { $bulk = 5; } $connection = \Bitrix\Main\Application::getConnection(); if ($connection instanceof \Bitrix\Main\DB\MysqlCommonConnection) { $uniq = Config\Option::get("main", "server_uniq_id", ""); if (strlen($uniq) <= 0) { $uniq = md5(uniqid(rand(), true)); Config\Option::set("main", "server_uniq_id", $uniq); } $strSql = "SELECT 'x' FROM b_event WHERE SUCCESS_EXEC='N' LIMIT 1"; $resultEventDb = $connection->query($strSql); if ($resultEventDb->fetch()) { $lockDb = $connection->query("SELECT GET_LOCK('" . $uniq . "_event', 0) as L"); $arLock = $lockDb->fetch(); if ($arLock["L"] == "0") { return ""; } } else { if (CACHED_b_event !== false) { $manage_cache->set("events", true); } return ""; } $strSql = "\n\t\t\t\tSELECT ID, C_FIELDS, EVENT_NAME, MESSAGE_ID, LID, DATE_FORMAT(DATE_INSERT, '%d.%m.%Y %H:%i:%s') as DATE_INSERT, DUPLICATE\n\t\t\t\tFROM b_event\n\t\t\t\tWHERE SUCCESS_EXEC='N'\n\t\t\t\tORDER BY ID\n\t\t\t\tLIMIT " . $bulk; $rsMails = $connection->query($strSql); } elseif ($connection instanceof \Bitrix\Main\DB\MssqlConnection) { $connection->startTransaction(); $connection->query("SET LOCK_TIMEOUT 0"); \CTimeZone::Disable(); $strSql = "\n\t\t\t\tSELECT TOP " . $bulk . "\n\t\t\t\t\tID,\n\t\t\t\t\tC_FIELDS,\n\t\t\t\t\tEVENT_NAME,\n\t\t\t\t\tMESSAGE_ID,\n\t\t\t\t\tLID,\n\t\t\t\t\t" . $connection->getSqlHelper()->getDateToCharFunction("DATE_INSERT") . " as DATE_INSERT,\n\t\t\t\t\tDUPLICATE\n\t\t\t\tFROM b_event\n\t\t\t\tWITH (TABLOCKX)\n\t\t\t\tWHERE SUCCESS_EXEC = 'N'\n\t\t\t\tORDER BY ID\n\t\t\t\t"; $rsMails = $connection->query($strSql); \CTimeZone::Enable(); } elseif ($connection instanceof \Bitrix\Main\DB\OracleConnection) { $connection->startTransaction(); $strSql = "\n\t\t\t\tSELECT /*+RULE*/ E.ID, E.C_FIELDS, E.EVENT_NAME, E.MESSAGE_ID, E.LID,\n\t\t\t\t\tTO_CHAR(E.DATE_INSERT, 'DD.MM.YYYY HH24:MI:SS') as DATE_INSERT, DUPLICATE\n\t\t\t\tFROM b_event E\n\t\t\t\tWHERE E.SUCCESS_EXEC='N'\n\t\t\t\tORDER BY E.ID\n\t\t\t\tFOR UPDATE NOWAIT\n\t\t\t\t"; $rsMails = $connection->query($strSql); } if ($rsMails) { $arCallableModificator = array(); $cnt = 0; foreach (EventTable::getFetchModificatorsForFieldsField() as $callableModificator) { if (is_callable($callableModificator)) { $arCallableModificator[] = $callableModificator; } } while ($arMail = $rsMails->fetch()) { foreach ($arCallableModificator as $callableModificator) { $arMail['C_FIELDS'] = call_user_func_array($callableModificator, array($arMail['C_FIELDS'])); } $arFiles = array(); $fileListDb = EventAttachmentTable::getList(array('select' => array('FILE_ID'), 'filter' => array('EVENT_ID' => $arMail["ID"]))); while ($file = $fileListDb->fetch()) { $arFiles[] = $file['FILE_ID']; } $arMail['FILE'] = $arFiles; if (!is_array($arMail['C_FIELDS'])) { $arMail['C_FIELDS'] = array(); } $flag = Event::handleEvent($arMail); EventTable::update($arMail["ID"], array('SUCCESS_EXEC' => $flag, 'DATE_EXEC' => new Type\DateTime())); $cnt++; if ($cnt >= $bulk) { break; } } } if ($connection instanceof \Bitrix\Main\DB\MysqlCommonConnection) { $connection->query("SELECT RELEASE_LOCK('" . $uniq . "_event')"); } elseif ($connection instanceof \Bitrix\Main\DB\MssqlConnection) { $connection->query("SET LOCK_TIMEOUT -1"); $connection->commitTransaction(); } elseif ($connection instanceof \Bitrix\Main\DB\OracleConnection) { $connection->commitTransaction(); } if ($cnt === 0 && CACHED_b_event !== false) { $manage_cache->set("events", true); } }
public static function createVatZero() { \Bitrix\Main\Config\Option::set('crm', 'check_vat_zero', '0', ''); if (!Loader::includeModule('catalog')) { return; } $siteID = ''; $languageID = ''; $dbSites = \CSite::GetList($by = 'sort', $order = 'desc', array('DEFAULT' => 'Y', 'ACTIVE' => 'Y')); $defaultSite = is_object($dbSites) ? $dbSites->Fetch() : null; if (is_array($defaultSite)) { $siteID = $defaultSite['LID']; $languageID = $defaultSite['LANGUAGE_ID']; } if ($siteID === '') { $siteID = 's1'; } if ($languageID === '') { $languageID = 'ru'; } \Bitrix\Main\Config\Option::set('crm', 'check_vat_zero', '-1', ''); if ($languageID == 'ru') { \Bitrix\Main\Config\Option::set('crm', 'check_vat_zero', '-2', ''); $resVats = \CCatalogVat::GetListEx(array(), array('RATE' => 0), false, false, array('ID')); if (!($vatInfo = $resVats->Fetch())) { \Bitrix\Main\Config\Option::set('crm', 'check_vat_zero', '-3', ''); $fields = array('ACTIVE' => 'Y', 'SORT' => '100', 'NAME' => Loc::getMessage('CRM_VAT_ZERO', null, $languageID), 'RATE' => '0.0'); $vatID = \CCatalogVat::Add($fields); if ($vatID) { $vatID = (int) $vatID; } else { $vatID = -4; } \Bitrix\Main\Config\Option::set('crm', 'check_vat_zero', $vatID, ''); } } }
*/ if($result->isSuccess()) { if($ID <= 0 && $elementId > 0) { Adv\LinkTable::add(array( 'LINK_TYPE' => Adv\LinkTable::TYPE_IBLOCK_ELEMENT, 'LINK_ID' => $elementId, 'BANNER_ID' => $result->getId() )); } if($ID <= 0) { Main\Config\Option::set('seo', 'yandex_direct_region_last_list', $bannerSettings["Geo"]); } $ID = $result->getId(); if($request["apply"]<>'') { LocalRedirect('/bitrix/admin/seo_search_yandex_direct_banner_edit.php?lang='.LANGUAGE_ID.'&ID='.$ID.'&'.$tabControl->ActiveTabParam()); } else { if($back_url == '') { LocalRedirect("/bitrix/admin/seo_search_yandex_direct_banner.php?lang=".LANGUAGE_ID.'&campaign='.$campaign['ID']); } else
/** * Start Component */ public function executeComponent() { global $APPLICATION; $context = Main\Context::getCurrent(); // mark usage $lastUsage = Main\Config\Option::get('main', 'rcm_component_usage', 0); if ($lastUsage == 0 || time() - $lastUsage > 3600) { Main\Config\Option::set('main', 'rcm_component_usage', time()); } // execute try { $this->checkModules(); } catch (SystemException $e) { ShowError($e->getMessage()); return; } $this->processRequest(); // define what to do and check cache $this->rcmParams = $this->getServiceRequestParamsByType($this->arParams['RCM_TYPE']); $showByIds = $context->getServer()->getRequestMethod() == 'POST' && $context->getRequest()->getPost('rcm') == 'yes'; if (!$showByIds) { // check if ids are already in cache try { if (!$this->extractDataFromCache()) { // echo js for requesting items from recommendation service $this->arResult['REQUEST_ITEMS'] = true; $this->arResult['RCM_PARAMS'] = $this->rcmParams; $this->arResult['RCM_TEMPLATE'] = $this->getTemplateName(); // abort cache, we will write it on next request with the same parameters $this->abortDataCache(); // clear cache for ajax call if (Main\Context::getCurrent()->getRequest()->get('clear_cache') == 'Y') { $this->clearResultCache($this->getAdditionalCacheId(), '/' . $this->getSiteId() . '/bitrix/catalog.bigdata.products/common'); } $this->includeComponentTemplate(); $this->setResultCacheKeys(array()); } // show cache and die return; } catch (SystemException $e) { $this->abortDataCache(); if ($this->isAjax()) { $APPLICATION->restartBuffer(); echo CUtil::PhpToJSObject(array('STATUS' => 'ERROR', 'MESSAGE' => $e->getMessage())); die; } ShowError($e->getMessage()); } } if ($showByIds) { // we have an ajax query to get items html // and there was no cache $ajaxItemIds = $context->getRequest()->get('AJAX_ITEMS'); if (!empty($ajaxItemIds) && is_array($ajaxItemIds)) { $this->ajaxItemsIds = $ajaxItemIds; } else { // show something $this->ajaxItemsIds = null; // last viewed will be shown } // draw products with collected ids $this->prepareData(); $this->formatResult(); } if (!$this->extractDataFromCache()) { $this->setResultCacheKeys(array()); $this->includeComponentTemplate(); } }
function save() { Main\Config\Option::set('crm', 'crm_lead_conversion', serialize($this->externalize()), ''); }
if ($REQUEST_METHOD == "POST" && strlen($save . $reset) > 0 && check_bitrix_sessid()) { if (strlen($reset) > 0) { \Bitrix\Main\Config\Option::delete($module_id); } else { foreach ($all_options as &$option) { if (isset($_REQUEST[$option[0]])) { if ($option[2] == "text" || $option[2] == "textarea") { \Bitrix\Main\Config\Option::set($module_id, $option[0], $_REQUEST[$option[0]]); } else { if ($option[2] == "select") { foreach ($option[3] as $k => &$v) { if (is_array($_REQUEST[$option[0]]) && in_array($v["value"], $_REQUEST[$option[0]])) { \Bitrix\Main\Config\Option::set($module_id, $option[0], implode("|", $_REQUEST[$option[0]])); break; } elseif ($_REQUEST[$option[0]] == $v["value"]) { \Bitrix\Main\Config\Option::set($module_id, $option[0], $_REQUEST[$option[0]]); break; } } } } } } } LocalRedirect($APPLICATION->GetCurPage() . "?mid=" . urlencode($module_id) . "&lang=" . urlencode(LANGUAGE_ID) . "&" . $o_tab->ActiveTabParam()); } $o_tab->Begin(); ?> <form method="post" action="<?php echo $APPLICATION->GetCurPage();
unset($mapStatuses[$tStatusId]); } } Option::set('sale', 'tracking_map_statuses', serialize($mapStatuses)); unset($mapStatuses); } $tSwitch = 'N'; if (isset($_POST['tracking_check_switch']) && $_POST['tracking_check_switch'] == 'Y') { $tSwitch = 'Y'; } Option::set('sale', 'tracking_check_switch', $tSwitch); $tPeriod = 0; if (isset($_POST['tracking_check_period']) && intval($_POST['tracking_check_period']) > 0) { $tPeriod = intval($_POST['tracking_check_period']); } Option::set('sale', 'tracking_check_period', $tPeriod); $agentName = '\\Bitrix\\Sale\\Delivery\\Tracking\\Manager::startRefreshingStatuses();'; if ($tSwitch == 'Y' && $tPeriod > 0) { $res = \CAgent::GetList(array(), array('NAME' => $agentName)); if ($agent = $res->Fetch()) { \CAgent::Update($agent['ID'], array('AGENT_INTERVAL' => $tPeriod * 60 * 60)); } else { \CAgent::AddAgent($agentName, 'sale', "Y", $tPeriod * 60 * 60, "", "Y"); } } else { \CAgent::RemoveAgent($agentName, 'sale'); } } } $arStatuses = array("" => GetMessage("SMO_STATUS")); $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID), false, false, array("ID", "NAME", "SORT"));
use Bitrix\Main\Text\String; if (!$USER->isAdmin()) { $APPLICATION->authForm('Nope'); } $app = Application::getInstance(); $context = $app->getContext(); $request = $context->getRequest(); Loc::loadMessages($context->getServer()->getDocumentRoot() . "/bitrix/modules/main/options.php"); Loc::loadMessages(__FILE__); $tabControl = new CAdminTabControl("tabControl", array(array("DIV" => "edit1", "TAB" => Loc::getMessage("MAIN_TAB_SET"), "TITLE" => Loc::getMessage("MAIN_TAB_TITLE_SET")))); if ((!empty($save) || !empty($restore)) && $request->isPost() && check_bitrix_sessid()) { if (!empty($restore)) { Option::delete(ADMIN_MODULE_NAME); CAdminMessage::showMessage(array("MESSAGE" => Loc::getMessage("REFERENCES_OPTIONS_RESTORED"), "TYPE" => "OK")); } elseif ($request->getPost('max_image_size') && $request->getPost('max_image_size') > 0 && $request->getPost('max_image_size') < 100000) { Option::set(ADMIN_MODULE_NAME, "max_image_size", $request->getPost('max_image_size')); CAdminMessage::showMessage(array("MESSAGE" => Loc::getMessage("REFERENCES_OPTIONS_SAVED"), "TYPE" => "OK")); } else { CAdminMessage::showMessage(Loc::getMessage("REFERENCES_INVALID_VALUE")); } } $tabControl->begin(); ?> <form method="post" action="<?php echo sprintf('%s?mid=%s&lang=%s', $request->getRequestedPage(), urlencode($mid), LANGUAGE_ID); ?> "> <?php echo bitrix_sessid_post(); $tabControl->beginNextTab();
public static function setLastBroadcastCheck() { Option::set("socialservices", "network_last_update_check", time()); }
if ($product_reserve_clear_period > 0) CAgent::AddAgent("CSaleOrder::ClearProductReservedQuantity();", "sale", "N", $product_reserve_clear_period*24*3600); } Option::set('sale', 'product_reserve_clear_period', $product_reserve_clear_period, ''); } if (!$useSaleDiscountOnly) { if (CBXFeatures::IsFeatureEnabled('CatDiscountSave')) { $strDiscSaveApply = ''; if (isset($_REQUEST['discsave_apply'])) $strDiscSaveApply = (string)$_REQUEST['discsave_apply']; if ($strDiscSaveApply != '' && isset($applyDiscSaveModeList[$strDiscSaveApply])) { Option::set('catalog', 'discsave_apply', $strDiscSaveApply, ''); } } /* $discountPercent = ''; if (isset($_REQUEST['get_discount_percent_from_base_price'])) $discountPercent = (string)$_REQUEST['get_discount_percent_from_base_price']; if ($discountPercent == 'Y' || $discountPercent == 'N') Option::set('catalog', 'get_discount_percent_from_base_price', $discountPercent, ''); unset($discountPercent); $strDiscountVat = (!empty($_REQUEST['discount_vat']) && $_REQUEST['discount_vat'] == 'N' ? 'N' : 'Y'); Option::set('catalog', 'discount_vat', $strDiscountVat, ''); */ } $bNeedAgent = false; $boolFlag = true;
/** * Update module. * * It must be called repeatedly until the method returns false. * After each call php must be restarted (new process created) to update module class and function definitions. * * @param array $modulesUpdated [optional] * @return bool */ public function update(&$modulesUpdated = null) { require_once $_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/main/classes/general/update_client_partner.php'; if (!$this->isThirdParty()) { throw new Exception\ModuleUpdateException('Kernel module updates are currently not supported.', $this->getName()); } // ensures module existence $this->getObject(); $errorMessage = $updateDescription = null; $loadResult = \CUpdateClientPartner::LoadModulesUpdates($errorMessage, $updateDescription, LANGUAGE_ID, $this->isBeta() ? 'N' : 'Y', [$this->getName()], true); switch ($loadResult) { // archive loaded case "S": return $this->update($modulesUpdated); // error // error case "E": throw new Exception\ModuleUpdateException($errorMessage, $this->getName()); // finished installing updates // finished installing updates case "F": return false; // need to process loaded update // need to process loaded update case 'U': break; } /** @var string Temp directory with update files */ $updateDir = null; if (!\CUpdateClientPartner::UnGzipArchive($updateDir, $errorMessage, true)) { throw new Exception\ModuleUpdateException('[CL02] UnGzipArchive failed. ' . $errorMessage, $this->getName()); } $this->validateUpdate($updateDir); if (isset($updateDescription["DATA"]["#"]["NOUPDATES"])) { \CUpdateClientPartner::ClearUpdateFolder($_SERVER["DOCUMENT_ROOT"] . "/bitrix/updates/" . $updateDir); return false; } $modulesUpdated = $updateDescr = []; if (isset($updateDescription["DATA"]["#"]["ITEM"])) { foreach ($updateDescription["DATA"]["#"]["ITEM"] as $moduleInfo) { $modulesUpdated[$moduleInfo["@"]["NAME"]] = $moduleInfo["@"]["VALUE"]; $updateDescr[$moduleInfo["@"]["NAME"]] = $moduleInfo["@"]["DESCR"]; } } if (\CUpdateClientPartner::UpdateStepModules($updateDir, $errorMessage)) { foreach ($modulesUpdated as $key => $value) { if (Option::set('main', 'event_log_marketplace', "Y") === "Y") { \CEventLog::Log("INFO", "MP_MODULE_DOWNLOADED", "main", $key, $value); } } } else { throw new Exception\ModuleUpdateException('[CL04] UpdateStepModules failed. ' . $errorMessage, $this->getName()); } return true; }
/** * Return default (system) key for signing or generate if it does not exists * * @return string */ protected function getDefaultKey() { static $defaultKey = null; if ($defaultKey === null) { $defaultKey = Option::get('main', 'signer_default_key', false); if (!$defaultKey) { $defaultKey = hash('sha512', uniqid(rand(), true)); Option::set('main', 'signer_default_key', $defaultKey, ''); } } return $defaultKey; }
public static function setIndexInvalid() { Option::set('sale', self::INDEX_VALID_OPT, 'N', ''); }