Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a selfossctl CLI tool #1440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
->exclude('client')
->exclude('utils')
->in(__DIR__)
->name('*.phtml');
->name('*.phtml')
->name('selfossctl');

$rules = [
'@Symfony' => true,
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- Source filters are stricter, they need to start and end with a `/`. ([#1423](https://github.com/fossar/selfoss/pull/1423))
- OPML importer has been merged into the React client. ([#1442](https://github.com/fossar/selfoss/pull/1442))
- Web requests will send `Accept-Encoding` header. ([#1482](https://github.com/fossar/selfoss/pull/1482))
- **`cliupdate.php` program has been replaced with `bin/selfossctl update`**. Do not forget to update cron scripts. ([#1440](https://github.com/fossar/selfoss/pull/1440))

## 2.19 – 2022-10-12
**This version requires PHP ~~5.6~~ 7.2 (see known regressions section) or newer. It is also the last version to support PHP 7.**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For more information visit our [web site](https://selfoss.aditu.de).
2. Make the directories `data/cache`, `data/favicons`, `data/logs`, `data/thumbnails` and `data/sqlite` writeable.
3. Insert database access data in `config.ini` (see below). You do not need to change anything if you want to use SQLite.
4. You do not need to create the database tables, they will be created automatically (ensure that your database user is allowed to create triggers).
5. Create cronjob or systemd timer for updating feeds and point it to https://yourselfossurl.com/update via wget or curl. You can also execute the `cliupdate.php` from command line.
5. Create cronjob or systemd timer for updating feeds and point it to https://yourselfossurl.com/update via wget or curl. You can also execute `bin/selfossctl update` from command line.

If you obtained selfoss using Git, some more steps will be required. See the [development](#development) section.

Expand Down
38 changes: 38 additions & 0 deletions bin/selfossctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

// SPDX-FileCopyrightText: 2023 Jan Tojnar <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

use Commands\UpdateCommand;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\LazyCommand;

require __DIR__ . '/../src/common.php';

/** @var ContainerInterface $container */
$commands = [
UpdateCommand::class,
];

$application = new Application();

// We cannot use ContainerCommandLoader because it does not support lazy loading.
foreach ($commands as $command) {
$name = $command::$defaultName;
$description = $command::$defaultDescription;

$lazyCommand = new LazyCommand(
/* name: */ $name,
/* aliases: */ [],
/* description: */ $description,
/* isHidden: */ false,
fn() => $container->get($command)
);
$application->add($lazyCommand);
}

$application->run();
23 changes: 0 additions & 23 deletions cliupdate.php

This file was deleted.

5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"slince/di": "^3.2",
"smottt/wideimage": "^1.1",
"symfony/cache": "^5.4",
"symfony/console": "^5.4",
"symfony/polyfill-php80": "^1.26",
"violet/streaming-json-encoder": "^1.1",
"vstelmakh/url-highlight": "^3.0",
Expand All @@ -44,13 +45,17 @@
],
"autoload": {
"psr-4": {
"Commands\\": "src/Commands/",
"controllers\\": "src/controllers/",
"daos\\": "src/daos/",
"helpers\\": "src/helpers/",
"spouts\\": "src/spouts/",
"Tests\\": "tests/"
}
},
"bin": [
"bin/selfossctl"
],
"config": {
"platform": {
"php": "7.4.0"
Expand Down
Loading