This commit is contained in:
robertdahlem 2024-05-17 12:01:02 +02:00 committed by GitHub
commit eb23d3b823
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -10,6 +10,9 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
private FreshRSS_FeedDAO $feedDAO;
/** @var FreshRSS_CategoryDAO */
private $categoryDAO;
/**
* This action is called before every other action in that class. It is
* the common boilerplate for every action. It is triggered by the
@ -23,6 +26,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
$this->entryDAO = FreshRSS_Factory::createEntryDao();
$this->feedDAO = FreshRSS_Factory::createFeedDao();
$this->categoryDAO = FreshRSS_Factory::createCategoryDao();
}
/**
@ -67,6 +71,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
$this->entryDAO = FreshRSS_Factory::createEntryDao($username);
$this->feedDAO = FreshRSS_Factory::createFeedDao($username);
$this->categoryDAO = FreshRSS_Factory::createCategoryDao();
$type_file = self::guessFileType($name);
@ -552,10 +557,19 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
}
$name = empty($origin['title']) ? $website : $origin['title'];
$cat_id = FreshRSS_CategoryDAO::DEFAULTCATEGORYID;
if (!empty($origin['category'])) {
$new_cat = $this->categoryDAO->searchByName($origin['category']);
$new_cat_id = $new_cat === null ? $this->categoryDAO->addCategory(['name' => $origin['category']]) : $new_cat->id();
if ($new_cat_id != false) {
$cat_id = $new_cat_id;
}
}
try {
// Create a Feed object and add it in database.
$feed = new FreshRSS_Feed($url);
$feed->_categoryId(FreshRSS_CategoryDAO::DEFAULTCATEGORYID);
$feed->_categoryId($cat_id);
$feed->_name($name);
$feed->_website($website);
if (!empty($origin['disable'])) {