summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-10-15 10:06:00 +0300
committerAndrew Dolgov <[email protected]>2021-10-15 10:06:00 +0300
commita936e806307c280d255aca74b47a49745ff9bed9 (patch)
tree9a3802988ea57defab30998935bab55e1d0782f7 /update.php
parent9e7e0e84d771095a2f7b2414419485f41e6f7b51 (diff)
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
Diffstat (limited to 'update.php')
-rwxr-xr-xupdate.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/update.php b/update.php
index 67bf68f23..2ad4c963c 100755
--- a/update.php
+++ b/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"],
@@ -384,6 +385,22 @@
} 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");
+ }
}