function ftsearch_refresh_all_cache_logs()
{
    $rs = sql('SELECT `cache_logs`.`id` FROM `cache_logs` LEFT JOIN `search_index_times` ON `cache_logs`.`id`=`search_index_times`.`object_id` AND 1=`search_index_times`.`object_type` WHERE ISNULL(`search_index_times`.`object_id`) UNION DISTINCT SELECT `cache_logs`.`id` FROM `cache_logs` INNER JOIN `search_index_times` ON `search_index_times`.`object_type`=1 AND `cache_logs`.`id`=`search_index_times`.`object_id` WHERE `cache_logs`.`last_modified`>`search_index_times`.`last_refresh`');
    while ($r = sql_fetch_assoc($rs)) {
        ftsearch_refresh_cache_logs($r['id']);
    }
    sql_free_result($rs);
}
function ftsearch_refresh_all_cache_logs()
{
    $rs = XDb::xSql('SELECT `cache_logs`.`id`
        FROM `cache_logs`
            LEFT JOIN `search_index_times` ON `cache_logs`.`id`=`search_index_times`.`object_id`
                AND 1=`search_index_times`.`object_type`
        WHERE ISNULL(`search_index_times`.`object_id`)
        UNION DISTINCT
        SELECT `cache_logs`.`id`
        FROM `cache_logs`
            INNER JOIN `search_index_times` ON `search_index_times`.`object_type`=1
            AND `cache_logs`.`id`=`search_index_times`.`object_id`
        WHERE `cache_logs`.`last_modified`>`search_index_times`.`last_refresh`
            AND `cache_logs`.`deleted`=0');
    while ($r = XDb::xFetchArray($rs)) {
        ftsearch_refresh_cache_logs($r['id']);
    }
    XDb::xFreeResults($rs);
}