From b73c7c0f8a43b5c4e65ca4daeb0ec7dc4c7c2306 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Mon, 24 Aug 2020 22:06:34 +0200 Subject: Cleanup appinfo files Signed-off-by: Sean Molenaar --- bin/tools/generate_explore.php | 97 ------------------------------------------ 1 file changed, 97 deletions(-) delete mode 100755 bin/tools/generate_explore.php (limited to 'bin') diff --git a/bin/tools/generate_explore.php b/bin/tools/generate_explore.php deleted file mode 100755 index 766e82db7..000000000 --- a/bin/tools/generate_explore.php +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env php - - * @copyright Bernhard Posselt 2016 - */ -require_once __DIR__ . '/../../vendor/autoload.php'; -require_once __DIR__ . '/../../../../lib/base.php'; - -use FeedIo\FeedIo; -use Favicon\Favicon; -use OCA\News\AppInfo\Application; - -$generator = new ExploreGenerator(); -$generator->parse_argv($argv); -print(json_encode($generator->read(), JSON_PRETTY_PRINT)); -print("\n"); - -/** - * This is used for generating a JSON config section for a feed by executing: - * php -f generate_authors.php www.feed.com - * @deprecated Use ./occ news:generate-explore instead. - */ -class ExploreGenerator -{ - /** - * Feed and favicon fetcher. - */ - protected $reader; - protected $favicon; - - /** - * Argument data - */ - protected $url; - protected $votes; - - /** - * Set up class. - */ - public function __construct() - { - $app = new Application(); - $container = $app->getContainer(); - - $this->reader = $container->query(FeedIo::class); - $this->favicon = new Favicon(); - } - - /** - * Parse required arguments. - * @param array $argv Arguments to the script. - * @return void - */ - public function parse_argv($argv = []) - { - if (count($argv) < 2 || count($argv) > 3) - { - print('Usage: php -f generate_explore http://path.com/feed [vote_count]'); - print("\n"); - exit(1); - } - - $this->votes = (count($argv) === 3) ? $argv[2] : 100; - $this->url = $argv[1]; - } - - /** - * Read the provided feed and return the important data. - * @return array Object representation of the feed - */ - public function read() - { - try { - $resource = $this->reader->read($this->url); - $feed = $resource->getFeed(); - $result = [ - 'title' => $feed->getTitle(), - 'favicon' => $this->favicon->get($feed->getLink()), - 'url' => $feed->getLink(), - 'feed' => $this->url, - 'description' => $feed->getDescription(), - 'votes' => $this->votes, - ]; - - return $result; - } catch (\Throwable $ex) { - return [ 'error' => $ex->getMessage() ]; - } - } - -} -- cgit v1.2.3