mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 03:25:55 +00:00
OPML improvements/fixes:
* allow CLI import of OPML files (--opml-import) * visualize OPML structure when importing * add strict type hints to most OPML class methods
This commit is contained in:
17
update.php
17
update.php
@@ -89,6 +89,7 @@
|
||||
"force-refetch" => "debug update: force refetch feed data",
|
||||
"force-rehash" => "debug update: force rehash articles",
|
||||
"opml-export:" => ["USER:FILE", "export OPML of USER to FILE"],
|
||||
"opml-import:" => ["USER:FILE", "import OPML for USER from FILE"],
|
||||
"user-list" => "list all users",
|
||||
# "user-add:" => ["USER[:PASSWORD]", "add USER, optionally without prompting for PASSWORD"],
|
||||
# "user-remove:" => ["USERNAME", "remove specified user"],
|
||||
@@ -380,6 +381,22 @@
|
||||
|
||||
$rc = $opml->opml_export($filename, $owner_uid, false, true, true);
|
||||
|
||||
Debug::log($rc ? "Success." : "Failed.");
|
||||
} else {
|
||||
Debug::log("User not found: $user");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($options["opml-import"])) {
|
||||
list ($user, $filename) = explode(":", $options["opml-import"], 2);
|
||||
|
||||
Debug::log("Importing feeds of user $user from OPML file $filename...");
|
||||
|
||||
if ($owner_uid = UserHelper::find_user_by_login($user)) {
|
||||
$opml = new OPML("");
|
||||
|
||||
$rc = $opml->opml_import($owner_uid, $filename);
|
||||
|
||||
Debug::log($rc ? "Success." : "Failed.");
|
||||
} else {
|
||||
Debug::log("User not found: $user");
|
||||
|
||||
Reference in New Issue
Block a user