diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2020-08-24 22:06:34 +0200 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2020-08-26 22:48:17 +0200 |
commit | b73c7c0f8a43b5c4e65ca4daeb0ec7dc4c7c2306 (patch) | |
tree | 751e5310b824c343ec0c199fd9c3b1eb1b14b0ff /bin/tools | |
parent | e42150067ba185516caf370b725574f0db68e122 (diff) |
Cleanup appinfo files
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'bin/tools')
-rwxr-xr-x | bin/tools/generate_explore.php | 97 |
1 files changed, 0 insertions, 97 deletions
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 -<?php -/** - * Nextcloud - News - * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. - * - * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @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() ]; - } - } - -} |