fossar / selfoss

multipurpose rss reader, live stream, mashup, aggregation web application
https://selfoss.aditu.de
GNU General Public License v3.0
2.35k stars 343 forks source link

Add a selfossctl CLI tool #1440

Open jtojnar opened 1 year ago

jtojnar commented 1 year ago

This replaces the cliupdate.php script with a symfony/console based entry point:

php bin/selfossctl update

In the future we are going to introduce more commands.

netlify[bot] commented 1 year ago

Deploy Preview for selfoss ready!

Name Link
Latest commit 07b6cfb198c2581962ad83ae4f4de87a6ebee9f1
Latest deploy log https://app.netlify.com/sites/selfoss/deploys/6599e94b6d18c30008009af9
Deploy Preview https://deploy-preview-1440--selfoss.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

jtojnar commented 1 year ago

I do not really like Symfony console.

ContentLoader used transitively by UpdateCommand is obtaining a DatabaseConnection through dependency injection. As a result, every time selfossctl is run, it will attempt to connect to database.

It is possible to make loading the commands lazy using ContainerCommandLoader (if it were not buggy with slince/di) but because that does not have access to command descriptions, it will still require instantiating all commands when doing selfossctl list.

Now, Symfony Console also supports lazy command descriptions but I would either have to use Symfony’s DI container (regular commands are getting turned to lazy ones in AddConsoleCommandPass) or create LazyCommands manually (that’s what we are doing now).

And even then selfossctl help update still requires instantiating the command.