<?php
// Добавляем задание синхронизации в Cron, если не добавлено
$result = run_query("SELECT * FROM `" . $config['table_prefix'] . "cron` WHERE `command` LIKE '%sync_data(%'");
if (!sql_fetch_assoc($result)) {
    run_query("INSERT INTO `" . $config['table_prefix'] . "cron` (`description`, `period`, `command`, `thread_name`) VALUES ('" . form_sql($lang['Sync']) . "', '* * * * *', 'sync_data(1);\r\nglobal \$sync_exp_data;\r\n\$sync_exp_data=array();\r\nflush_sync();\r\nsync_remote();', 'sync')");
}
$result = run_query("SELECT * FROM `" . $config['table_prefix'] . "cron` WHERE `command` LIKE '%sync_files(%'");
if (!sql_fetch_assoc($result)) {
    run_query("INSERT INTO `" . $config['table_prefix'] . "cron` (`description`, `period`, `command`, `thread_name`) VALUES ('" . form_sql($lang['Sync'] . " " . $lang['files']) . "', '* * * * *', 'sync_files();\r\necho \"Done\";', 'sync_files')");
}
?>