diff --git a/NEWS.md b/NEWS.md index 44778aa542..f456c776b5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -89,6 +89,7 @@ - PHP startup errors are now logged, instead of having F3 crash with Error 500 ([#1195](https://github.com/fossar/selfoss/pull/1195)) - In order to support offline mode, we moved much of the UI to the browser. ([#1150](https://github.com/fossar/selfoss/pull/1150), [#1184](https://github.com/fossar/selfoss/pull/1184), [#1215](https://github.com/fossar/selfoss/pull/1215), [#1216](https://github.com/fossar/selfoss/pull/1216)) - We carried out a significant internal refactoring ([#1164](https://github.com/fossar/selfoss/pull/1164), [#1190](https://github.com/fossar/selfoss/pull/1190)) +- Removed Instapaper spout since it has been broken since its acquisition. Sources using it were migrated to “RSS Feed (with content extraction)”. ([#1245](https://github.com/fossar/selfoss/pull/1245)) - Placeholders are now used for images before they are loaded to avoid content jumping around ([#1204](https://github.com/fossar/selfoss/pull/1204)) - Search button is now always on the screen, avoiding the need to scroll to top to be able to use it. ([#1231](https://github.com/fossar/selfoss/issues/1231)) - Button for opening articles, tags, sources and filters in the sidebar, as well as the source and tag links in articles are now real links, allowing to open them in a new tab by middle-clicking them. ([#1216](https://github.com/fossar/selfoss/issues/1216), [#695](https://github.com/fossar/selfoss/issues/695)) diff --git a/src/daos/mysql/Database.php b/src/daos/mysql/Database.php index 21d575ac7f..0e2c2983e7 100644 --- a/src/daos/mysql/Database.php +++ b/src/daos/mysql/Database.php @@ -231,6 +231,12 @@ public function __construct(\DB\SQL $connection, Logger $logger) { 'INSERT INTO ' . \F3::get('db_prefix') . 'version (version) VALUES (12)' ]); } + if (strnatcmp($version, '13') < 0) { + $this->exec([ + 'UPDATE ' . \F3::get('db_prefix') . "sources SET spout = 'spouts\\\\rss\\\\fulltextrss' WHERE spout = 'spouts\\\\rss\\\\instapaper'", + 'INSERT INTO ' . \F3::get('db_prefix') . 'version (version) VALUES (13)' + ]); + } } } diff --git a/src/daos/pgsql/Database.php b/src/daos/pgsql/Database.php index 1063105bf2..99ae67c120 100644 --- a/src/daos/pgsql/Database.php +++ b/src/daos/pgsql/Database.php @@ -219,6 +219,12 @@ public function __construct(\DB\SQL $connection, Logger $logger) { 'INSERT INTO version (version) VALUES (12)' ]); } + if (strnatcmp($version, '13') < 0) { + $this->exec([ + "UPDATE sources SET spout = 'spouts\\rss\\fulltextrss' WHERE spout = 'spouts\\rss\\instapaper'", + 'INSERT INTO ' . \F3::get('db_prefix') . 'version (version) VALUES (13)' + ]); + } } } diff --git a/src/daos/sqlite/Database.php b/src/daos/sqlite/Database.php index 4b03c17ea4..72546835eb 100644 --- a/src/daos/sqlite/Database.php +++ b/src/daos/sqlite/Database.php @@ -231,6 +231,12 @@ public function __construct(\DB\SQL $connection, Logger $logger) { 'INSERT INTO version (version) VALUES (11)' ]); } + if (strnatcmp($version, '13') < 0) { + $this->exec([ + "UPDATE sources SET spout = 'spouts\\rss\\fulltextrss' WHERE spout = 'spouts\\rss\\instapaper'", + 'INSERT INTO version (version) VALUES (13)' + ]); + } } } diff --git a/src/spouts/rss/instapaper.php b/src/spouts/rss/instapaper.php deleted file mode 100644 index 3192127b12..0000000000 --- a/src/spouts/rss/instapaper.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @author Daniel Seither - */ -class instapaper extends feed { - /** @var string name of spout */ - public $name = 'RSS Feed (with instapaper)'; - - /** @var string description of this source type */ - public $description = 'Get feed and clean the content with instapaper.com service.'; - - /** @var array configurable parameters */ - public $params = [ - 'url' => [ - 'title' => 'URL', - 'type' => 'url', - 'default' => '', - 'required' => true, - 'validation' => ['notempty'] - ] - ]; - - public function load(array $params) { - parent::load(['url' => $params['url']]); - } - - public function getContent() { - $contentFromInstapaper = $this->fetchFromInstapaper(parent::getLink()); - if ($contentFromInstapaper === null) { - return 'instapaper parse error
' . parent::getContent(); - } - - return $contentFromInstapaper; - } - - /** - * fetch content from instapaper.com - * - * @author janeczku @github - * - * @param string $url - * - * @return string content - */ - private function fetchFromInstapaper($url) { - if (function_exists('curl_init') && !ini_get('open_basedir')) { - $content = $this->file_get_contents_curl('https://www.instapaper.com/text?u=' . urlencode($url)); - } else { - $content = @file_get_contents('https://www.instapaper.com/text?u=' . urlencode($url)); - } - $dom = new \DOMDocument(); - @$dom->loadHTML($content); - if (!$dom) { - return null; - } - $xpath = new \DOMXPath($dom); - $elements = $xpath->query("//div[@id='story']"); - $content = $dom->saveXML($elements->item(0), LIBXML_NOEMPTYTAG); - - return $content; - } - - private function file_get_contents_curl($url) { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); - curl_setopt($ch, CURLOPT_TIMEOUT, 15); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_URL, $url); - $data = @curl_exec($ch); - curl_close($ch); - - return $data; - } -}