aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/importExportController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-12-26 17:23:23 +0100
committerGravatar GitHub <noreply@github.com> 2020-12-26 17:23:23 +0100
commit4f742151992d3a56aea5780bbd062ba18fd8a14b (patch)
tree63f4ace97632bb1d859f9a4ce53d9db483938344 /app/Controllers/importExportController.php
parent4abb30228b70723f50499f9f00435fb3e3cd4fbe (diff)
Better OPML import of feeds in multiple categories (#3286)
#fix https://github.com/FreshRSS/FreshRSS/issues/3284 Helps https://github.com/FreshRSS/FreshRSS/issues/1989 In OPMLs files in which feeds are listed several times, favour the version in a category instead of in no category.
Diffstat (limited to 'app/Controllers/importExportController.php')
-rw-r--r--app/Controllers/importExportController.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php
index 3187e1325..9e89189fd 100644
--- a/app/Controllers/importExportController.php
+++ b/app/Controllers/importExportController.php
@@ -251,6 +251,13 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
$nb_cats = count($this->catDAO->listCategories(false));
$limits = FreshRSS_Context::$system_conf->limits;
+ //Sort with categories first
+ usort($opml_elements, function ($a, $b) {
+ return strcmp(
+ (isset($a['xmlUrl']) ? 'Z' : 'A') . $a['text'],
+ (isset($b['xmlUrl']) ? 'Z' : 'A') . $b['text']);
+ });
+
foreach ($opml_elements as $elt) {
if (isset($elt['xmlUrl'])) {
// If xmlUrl exists, it means it is a feed