Welcome to mirror list, hosted at ThFree Co, Russian Federation.

refreshroster.php « command « lib - github.com/nextcloud/jsxc.nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 331810b1e4b154181b6c99ca3544604518fbb1d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

namespace OCA\OJSXC\Command;

use OCA\OJSXC\Db\PresenceMapper;
use OCA\OJSXC\RosterPush;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class RefreshRoster extends Command
{

	/**
	 * @var IUserManager
	 */
	private $userManager;

	/**
	 * @var RosterPush
	 */
	private $rosterPush;

	/**
	 * @var PresenceMapper
	 */
	private $presenceMapper;

	public function __construct(
		IUserManager $userManager,
		RosterPush $rosterPush,
		PresenceMapper $presenceMapper
	) {
		parent::__construct();
		$this->userManager = $userManager;
		$this->rosterPush = $rosterPush;
		$this->presenceMapper = $presenceMapper;
	}

	protected function configure()
	{
		$this->setName('ojsxc:refresh-roster');
		$this->setDescription('Refresh the roster of all users');
	}

	protected function execute(InputInterface $input, OutputInterface $output)
	{
		$stats = $this->rosterPush->refreshRoster();
		$output->writeln("Updated " . $stats["updated"] . " roster items");
		$output->writeln("Removed " . $stats["removed"] . " roster items");
	}
}