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/landing/lib/update/site/ |
Upload File : |
<?php namespace Bitrix\Landing\Update\Site; use Bitrix\Landing\Internals\SiteTable; use Bitrix\Landing\Rights; use Bitrix\Main\Application; use Bitrix\Main\ORM\Query\Query; use Bitrix\Main\Update\Stepper; class RegionBy extends Stepper { public const STEP_LIMIT = 50; protected static $moduleId = 'landing'; /** * One step of publish. * @return bool */ public function execute(array &$option): bool { $region = Application::getInstance()->getLicense()->getRegion(); if ($region !== 'by') { return false; } Rights::setGlobalOff(); $steps = $option['steps'] ?? 0; if (!isset($option['count'])) { $siteCount = SiteTable::query() ->addSelect(Query::expr()->count('ID'), 'CNT') ->where('DELETED', '=', 'N') ->where('LANG', '=', 'ru') ->whereIn('TYPE', ['PAGE', 'STORE']) ->exec() ->fetch() ; $option['count'] = (int)$siteCount['CNT']; } $sites = SiteTable::query() ->setSelect(['ID']) ->where('DELETED', '=', 'N') ->where('LANG', '=', 'ru') ->whereIn('TYPE', ['PAGE', 'STORE']) ->setLimit(self::STEP_LIMIT) ->setOffset($steps) ->exec() ; while($site = $sites->fetch()) { SiteTable::update($site['ID'], [ 'LANG' => 'by', ]); $steps++; } $option['steps'] = $steps; Rights::setGlobalOn(); return $option['steps'] !== $option['count']; } }