aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2020-04-30 12:11:51 +0200
committerGravatar GitHub <noreply@github.com> 2020-04-30 12:11:51 +0200
commit8f188ffa8498424653a3e6086ef99bbe1745cd29 (patch)
treee09c5dd3feb23cca561bae5eb3996df7bbfc536f /cli
parent4ac868b30102c8fc9c2499a9b56e98c5c2a93ea0 (diff)
Fix filenames for files exported with CLI (#2932)
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".
Diffstat (limited to 'cli')
-rwxr-xr-xcli/export-opml-for-user.php2
-rwxr-xr-xcli/export-zip-for-user.php5
2 files changed, 3 insertions, 4 deletions
diff --git a/cli/export-opml-for-user.php b/cli/export-opml-for-user.php
index 8e7ed08f7..79bf1f1b3 100755
--- a/cli/export-opml-for-user.php
+++ b/cli/export-opml-for-user.php
@@ -19,7 +19,7 @@ fwrite(STDERR, 'FreshRSS exporting OPML for user “' . $username . "”…\n");
$importController = new FreshRSS_importExport_Controller();
$ok = false;
-$ok = $importController->exportFile(true, false, false, array(), 0, $username);
+$ok = $importController->exportFile($username, true, false, false, array(), 0);
invalidateHttpCache($username);
diff --git a/cli/export-zip-for-user.php b/cli/export-zip-for-user.php
index b89a55104..fcefa9ccf 100755
--- a/cli/export-zip-for-user.php
+++ b/cli/export-zip-for-user.php
@@ -20,10 +20,9 @@ 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(true, true, true, true,
- empty($options['max-feed-entries']) ? 100 : intval($options['max-feed-entries']),
- $username);
+ $ok = $importController->exportFile($username, true, true, true, true, $number_entries);
} catch (FreshRSS_ZipMissing_Exception $zme) {
fail('FreshRSS error: Lacking php-zip extension!');
}