#!/usr/bin/env php
<?php

/**
 * Use as follows:
 * $ queue -s <queue_gateway_id> -n <number of messages to be sent>
 *
 * E.g. to send 15 messages of source queue gateway ID 2, do this:
 *
 * $ queue -s 2 -n 15
 */

define('TL_MODE', 'FE');
define('TL_SCRIPT', 'system/modules/filecredits/bin/indexer');
if (file_exists(__DIR__ . '/../../../initialize.php')) {
    // Regular way
    require_once(__DIR__ . '/../../../initialize.php');
} elseif (file_exists(__DIR__ . '/../../../../../system/initialize.php')) {
    // Try composer location in Contao 3 (see #77)
    require_once(__DIR__ . '/../../../../../system/initialize.php');
} elseif (file_exists(__DIR__ . '/../../../../system/initialize.php')) {
    // Try composer location in Contao 4 (see #120)
    require_once(__DIR__ . '/../../../../system/initialize.php');
} else {
    throw new \RuntimeException('Contao initialize.php not found');
}
$manager = new \HeimrichHannot\FileCredit\IndexManager();
$manager->run();