From 42c80841c846610be280218d53fcde06b0f0063b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 6 Dec 2013 09:45:27 +0100 Subject: [change] we now use Full-Text RSS 3.1, thank you so much @fivefilters --- inc/3rdparty/simplepie/SimplePie/Cache/Base.php | 102 ------ inc/3rdparty/simplepie/SimplePie/Cache/DB.php | 124 ------- inc/3rdparty/simplepie/SimplePie/Cache/File.php | 112 ------ .../simplepie/SimplePie/Cache/Memcache.php | 118 ------- inc/3rdparty/simplepie/SimplePie/Cache/MySQL.php | 378 --------------------- 5 files changed, 834 deletions(-) delete mode 100644 inc/3rdparty/simplepie/SimplePie/Cache/Base.php delete mode 100644 inc/3rdparty/simplepie/SimplePie/Cache/DB.php delete mode 100644 inc/3rdparty/simplepie/SimplePie/Cache/File.php delete mode 100644 inc/3rdparty/simplepie/SimplePie/Cache/Memcache.php delete mode 100644 inc/3rdparty/simplepie/SimplePie/Cache/MySQL.php (limited to 'inc/3rdparty/simplepie/SimplePie/Cache') diff --git a/inc/3rdparty/simplepie/SimplePie/Cache/Base.php b/inc/3rdparty/simplepie/SimplePie/Cache/Base.php deleted file mode 100644 index e3cfa8af..00000000 --- a/inc/3rdparty/simplepie/SimplePie/Cache/Base.php +++ /dev/null @@ -1,102 +0,0 @@ -get_items(); - $items_by_id = array(); - - if (!empty($items)) - { - foreach ($items as $item) - { - $items_by_id[$item->get_id()] = $item; - } - - if (count($items_by_id) !== count($items)) - { - $items_by_id = array(); - foreach ($items as $item) - { - $items_by_id[$item->get_id(true)] = $item; - } - } - - if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) - { - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; - } - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) - { - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; - } - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) - { - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; - } - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) - { - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; - } - else - { - $channel = null; - } - - if ($channel !== null) - { - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']); - } - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']); - } - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']); - } - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']); - } - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']); - } - } - if (isset($data->data['items'])) - { - unset($data->data['items']); - } - if (isset($data->data['ordered_items'])) - { - unset($data->data['ordered_items']); - } - } - return array(serialize($data->data), $items_by_id); - } -} diff --git a/inc/3rdparty/simplepie/SimplePie/Cache/File.php b/inc/3rdparty/simplepie/SimplePie/Cache/File.php deleted file mode 100644 index f496ff50..00000000 --- a/inc/3rdparty/simplepie/SimplePie/Cache/File.php +++ /dev/null @@ -1,112 +0,0 @@ -location = $location; - $this->filename = $filename; - $this->extension = $extension; - $this->name = "$this->location/$this->filename.$this->extension"; - } - - public function save($data) - { - if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location)) - { - if (is_a($data, 'SimplePie')) - { - $data = $data->data; - } - - $data = serialize($data); - return (bool) file_put_contents($this->name, $data); - } - return false; - } - - public function load() - { - if (file_exists($this->name) && is_readable($this->name)) - { - return unserialize(file_get_contents($this->name)); - } - return false; - } - - public function mtime() - { - if (file_exists($this->name)) - { - return filemtime($this->name); - } - return false; - } - - public function touch() - { - if (file_exists($this->name)) - { - return touch($this->name); - } - return false; - } - - public function unlink() - { - if (file_exists($this->name)) - { - return unlink($this->name); - } - return false; - } -} diff --git a/inc/3rdparty/simplepie/SimplePie/Cache/Memcache.php b/inc/3rdparty/simplepie/SimplePie/Cache/Memcache.php deleted file mode 100644 index 3535fecc..00000000 --- a/inc/3rdparty/simplepie/SimplePie/Cache/Memcache.php +++ /dev/null @@ -1,118 +0,0 @@ -options = array( - 'host' => '127.0.0.1', - 'port' => 11211, - 'extras' => array( - 'timeout' => 3600, // one hour - 'prefix' => 'simplepie_', - ), - ); - $this->options = array_merge_recursive($this->options, SimplePie_Cache::parse_URL($url)); - $this->name = $this->options['extras']['prefix'] . md5("$filename:$extension"); - - $this->cache = new Memcache(); - $this->cache->addServer($this->options['host'], (int) $this->options['port']); - } - - public function save($data) - { - if (is_a($data, 'SimplePie')) - { - $data = $data->data; - } - return $this->cache->set($this->name, serialize($data), MEMCACHE_COMPRESSED, (int) $this->options['extras']['timeout']); - } - - public function load() - { - $data = $this->cache->get($this->name); - - if ($data !== false) - { - return unserialize($data); - } - return false; - } - - public function mtime() - { - $data = $this->cache->get($this->name); - - if ($data !== false) - { - // essentially ignore the mtime because Memcache expires on it's own - return time(); - } - - return false; - } - - public function touch() - { - $data = $this->cache->get($this->name); - - if ($data !== false) - { - return $this->cache->set($this->name, $data, MEMCACHE_COMPRESSED, (int) $this->duration); - } - - return false; - } - - public function unlink() - { - return $this->cache->delete($this->name); - } -} diff --git a/inc/3rdparty/simplepie/SimplePie/Cache/MySQL.php b/inc/3rdparty/simplepie/SimplePie/Cache/MySQL.php deleted file mode 100644 index 84b2cb6b..00000000 --- a/inc/3rdparty/simplepie/SimplePie/Cache/MySQL.php +++ /dev/null @@ -1,378 +0,0 @@ -options = array( - 'user' => null, - 'pass' => null, - 'host' => '127.0.0.1', - 'port' => '3306', - 'path' => '', - 'extras' => array( - 'prefix' => '', - ), - ); - $this->options = array_merge_recursive($this->options, SimplePie_Cache::parse_URL($url)); - - // Path is prefixed with a "/" - $this->options['dbname'] = substr($this->options['path'], 1); - - try - { - $this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - catch (PDOException $e) - { - $this->mysql = null; - return; - } - - $this->id = $name . $extension; - - if (!$query = $this->mysql->query('SHOW TABLES')) - { - $this->mysql = null; - return; - } - - $db = array(); - while ($row = $query->fetchColumn()) - { - $db[] = $row; - } - - if (!in_array($this->options['extras']['prefix'] . 'cache_data', $db)) - { - $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'); - if ($query === false) - { - $this->mysql = null; - } - } - - if (!in_array($this->options['extras']['prefix'] . 'items', $db)) - { - $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'); - if ($query === false) - { - $this->mysql = null; - } - } - } - - public function save($data) - { - if ($this->mysql === null) - { - return false; - } - - if (is_a($data, 'SimplePie')) - { - $data = clone $data; - - $prepared = self::prepare_simplepie_object_for_cache($data); - - $query = $this->mysql->prepare('SELECT COUNT(*) FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); - $query->bindValue(':feed', $this->id); - if ($query->execute()) - { - if ($query->fetchColumn() > 0) - { - $items = count($prepared[1]); - if ($items) - { - $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed'; - $query = $this->mysql->prepare($sql); - $query->bindValue(':items', $items); - } - else - { - $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed'; - $query = $this->mysql->prepare($sql); - } - - $query->bindValue(':data', $prepared[0]); - $query->bindValue(':time', time()); - $query->bindValue(':feed', $this->id); - if (!$query->execute()) - { - return false; - } - } - else - { - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)'); - $query->bindValue(':feed', $this->id); - $query->bindValue(':count', count($prepared[1])); - $query->bindValue(':data', $prepared[0]); - $query->bindValue(':time', time()); - if (!$query->execute()) - { - return false; - } - } - - $ids = array_keys($prepared[1]); - if (!empty($ids)) - { - foreach ($ids as $id) - { - $database_ids[] = $this->mysql->quote($id); - } - - $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `id` = ' . implode(' OR `id` = ', $database_ids) . ' AND `feed_id` = :feed'); - $query->bindValue(':feed', $this->id); - - if ($query->execute()) - { - $existing_ids = array(); - while ($row = $query->fetchColumn()) - { - $existing_ids[] = $row; - } - - $new_ids = array_diff($ids, $existing_ids); - - foreach ($new_ids as $new_id) - { - if (!($date = $prepared[1][$new_id]->get_date('U'))) - { - $date = time(); - } - - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(:feed, :id, :data, :date)'); - $query->bindValue(':feed', $this->id); - $query->bindValue(':id', $new_id); - $query->bindValue(':data', serialize($prepared[1][$new_id]->data)); - $query->bindValue(':date', $date); - if (!$query->execute()) - { - return false; - } - } - return true; - } - } - else - { - return true; - } - } - } - else - { - $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); - $query->bindValue(':feed', $this->id); - if ($query->execute()) - { - if ($query->rowCount() > 0) - { - $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed'); - $query->bindValue(':data', serialize($data)); - $query->bindValue(':time', time()); - $query->bindValue(':feed', $this->id); - if ($this->execute()) - { - return true; - } - } - else - { - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)'); - $query->bindValue(':id', $this->id); - $query->bindValue(':data', serialize($data)); - $query->bindValue(':time', time()); - if ($query->execute()) - { - return true; - } - } - } - } - return false; - } - - public function load() - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('SELECT `items`, `data` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); - $query->bindValue(':id', $this->id); - if ($query->execute() && ($row = $query->fetch())) - { - $data = unserialize($row[1]); - - if (isset($this->options['items'][0])) - { - $items = (int) $this->options['items'][0]; - } - else - { - $items = (int) $row[0]; - } - - if ($items !== 0) - { - if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) - { - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; - } - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) - { - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; - } - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) - { - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; - } - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) - { - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; - } - else - { - $feed = null; - } - - if ($feed !== null) - { - $sql = 'SELECT `data` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC'; - if ($items > 0) - { - $sql .= ' LIMIT ' . $items; - } - - $query = $this->mysql->prepare($sql); - $query->bindValue(':feed', $this->id); - if ($query->execute()) - { - while ($row = $query->fetchColumn()) - { - $feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row); - } - } - else - { - return false; - } - } - } - return $data; - } - return false; - } - - public function mtime() - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('SELECT `mtime` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); - $query->bindValue(':id', $this->id); - if ($query->execute() && ($time = $query->fetchColumn())) - { - return $time; - } - else - { - return false; - } - } - - public function touch() - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `mtime` = :time WHERE `id` = :id'); - $query->bindValue(':time', time()); - $query->bindValue(':id', $this->id); - if ($query->execute() && $query->rowCount() > 0) - { - return true; - } - else - { - return false; - } - } - - public function unlink() - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); - $query->bindValue(':id', $this->id); - $query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id'); - $query2->bindValue(':id', $this->id); - if ($query->execute() && $query2->execute()) - { - return true; - } - else - { - return false; - } - } -} -- cgit v1.2.3