diff options
| author | 2019-11-04 17:45:15 +0100 | |
|---|---|---|
| committer | 2019-11-04 17:45:15 +0100 | |
| commit | 7819a43197d34ef7a6c5626e9e48d7db075c37c9 (patch) | |
| tree | c53735a350f01292642125fcb8686e2121afc38e /app/Controllers/userController.php | |
| parent | 67fc72fb618558f352acc7e098163d05294a6a66 (diff) | |
Default or custom OPML (#2627)
* Default or custom OPML
Fix https://github.com/FreshRSS/FreshRSS/issues/2075
Replaces https://github.com/FreshRSS/FreshRSS/pull/2515
https://github.com/FreshRSS/FreshRSS/issues/2514
Uses the local ./data/opml.xml if it exists, otherwise
./opml.default.xml
* Better message
* Move to controller
Diffstat (limited to 'app/Controllers/userController.php')
| -rw-r--r-- | app/Controllers/userController.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 6afc91b4e..7ce6b298a 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -248,7 +248,21 @@ class FreshRSS_user_Controller extends Minz_ActionController { } if ($ok) { $newUserDAO = FreshRSS_Factory::createUserDao($new_user_name); - $ok &= $newUserDAO->createUser($insertDefaultFeeds); + $ok &= $newUserDAO->createUser(); + + if ($ok && $insertDefaultFeeds) { + $opmlPath = DATA_PATH . '/opml.xml'; + if (!file_exists($opmlPath)) { + $opmlPath = FRESHRSS_PATH . '/opml.default.xml'; + } + $importController = new FreshRSS_importExport_Controller(); + try { + $importController->importFile($opmlPath, $opmlPath, $new_user_name); + } catch (Exception $e) { + Minz_Log::error('Error while importing default OPML for user ' . $new_user_name . ': ' . $e->getMessage()); + } + } + $ok &= self::updateUser($new_user_name, $email, $passwordPlain, $apiPasswordPlain); } return $ok; |
