1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
collectphraseindex.php
См. документацию.
1<?php
2namespace Bitrix\Translate\Controller\Index;
3
4use Bitrix\Main;
5use Bitrix\Translate;
6use Bitrix\Translate\Index;
7
14{
17
19 private $seekPathId = '';
20
22 private $languages = [];
23
32 {
33 $this->keepField(['seekPathId', 'languages']);
34
35 parent::__construct($name, $controller, $config);
36 }
37
45 public function run($path = '')
46 {
47 if (empty($path))
48 {
50 }
51
52 if (\preg_match("#(.+\/lang)(\/?\w*)#", $path, $matches))
53 {
54 $path = $matches[1];
55 }
56
57 $path = '/'. \trim($path, '/.\\');
58
59 if ($this->isNewProcess)
60 {
62
63 $languages = $this->controller->getRequest()->get('languages');
64 if (\is_array($languages) && !\in_array('all', $languages))
65 {
66 $languages = \array_intersect($languages, Translate\Config::getEnabledLanguages());
67 if (!empty($languages))
68 {
69 $this->languages = $languages;
70 }
71 }
72
73 $filter = new Translate\Filter(['path' => $path]);
74 if (!empty($this->languages))
75 {
76 $filter->langId = $this->languages;
77 }
78
79 $this->totalItems = (new Index\PhraseIndexCollection())->countItemsToProcess($filter);
80
82
83 $this->instanceTimer()->setTimeLimit(5);
84 $this->isNewProcess = false;
85 }
86 else
87 {
88 $progressParams = $this->getProgressParameters();
89
90 if (isset($progressParams['totalItems']) && (int)$progressParams['totalItems'] > 0)
91 {
92 $this->totalItems = (int)$progressParams['totalItems'];
93 $this->processedItems = (int)$progressParams['processedItems'];
94 }
95
96 if (isset($progressParams['seekPathId']))
97 {
98 $this->seekPathId = $progressParams['seekPathId'];
99 }
100 }
101
102 return $this->performStep('runIndexing', ['path' => $path]);
103 }
104
112 private function runIndexing(array $params): array
113 {
114 $path = \rtrim($params['path'], '/');
115
116 $seek = new Translate\Filter();
117 if (!empty($this->seekPathId))
118 {
119 $seek->pathId = $this->seekPathId;
120 }
121
122 $filter = new Translate\Filter(['path' => $path]);
123 if (!empty($this->languages))
124 {
125 $filter->langId = $this->languages;
126 }
127
128 $indexer = new Index\PhraseIndexCollection();
129
130 $processedItemCount = $indexer->collect($filter, $this->instanceTimer(), $seek);
131
132 $this->processedItems += $processedItemCount;
133
134 if ($this->processedItems >= $this->totalItems)
135 {
136 $this->declareAccomplishment();
138 }
139 else
140 {
141 $this->seekPathId = $seek->nextPathId;
142 }
143
144 return [
145 'PROCESSED_ITEMS' => $this->processedItems,
146 'TOTAL_ITEMS' => $this->totalItems,
147 ];
148 }
149}
$path
Определения access_edit.php:21
$controller
Определения action.php:23
static getDefaultPath()
Определения config.php:376
__construct($name, Main\Engine\Controller $controller, array $config=[])
Определения collectphraseindex.php:31
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$filter
Определения iblock_catalog_list.php:54
Определения action.php:3
trait ProcessParams
Определения processparams.php:12
instanceTimer()
Определения stepper.php:172
int $processedItems
Определения stepper.php:20
int $totalItems
Определения stepper.php:22
performStep($action, array $params=[])
Определения stepper.php:75
declareAccomplishment(bool $flag=true)
Определения stepper.php:136
trait Stepper
Определения stepper.php:13
Определения autoload.php:3
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$matches
Определения index.php:22