mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-04-21 06:47:20 -04:00
Merge pull request #1275 from Alkarex/export-date
Export files with date
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
* Explicit number: `https://freshrss.example/i/?a=rss&nb=10`
|
||||
* Limited by `min_posts_per_rss` and `max_posts_per_rss` in user config
|
||||
* Support custom ports `localhost:3306` for database servers [#1241](https://github.com/FreshRSS/FreshRSS/issues/1241)
|
||||
* Add date to exported files [#1240](https://github.com/FreshRSS/FreshRSS/issues/1240)
|
||||
* Bug fixing
|
||||
* Correction of bugs related CSRF tokens introduced in version 1.5.0 [#1253](https://github.com/FreshRSS/FreshRSS/issues/1253), [44f22ab](https://github.com/FreshRSS/FreshRSS/pull/1261/commits/d9bf9b2c6f0b2cc9dec3b638841b7e3040dcf46f)
|
||||
* Fix bug in Global view introduced in version 1.5.0 [#1269](https://github.com/FreshRSS/FreshRSS/pull/1269)
|
||||
|
||||
@@ -469,20 +469,21 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
|
||||
$export_opml = Minz_Request::param('export_opml', false);
|
||||
$export_starred = Minz_Request::param('export_starred', false);
|
||||
$export_feeds = Minz_Request::param('export_feeds', array());
|
||||
$day = date('Y-m-d');
|
||||
|
||||
$export_files = array();
|
||||
if ($export_opml) {
|
||||
$export_files['feeds.opml'] = $this->generateOpml();
|
||||
$export_files["feeds_${day}.opml.xml"] = $this->generateOpml();
|
||||
}
|
||||
|
||||
if ($export_starred) {
|
||||
$export_files['starred.json'] = $this->generateEntries('starred');
|
||||
$export_files["starred_${day}.json"] = $this->generateEntries('starred');
|
||||
}
|
||||
|
||||
foreach ($export_feeds as $feed_id) {
|
||||
$feed = $this->feedDAO->searchById($feed_id);
|
||||
if ($feed) {
|
||||
$filename = 'feed_' . $feed->category() . '_'
|
||||
$filename = "feed_${day}_" . $feed->category() . '_'
|
||||
. $feed->id() . '.json';
|
||||
$export_files[$filename] = $this->generateEntries('feed', $feed);
|
||||
}
|
||||
@@ -579,7 +580,8 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
|
||||
$zip->close();
|
||||
header('Content-Type: application/zip');
|
||||
header('Content-Length: ' . filesize($zip_file));
|
||||
header('Content-Disposition: attachment; filename="freshrss_export.zip"');
|
||||
$day = date('Y-m-d');
|
||||
header('Content-Disposition: attachment; filename="freshrss_' . $day . '_export.zip"');
|
||||
readfile($zip_file);
|
||||
unlink($zip_file);
|
||||
}
|
||||
@@ -599,9 +601,9 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
|
||||
|
||||
$content_type = '';
|
||||
if ($type === 'opml') {
|
||||
$content_type = "text/opml";
|
||||
$content_type = 'application/xml';
|
||||
} elseif ($type === 'json_feed' || $type === 'json_starred') {
|
||||
$content_type = "text/json";
|
||||
$content_type = 'application/json';
|
||||
}
|
||||
|
||||
header('Content-Type: ' . $content_type . '; charset=utf-8');
|
||||
|
||||
Reference in New Issue
Block a user