mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-01-18 02:07:53 -05:00
Filenames were created with the username of the current user. However, when we export the files with the CLI, the current user is "_". This commit makes the username always required in the `exportFile` method so we make sure to always manipulate a real value. Consequently, the filenames can be formatted correctly. Obviously, this has absolutely no impacts since the CLI doesn't consider the HTTP headers. It just makes things a bit more clear. It's a first step to remove the concept of "default user".
32 lines
858 B
PHP
Executable File
32 lines
858 B
PHP
Executable File
#!/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;
|
|
$number_entries = empty($options['max-feed-entries']) ? 100 : intval($options['max-feed-entries']);
|
|
try {
|
|
$ok = $importController->exportFile($username, true, true, true, true, $number_entries);
|
|
} catch (FreshRSS_ZipMissing_Exception $zme) {
|
|
fail('FreshRSS error: Lacking php-zip extension!');
|
|
}
|
|
invalidateHttpCache($username);
|
|
|
|
done($ok);
|