1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
catalog_reindex.php
См. документацию.
1<?php
4const STOP_STATISTICS = true;
5const NO_AGENT_CHECK = true;
6const PUBLIC_AJAX_MODE = true;
7
11use Bitrix\Main;
14
15require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_admin_before.php');
16
17Loc::loadMessages(__FILE__);
18if (!Loader::includeModule('catalog'))
19{
20 ShowError(Loc::getMessage('BX_CATALOG_REINDEX_REINDEX_ERRORS_MODULE_CATALOG_ABSENT'));
21 die();
22}
23
24if (!AccessController::getCurrent()->check(ActionDictionary::ACTION_PRICE_EDIT))
25{
26 ShowError(Loc::getMessage('BX_CATALOG_REINDEX_ACCESS_DENIED'));
27 die();
28}
29
31{
32 ShowError(Loc::getMessage('BX_CATALOG_REINDEX_ERRORS_INCORRECT_SESSION'));
33 die();
34}
35
36$request = Main\Context::getCurrent()->getRequest();
37
38if (
39 $request->getRequestMethod() == 'GET'
40 && $request['operation'] == 'Y'
41)
42{
43 $params = array(
44 'sessID' => $request['ajaxSessionID'],
45 'maxExecutionTime' => $request['maxExecutionTime'],
46 'maxOperationCounter' => $request['maxOperationCounter'],
47 'counter' => $request['counter'],
48 'operationCounter' => $request['operationCounter'],
49 'lastID' => $request['lastID'],
50 'IBLOCK_ID' => $request['iblockId']
51 );
52
53 $catalogReindex = new CCatalogIblockReindex(
54 $params['sessID'],
55 $params['maxExecutionTime'],
56 $params['maxOperationCounter']
57 );
58 $catalogReindex->initStep($params['counter'], $params['operationCounter'], $params['lastID']);
59 $catalogReindex->setParams($params);
60 $catalogReindex->run();
61 $result = $catalogReindex->saveStep();
62
63 header('Content-Type: application/x-javascript; charset='.LANG_CHARSET);
64 echo CUtil::PhpToJSObject($result, false, true);
65 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin_after.php');
66}
67elseif (
68 $request->getRequestMethod() == 'GET'
69 && $request['getIblock'] == 'Y'
70)
71{
73 header('Content-Type: application/x-javascript; charset='.LANG_CHARSET);
74 echo CUtil::PhpToJSObject($result, false, true);
75 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin_after.php');
76}
77elseif (
78 $request->getRequestMethod() == 'GET'
79 && $request['finalRequest'] == 'Y'
80)
81{
82 $iblockList = $request['iblockList'];
83 if (!empty($iblockList) && is_array($iblockList))
84 {
85 foreach ($iblockList as $iblock)
87 unset($iblock);
88 }
89 $emptyAvailable = Catalog\ProductTable::getList(array(
90 'select' => array('ID', 'AVAILABLE'),
91 'filter' => array('=AVAILABLE' => null),
92 'limit' => 1
93 ))->fetch();
94 if (empty($emptyAvailable))
96 unset($emptyAvailable);
97 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin_after.php');
98}
99else
100{
101 $APPLICATION->SetTitle(Loc::getMessage('BX_CATALOG_REINDEX_PAGE_TITLE'));
102
104
105 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_admin_after.php');
106
108 array('DIV' => 'catalogReindexTab01', 'TAB' => Loc::getMessage('BX_CATALOG_REINDEX_TAB'), 'ICON' => 'sale', 'TITLE' => Loc::getMessage('BX_CATALOG_REINDEX_TAB_TITLE'))
109 );
110 $tabControl = new CAdminTabControl('catalogReindex', $tabList, true, true);
111 Main\Page\Asset::getInstance()->addJs('/bitrix/js/catalog/step_operations.js');
112
113 ?><div id="catalog_reindex_error_div" style="margin:0; display: none;">
114 <div class="adm-info-message-wrap adm-info-message-red">
115 <div class="adm-info-message">
116 <div class="adm-info-message-title"><?= Loc::getMessage('BX_CATALOG_REINDEX_ERRORS_TITLE') ?></div>
117 <div id="catalog_reindex_error_cont"></div>
118 <div class="adm-info-message-icon"></div>
119 </div>
120 </div>
121 </div>
122 <form name="catalog_reindex_form" action="<?= $APPLICATION->GetCurPage() ?>" method="GET"><?php
123 $tabControl->Begin();
124 $tabControl->BeginNextTab();
125 ?><tr>
126 <td width="40%"><?= Loc::getMessage('BX_CATALOG_REINDEX_IBLOCK_ID') ?></td>
127 <td width="60%"><?php
129 $catalogIterator = Catalog\CatalogIblockTable::getList(array(
130 'select' => array('IBLOCK_ID'),
131 'filter' => array('=PRODUCT_IBLOCK_ID' => 0)
132 ));
133 while ($catalog = $catalogIterator->fetch())
134 {
135 $catalog['IBLOCK_ID'] = (int)$catalog['IBLOCK_ID'];
136 $catalogList[$catalog['IBLOCK_ID']] = $catalog['IBLOCK_ID'];
137 }
139 $catalogIterator = Catalog\CatalogIblockTable::getList(array(
140 'select' => array('PRODUCT_IBLOCK_ID'),
141 'filter' => array('>PRODUCT_IBLOCK_ID' => 0)
142 ));
143 while ($catalog = $catalogIterator->fetch())
144 {
145 $catalog['PRODUCT_IBLOCK_ID'] = (int)$catalog['PRODUCT_IBLOCK_ID'];
146 $catalogList[$catalog['PRODUCT_IBLOCK_ID']] = $catalog['PRODUCT_IBLOCK_ID'];
147 }
149 if (!empty($catalogList))
150 echo GetIBlockDropDownList(0, 'catalog_reindex_iblock_type', 'catalog_reindex_iblock_id', array('ID' => $catalogList));
151 unset($catalogList);
152 ?></td>
153 </tr>
154 <tr>
155 <td width="40%"><?= Loc::getMessage('BX_CATALOG_REINDEX_MAX_EXECUTION_TIME') ?></td>
156 <td width="60%"><input type="text" name="max_execution_time" id="max_execution_time" size="3" value="<?= $oneStepTime ?>"></td>
157 </tr>
158 <?php
159 $tabControl->Buttons();
160 ?>
161 <input type="button" id="catalog_reindex_start_button" value="<?= Loc::getMessage('BX_CATALOG_REINDEX_UPDATE_BTN') ?>">
162 <input type="button" id="catalog_reindex_stop_button" value="<?= Loc::getMessage('BX_CATALOG_REINDEX_STOP_BTN') ?>" disabled>
163 <?php
164 $tabControl->End();
165 ?></form>
166 <div id="reindexReport" style="display: none;"></div>
167 <?php
169 'url' => $APPLICATION->GetCurPage(),
170 'options' => array(
171 'ajaxSessionID' => 'catalogReindex',
172 'maxExecutionTime' => $oneStepTime,
173 'maxOperationCounter' => 10,
174 'counter' => 0
175 ),
176 'visual' => array(
177 'startBtnID' => 'catalog_reindex_start_button',
178 'stopBtnID' => 'catalog_reindex_stop_button',
179 'catalogSelectID' => 'catalog_reindex_iblock_id',
180 'timeFieldID' => 'max_execution_time',
181 'reportID' => 'reindexReport',
182 'prefix' => 'catalog_reindex_iblock_',
183 'resultContID' => 'catalog_reindex_result_div_',
184 'errorContID' => 'catalog_reindex_error_cont_',
185 'errorDivID' => 'catalog_reindex_error_div_'
186 ),
187 'ajaxParams' => array(
188 'operation' => 'Y'
189 )
190 );
191 ?>
192 <script>
193 var jsCatalogReindex = new BX.Catalog.CatalogReindex(<?= CUtil::PhpToJSObject($jsParams, false, true) ?>);
194 </script>
195 <?php
196 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin.php');
197}
global $APPLICATION
Определения include.php:80
while($arIBlock=$rsIBlocks->Fetch()) $catalogIterator
Определения options.php:1934
const PUBLIC_AJAX_MODE
Определения catalog_reindex.php:6
$jsParams
Определения catalog_reindex.php:168
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
$catalogList
Определения catalog_reindex.php:128
$tabList
Определения catalog_reindex.php:107
$oneStepTime
Определения catalog_reindex.php:103
Определения loader.php:13
static clearIblockTagCache($iblock_id)
Определения iblock.php:4599
static removeNotify()
Определения step_operations.php:1671
static getIblockList($iblockId)
Определения step_operations.php:448
static getDefaultExecutionTime()
Определения step_operations.php:162
static PhpToJSObject($arData, $bWS=false, $bSkipTilda=false, $bExtType=false)
Определения util.php:66
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения file_new.php:677
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Form FILTER_ACTION disabled
Определения options.php:358
const STOP_STATISTICS
Определения froogle_util.php:2
$result
Определения get_property_values.php:14
GetIBlockDropDownList($IBLOCK_ID, $strTypeName, $strIBlockName, $arFilter=false, $strAddType='', $strAddIBlock='')
Определения iblock.php:737
$catalog
Определения iblock_catalog_edit.php:135
if(! $catalogEdit->isSuccess()) $iblock
Определения iblock_catalog_edit.php:38
$iblockList
Определения iblock_catalog_list.php:271
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
const NO_AGENT_CHECK
Определения cron_frame.php:17
$tabControl
Определения csv_new_setup.php:244
const LANG_CHARSET
Определения include.php:65
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
ShowError($strError, $cls="errortext")
Определения tools.php:4499
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
die
Определения quickway.php:367
font style
Определения invoice.php:442
font size
Определения invoice.php:442
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799