summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
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");
+ }
}