Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/goodde.yandexturboapi/load/ |
Upload File : |
<? $arFilter = array('=ACTIVE' => 'Y'); if($profileId > 0) { $arFilter['=ID'] = $profileId; } $resProfile = \Goodde\YandexTurbo\TurboStaticFileTable::getList(array( 'select' => array('ID'), 'filter' => $arFilter, 'order' => array('ID' => 'ASC'), )); while($arProfile = $resProfile->fetch()) { $profileExport = new \Goodde\YandexTurbo\TurboStaticFileExport($arProfile['ID']); $tmpDir = $_SERVER['DOCUMENT_ROOT'] . '/bitrix/tmp'; if(!is_dir($tmpDir)) { if(!mkdir($tmpDir, 0755, true)) { die('Error! Can\'t make tmp folder'); } } $lockFile = $tmpDir . '/goodde_static_file_export_' . $arProfile['ID'] . '.lock'; $lockFp = fopen($lockFile, 'w'); if(!flock($lockFp, LOCK_EX | LOCK_NB)) { continue; } $mgu = memory_get_usage(true); $start = microtime(true); $strftime = '%d.%m.%Y %H:%M:%S'; $lastStart = new \Bitrix\Main\Type\DateTime(); $logName = strftime('%Y-%m-%d_%H-%M-%S') . '__' . $arProfile['ID']; \Goodde\YandexTurbo\Log::write(\Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_EXPORT_PROFILE'), $arProfile['ID'], $logName); \Goodde\YandexTurbo\Log::write(\Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_PROCESS'), getmypid(), $logName); \Goodde\YandexTurbo\Log::write(\Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_MEMORY'), ini_get('memory_limit'), $logName); \Goodde\YandexTurbo\Log::write(\Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_LAST_START'), strftime($strftime), $logName); $profileExport->writeHeader(); $step = 1; $arResult = $profileExport->execute(); \Goodde\YandexTurbo\Log::write( \Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_EXPORT_STEP', array('#STEP#' => $step, '#ITEMS#' => $arResult['LAST_ITEMS_COUNT'], '#MEMORY#' => \Goodde\YandexTurbo\Log::getMemoryUsage())), sprintf('%.2F', (microtime(true) - $start)), $logName ); $profileExport->writeFooter(); $profileExport->uploadFileFeed(); $end = microtime(true); $lastRunTime = sprintf('%.2F', $end - $start); $totalMemory = \Goodde\YandexTurbo\Log::getMemoryUsage($mgu); \Goodde\YandexTurbo\TurboStaticFileTable::update($arProfile['ID'], array( 'LAST_START' => $lastStart, 'LAST_END' => new \Bitrix\Main\Type\DateTime(), 'TOTAL_RUN_TIME' => $lastRunTime, 'TOTAL_MEMORY' => $totalMemory, 'TOTAL_OFFERS' => $arResult['LAST_ITEMS_COUNT'], )); \Goodde\YandexTurbo\Log::write(\Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_LAST_END'), strftime($strftime), $logName); \Goodde\YandexTurbo\Log::write(\Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_EXPORT_TOTAL_ELEMENTS'), $arResult['LAST_ITEMS_COUNT'], $logName); \Goodde\YandexTurbo\Log::write(\Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_TOTAL_RUN_TIME'), $lastRunTime, $logName); \Goodde\YandexTurbo\Log::write(\Bitrix\Main\Localization\Loc::getMessage('GOODDE_TYRBO_API_LOG_TOTAL_MEMORY'), $totalMemory, $logName); unset($profileExport, $arResult, $lastStart, $start, $end, $strftime, $lastRunTime, $totalMemory, $step, $mgu); register_shutdown_function(function () use ($lockFp, $lockFile){ flock($lockFp, LOCK_UN); @unlink($lockFile); }); } ?>