You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
827 B
32 lines
827 B
#!/usr/bin/php |
|
<?php |
|
require(__DIR__ . '/_cli.php'); |
|
|
|
$params = array( |
|
'user:', |
|
'max-feed-entries:', |
|
); |
|
|
|
$options = getopt('', $params); |
|
|
|
if (!validateOptions($argv, $params) || empty($options['user'])) { |
|
fail('Usage: ' . basename(__FILE__) . " --user username ( --max-feed-entries 100 ) > /path/to/file.zip"); |
|
} |
|
|
|
$username = cliInitUser($options['user']); |
|
|
|
fwrite(STDERR, 'FreshRSS exporting ZIP for user “' . $username . "”…\n"); |
|
|
|
$importController = new FreshRSS_importExport_Controller(); |
|
|
|
$ok = false; |
|
try { |
|
$ok = $importController->exportFile(true, true, true, true, |
|
empty($options['max-feed-entries']) ? 100 : intval($options['max-feed-entries']), |
|
$username); |
|
} catch (FreshRSS_ZipMissing_Exception $zme) { |
|
fail('FreshRSS error: Lacking php-zip extension!'); |
|
} |
|
invalidateHttpCache($username); |
|
|
|
done($ok);
|
|
|