getOrdersToSync()->select('COUNT(*)')->execute()->fetchOne();
try {
$products = $abra->getClient()->weGetChangesCount() / 1000;
} catch (\Throwable $e) {
$products = 999;
}
echo max($orders, $products);
exit;
}
?>
syncOrder($order_id);
exit;
}
if ($order_id = getVal('dump_order')) {
var_dump($abra->getOrder($order_id));
exit;
}
if (getVal('fix_titles')) {
$abra->fixProductsTitles();
exit;
}
if (getVal('peek')) {
$abra->getClient()->weGetChanges(0, getVal('peek', null, 500));
$abra->printTrace();
exit;
}
if (getVal('updateScheduledProducts')) {
ob_implicit_flush();
$delayedCount = 1;
$counter = 1;
while ($delayedCount > 0 && $counter <= getVal('limit', null, 100)) {
$delayedCount = sqlQueryBuilder()->select('COUNT(*)')->from('abra_delayed_update')->execute()->fetchColumn(0);
echo PHP_EOL.'
'.PHP_EOL.'run # '.$counter.', rows in abra_delayed_update: '.$delayedCount.' ';
@ob_flush();
flush();
if ($delayedCount > 0) {
$abra->updateScheduledProducts();
}
echo ' [OK]'.PHP_EOL.'
'.PHP_EOL;
$counter++;
}
exit;
}
if (getVal('replay')) {
$type = getVal('type', null, 'abra');
if (isset($_POST['changes'])) {
$changes = explode("\n", $_POST['changes']);
foreach ($changes as $change) {
$change = trim($change);
switch ($type) {
case 'abra':
$body = new stdClass();
$body->data = $change;
break;
case 'claims':
$body = json_decode($change);
break;
}
$abra->{"process_message_{$type}"}($body);
}
$abra->updateScheduledProducts();
} ?>
syncTranslations(getVal('sync_translations'), $_GET);
exit;
}
if (isset($_GET['sync_all'])) {
$abra->getAllData(getVal('sync_all'), $_GET);
} elseif (getVal('loop')) {
$abra->loopSychronization(getVal('loop'));
} else {
$abra->sync();
}