X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FBookmark%2Fdeliciousbackupimporter.php;h=0ceba61d89a1619b009cf771bf4e20b82b335a1a;hb=b6cfcfbcaa0459b39c5d581c103bfa031b2e02cd;hp=01b996bbe534df1103db8d9725a7bfa7bed712f6;hpb=402cac2f93d6ccb89abf0e8a314e3f69d597b898;p=quix0rs-gnu-social.git diff --git a/plugins/Bookmark/deliciousbackupimporter.php b/plugins/Bookmark/deliciousbackupimporter.php index 01b996bbe5..0ceba61d89 100644 --- a/plugins/Bookmark/deliciousbackupimporter.php +++ b/plugins/Bookmark/deliciousbackupimporter.php @@ -4,7 +4,7 @@ * Copyright (C) 2010, StatusNet, Inc. * * Importer class for Delicious.com backups - * + * * PHP version 5 * * This program is free software: you can redistribute it and/or modify @@ -44,7 +44,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class DeliciousBackupImporter extends QueueHandler { /** @@ -52,7 +51,6 @@ class DeliciousBackupImporter extends QueueHandler * * @return string transport string */ - function transport() { return 'dlcsback'; @@ -65,24 +63,37 @@ class DeliciousBackupImporter extends QueueHandler * and import to StatusNet as Bookmark activities. * * The document format is terrible. It consists of a
's lost inside. * * @param array $data pair of user, text * * @return boolean success value */ - function handle($data) { list($user, $body) = $data; - $doc = $this->importHTML($body); + try { + $doc = $this->importHTML($body); + } catch (ClientException $cex) { + // XXX: message to the user + common_log(LOG_WARNING, $cex->getMessage()); + return true; + } + + // If we can't parse it, it's no good + + if (empty($doc)) { + return true; + } $dls = $doc->getElementsByTagName('dl'); if ($dls->length != 1) { - throw new ClientException(_("Bad import file.")); + // XXX: message to the user + common_log(LOG_WARNING, 'Bad input file'); + return true; } $dl = $dls->item(0); @@ -97,9 +108,11 @@ class DeliciousBackupImporter extends QueueHandler if ($child->nodeType != XML_ELEMENT_NODE) { continue; } - common_log(LOG_INFO, $child->tagName); switch (strtolower($child->tagName)) { case 'dt': + //
in the