示例#1
0
/**
 * Main function
 *
 * @param string[] $argv Program parameters
 *
 * @return void
 */
function main($argv)
{
    $params = parseArgs($argv);
    applyConfigOverrides($params);
    if (empty($params['file'])) {
        echo <<<EOT
Usage: {$argv['0']} --file=... [...]

Parameters:

--file=...          The file for records
--deleted=...       The file for deleted record IDs
--from=...          From date where to start the export
--verbose           Enable verbose output
--quiet             Quiet, no output apart from the data
--skip=...          Skip x records to export only a "representative" subset
--source=...        Export only the given source(s)
                    (separate multiple sources with commas)
--single=...        Export single record with the given id
--xpath=...         Export only records matching the XPath expression
--config.section.name=...
                    Set configuration directive to given value overriding
                    any setting in recordmanager.ini
--sortdedup         Sort export file by dedup id
--dedupid=...       deduped = Add dedup id's to records that have duplicates
                    always  = Always add dedup id's to the records
                    Otherwise dedup id's are not added to the records


EOT;
        exit(1);
    }
    $manager = new RecordManager(true, isset($params['verbose']) ? $params['verbose'] : false);
    $manager->quiet = isset($params['quiet']) ? $params['quiet'] : false;
    $manager->exportRecords($params['file'], isset($params['deleted']) ? $params['deleted'] : '', isset($params['from']) ? $params['from'] : '', isset($params['skip']) ? $params['skip'] : 0, isset($params['source']) ? $params['source'] : '', isset($params['single']) ? $params['single'] : '', isset($params['xpath']) ? $params['xpath'] : '', isset($params['sortdedup']) ? $params['sortdedup'] : false, isset($params['dedupid']) ? $params['dedupid'] : '');
}