new: [server shell] list servers, fixes #7115

- simple human readable listing
- kept the old weird JSON producing listServers intact
pull/7071/merge
iglocska 2021-03-03 00:29:57 +01:00
parent 7f9afb84e7
commit 78a48ddc87
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 20 additions and 0 deletions

View File

@ -14,6 +14,26 @@ class ServerShell extends AppShell
public $uses = array('Server', 'Task', 'Job', 'User', 'Feed');
public $tasks = array('ConfigLoad');
public function list()
{
$this->ConfigLoad->execute();
$res = ['servers'=>[]];
$servers = $this->Server->find('all', [
'fields' => ['Server.id', 'Server.name', 'Server.url'],
'recursive' => 0
]);
foreach ($servers as $server) {
echo sprintf(
'%sServer #%s :: %s :: %s',
PHP_EOL,
$server['Server']['id'],
$server['Server']['name'],
$server['Server']['url']
);
}
echo PHP_EOL;
}
public function listServers()
{
$this->ConfigLoad->execute();